top: preserve current screen when receiving a SIGWINCH
Prior to this commit, top has always taken the easiest (safest?) approach when dealing with those troublesome SIGWINCH interrupts. Whenever the user was on a screen other than the main display, any signal received would force an immediate exit, returning to the main screen. With these changes, top will retain the user's current position regardless of what screen he/she was viewing. In support the following additional changes were made: * the initial help screen requires an explicit end key ` not 'any other key' formerly used to request an exit * the colors mapping screen instructions were improved * ^Z response was made immediate, eliminating the flag * the sigaction's SA_RESTART flag had to be eliminated * sigprocmask logic was normailize to the bare minimum * the POSIX.1-2004 async-signal safe functions used in ` the signal handlers were acknowledged and documented (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Reference(s): http://www.freelists.org/post/procps/unwanted-topinspect-window-enclosure-with-the-terminal-size-change Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
10
top/top.h
10
top/top.h
@ -96,8 +96,8 @@ char *strcasestr(const char *haystack, const char *needle);
|
||||
|
||||
/* Length of time a message is displayed and the duration
|
||||
of a 'priming' wait during library startup (in microseconds) */
|
||||
#define MSG_USLEEP (useconds_t)1250000
|
||||
#define LIB_USLEEP (useconds_t)150000
|
||||
#define MSG_USLEEP 1250000
|
||||
#define LIB_USLEEP 150000
|
||||
|
||||
/* Specific process id monitoring support (command line only) */
|
||||
#define MONPIDMAX 20
|
||||
@ -197,6 +197,11 @@ enum scale_enum {
|
||||
SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb, SK_SENTINEL
|
||||
};
|
||||
|
||||
/* Used to manipulate (and document) the Frames_resize states */
|
||||
enum resize_states {
|
||||
RESIZ_clr, RESIZ_kbd, RESIZ_sig
|
||||
};
|
||||
|
||||
/* This typedef just ensures consistent 'process flags' handling */
|
||||
typedef unsigned char FLG_t;
|
||||
|
||||
@ -611,7 +616,6 @@ typedef struct WIN_t {
|
||||
//atic void bye_bye (const char *str);
|
||||
//atic void error_exit (const char *str);
|
||||
//atic void library_err (const char *fmts, ...);
|
||||
//atic void pause_pgm (void);
|
||||
//atic void sig_abexit (int sig);
|
||||
//atic void sig_endpgm (int dont_care_sig);
|
||||
//atic void sig_paused (int dont_care_sig);
|
||||
|
Reference in New Issue
Block a user