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 4f33b6b8c5
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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-01-29 00:00:00 -06:00 committed by Craig Small
parent dca3c6d08f
commit adca737758
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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) */