From: Jim Warner Date: Tue, 29 Jan 2013 06:00:00 +0000 (-0600) Subject: top: change default allow/suppress define for SIGWINCH X-Git-Tag: v3.3.7~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adca737758e5afc7be344a736953931894cbc19f;p=procps-ng top: change default allow/suppress define for SIGWINCH No top #define is enabled and that constitutes default behavior. So whenever a default behavior should change the define must be changed too if it is to remain off. This commit simply changes top's default behavior with respect to allowing/suppressing any potential flood of SIGWINCH during resize operations, if running under X. Formerly top would block those signals to reduce costs of repeated refreshes. That yields a requirement where the user would have to provide another keystroke for a final display update. That keystroke may not always be needed now, but it ultimately depends on some terminal emulator's scrollback buffer. In any case, the cost of re-sizing may go up a bit, under most window managers. (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Reference(s): commit 4f33b6b8c56464b4044deb29a3bb0e32622e108f http://www.freelists.org/post/procps/top-won-the-sigwinch-war http://www.freelists.org/post/procps/top-won-the-sigwinch-war,4 http://www.freelists.org/post/procps/top-won-the-sigwinch-war,5 Signed-off-by: Jim Warner --- diff --git a/top/top.c b/top/top.c index a1fad9fc..5987194f 100644 --- a/top/top.c +++ b/top/top.c @@ -884,7 +884,7 @@ static inline int ioa (struct timespec *ts) { FD_ZERO(&fs); FD_SET(STDIN_FILENO, &fs); -#ifdef OFF_SIGWINCH // conditional comments are silly, but help in documenting +#ifndef SIGNALS_LESS // conditional comments are silly, but help in documenting // hold here until we've got keyboard input, any signal (including SIGWINCH) #else // hold here until we've got keyboard input, any signal except SIGWINCH @@ -3745,7 +3745,7 @@ static void wins_stage_2 (void) { // lastly, initialize a signal set used to throttle one troublesome signal sigemptyset(&Sigwinch_set); -#ifndef OFF_SIGWINCH +#ifdef SIGNALS_LESS sigaddset(&Sigwinch_set, SIGWINCH); #endif } // end: wins_stage_2 @@ -5103,12 +5103,16 @@ int main (int dont_care_argc, char **argv) { if (ioa(&ts)) do_key(iokey(0)); } - /* note: the above ioa() routine exists to consolidate all logic - which is susceptible to signal interrupts and must then - produce a screen refresh. in this main loop frame_make - assumes responsibility for such refreshes. other logic - interacting with users must deal more directly with it. - */ + /* note: that above ioa routine exists to consolidate all logic + which is susceptible to signal interrupt and must then + produce a screen refresh. in this main loop frame_make + assumes responsibility for such refreshes. other logic + in contact with users must deal more obliquely with an + interrupt/refresh (hint: Frames_resize + return code)! + + (everything is perfectly justified plus right margins) + (are completely filled, but of course it must be luck) + */ } return 0; } // end: main diff --git a/top/top.h b/top/top.h index c19808c1..1e0f89dc 100644 --- a/top/top.h +++ b/top/top.h @@ -24,6 +24,7 @@ /* Defines represented in configure.ac ----------------------------- */ //#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */ +//#define SIGNALS_LESS /* favor reduced signal load over response */ /* Development/Debugging defines ----------------------------------- */ //#define ATEOJ_RPTHSH /* report on hash specifics, at end-of-job */ @@ -39,7 +40,6 @@ //#define NOBOOST_MEMS /* disable extra precision for mem fields */ //#define NOBOOST_PCNT /* disable extra precision for % fields */ //#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */ -//#define OFF_SIGWINCH /* favor response over reduced signal load */ //#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */ //#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */ //#define PRETEND4CPUS /* pretend we're smp with 4 ticsers (sic) */