From 89ccfbf4f8be96294276fd677a95dd247f25e6c4 Mon Sep 17 00:00:00 2001 From: albert <> Date: Thu, 27 Mar 2003 16:28:41 +0000 Subject: [PATCH] whip me, beat me, make me do UNIX terminal handling --- NEWS | 4 ++++ proc/sysinfo.c | 4 ++-- procps.lsm | 2 +- top.c | 59 +++++--------------------------------------------- 4 files changed, 12 insertions(+), 57 deletions(-) diff --git a/NEWS b/NEWS index 406261d3..095335ff 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +procps-3.1.8 --> procps-3.1.9 + +top: fix suspend/resume behavior + procps-3.1.7 --> procps-3.1.8 top: fix keyboard handling (help screen, etc.) diff --git a/proc/sysinfo.c b/proc/sysinfo.c index 933bb56f..6cf936be 100644 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -443,7 +443,7 @@ static int compare_vm_table_structs(const void *a, const void *b){ // see include/linux/page-flags.h and mm/page_alloc.c unsigned long vm_nr_dirty; // dirty writable pages unsigned long vm_nr_writeback; // pages under writeback -unsigned long vm_nr_pagecache; // pages in pagecache +unsigned long vm_nr_pagecache; // pages in pagecache -- gone in 2.5.66+ kernels unsigned long vm_nr_page_table_pages;// pages used for pagetables unsigned long vm_nr_reverse_maps; // includes PageDirect unsigned long vm_nr_mapped; // mapped into pagetables @@ -479,7 +479,7 @@ void vminfo(void){ {"nr_dirty", &vm_nr_dirty}, // page version of meminfo Dirty {"nr_mapped", &vm_nr_mapped}, // page version of meminfo Mapped {"nr_page_table_pages", &vm_nr_page_table_pages},// same as meminfo PageTables - {"nr_pagecache", &vm_nr_pagecache}, + {"nr_pagecache", &vm_nr_pagecache}, // gone in 2.5.66+ kernels {"nr_reverse_maps", &vm_nr_reverse_maps}, // page version of meminfo ReverseMaps {"nr_slab", &vm_nr_slab}, // page version of meminfo Slab {"nr_writeback", &vm_nr_writeback}, // page version of meminfo Writeback diff --git a/procps.lsm b/procps.lsm index 58e4bafd..81684ca7 100644 --- a/procps.lsm +++ b/procps.lsm @@ -1,7 +1,7 @@ Begin4 Title: procps Version: 3.1.9 -Entered-date: 2003-03-20 +Entered-date: 2003-03-27 Description: Linux system utilities Keywords: procps /proc libproc sysctl pmap ps uptime tload free w top vmstat watch skill snice kill pgrep pkill diff --git a/top.c b/top.c index 0dc7a6ef..006d2cac 100644 --- a/top.c +++ b/top.c @@ -3141,13 +3141,6 @@ static void framehlp (int wix, int max) * (the CURSOR is STUCK in just the RIGHT place, know what I) * (mean? Huh, "doesn't DO MUCH"! Never, EVER think or say) * (THAT about THIS function again, Ok? Good that's better.) - * - * (ps. we ARE the UNEQUALED justification KING of COMMENTS!) - * (No, I don't mean significance/relevance, only alignment.) - * - * (What's that? Are you sure? Old main's REALLY GOOD too?) - * (You say he even JUSTIFIES comments in his FUNCTION BODY?) - * (Jeeze, how COULD I have known? That sob's NOT IN SCOPE!) */ static void frame_make (void) { @@ -3196,30 +3189,10 @@ static void frame_make (void) } - /* - * Darling, you DO look simply MARVELOUS -- have you been dieting? - * Or maybe it's because YOU and WINDOWS seem such a HAPPY couple. - * - * Of course NO. Not THOSE deathly BLUE WINDOWS! I mean your 'A' - * mode (alt display) windows. Yes, yes those completely OPTIONAL - * ones. We ALL know you'd NEVER FORCE that interface on ANY user - * - unlike You-Know-Who! Well I've got to run. But you're doing - * it just SPLENDIDLY! You go right on doing it EXACTLY the SAME! - */ int main (int dont_care_argc, char **argv) { (void)dont_care_argc; before(*argv); - /* - Ok, she's gone now. Don't you mind her, she means well but yes, she is - a bit of a busy-body. Always playing the matchmaker role, trying to do - away with unmarried windows and bachelors. So, back to business buddy! - - You're hungry, you said? How'd you like a sandwich? No, no, no -- not - the usual slopped together, hacked up illogic. I'm talkin' a carefully - reasoned, artfully crafted, extremely capable, well behaved executable! - - Well then, here, try THIS sandwich: */ // +-------------+ windows_stage1(); // top (sic) slice configs_read(); // > spread etc, < @@ -3261,7 +3234,11 @@ int main (int dont_care_argc, char **argv) if(file_flags==-1) file_flags=0; fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags); // check 1st, in case tv zeroed (by sig handler) before it got set - if (chin(0, &c, 1) <= 0) select(1, &fs, NULL, NULL, &tv); + if (chin(0, &c, 1) <= 0) { + fcntl(STDIN_FILENO, F_SETFL, file_flags); + select(1, &fs, NULL, NULL, &tv); + } + fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags); if (chin(0, &c, 1) > 0) { fcntl(STDIN_FILENO, F_SETFL, file_flags); do_key((unsigned)c); @@ -3271,31 +3248,5 @@ int main (int dont_care_argc, char **argv) } } - /* - (listen before we return, aren't you sort of sad for old 'frame_make'?) - (so, uh, why don't we just move this main guy to near the beginning of) - (the C source file. then that poor old function would be sure to have) - (at least a chance at scopin' us out, ya know what i mean? so what do) - (ya think? all things considered, would that be a proper thing to do?) - - Now there's an EXCELLENT idea! After all, SOME programmers DO code the - main function ANY OLD PLACE they feel like. And in doing THAT, they're - helping to keep those that FOLLOW out of mischief, busy HUNTING for the - thing. Further, by moving it we can contribute to PROTOTYPE - PROLIFERATION for every function main calls. Don't you KNOW that those - declarations OFTEN LINGER, usually long AFTER the REAL definitions have - DISAPPEARED, since programs do evolve? Yep that's a GREAT idea you got - there, NICE GOING! But, here's an opposing view: ANYONE who'd put main - ANYWHERE such that its LOCATION cannot be REACHED with JUST 1 KEYSTROKE - better turn in their Coding_Badge and Pocket_Protector then -- BE GONE! - The main function has only ONE proper HOME: always the LAST function in - that C Listing. End-of-Story, No-More-Discussion, so BE QUIET already! - - \---------------------------------------------------------------------/ - Sheeesh, didn't that doofus know the return statement can't be executed - or that we end via a caught signal? Oh Lordy, I is DROWNING in morons! - They done REACHED clear up to my OUTER braces! We's surely DOOMED now! - /---------------------------------------------------------------------\ - */ return 0; }