=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/top.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/top/top.c 2001/07/27 17:13:42 1.9 --- src/usr.bin/top/top.c 2001/09/04 23:35:59 1.10 *************** *** 1,4 **** ! /* $OpenBSD: top.c,v 1.9 2001/07/27 17:13:42 deraadt Exp $ */ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; --- 1,4 ---- ! /* $OpenBSD: top.c,v 1.10 2001/09/04 23:35:59 millert Exp $ */ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; *************** *** 25,32 **** * The following preprocessor variables, when defined, are used to * distinguish between different Unix implementations: * - * SIGHOLD - use SVR4 sighold function when defined - * SIGRELSE - use SVR4 sigrelse function when defined * FD_SET - macros FD_SET and FD_ZERO are used when defined */ --- 25,30 ---- *************** *** 56,64 **** /* The buffer that stdio will use */ char stdoutbuf[Buffersize]; - /* build Signal masks */ - #define Smask(s) (1 << ((s) - 1)) - /* imported from screen.c */ extern int overstrike; --- 54,59 ---- *************** *** 120,126 **** static char tempbuf1[50]; static char tempbuf2[50]; ! int old_sigmask; /* only used for BSD-style signals */ int topn = Default_TOPN; int delay = Default_DELAY; int displays = 0; /* indicates unspecified */ --- 115,121 ---- static char tempbuf1[50]; static char tempbuf2[50]; ! sigset_t mask, oldmask; int topn = Default_TOPN; int delay = Default_DELAY; int displays = 0; /* indicates unspecified */ *************** *** 457,470 **** displays = smart_terminal ? Infinity : 1; } ! /* hold interrupt signals while setting up the screen and the handlers */ ! #ifdef SIGHOLD ! sighold(SIGINT); ! sighold(SIGQUIT); ! sighold(SIGTSTP); ! #else ! old_sigmask = sigblock(Smask(SIGINT) | Smask(SIGQUIT) | Smask(SIGTSTP)); ! #endif init_screen(); (void) signal(SIGINT, leave); (void) signal(SIGQUIT, leave); --- 452,463 ---- displays = smart_terminal ? Infinity : 1; } ! /* block interrupt signals while setting up the screen and the handlers */ ! sigemptyset(&mask); ! sigaddset(&mask, SIGINT); ! sigaddset(&mask, SIGQUIT); ! sigaddset(&mask, SIGTSTP); ! sigprocmask(SIG_BLOCK, &mask, &oldmask); init_screen(); (void) signal(SIGINT, leave); (void) signal(SIGQUIT, leave); *************** *** 472,484 **** #ifdef SIGWINCH (void) signal(SIGWINCH, winch); #endif ! #ifdef SIGRELSE ! sigrelse(SIGINT); ! sigrelse(SIGQUIT); ! sigrelse(SIGTSTP); ! #else ! (void) sigsetmask(old_sigmask); ! #endif if (warnings) { fputs("....", stderr); --- 465,471 ---- #ifdef SIGWINCH (void) signal(SIGWINCH, winch); #endif ! sigprocmask(SIG_SETMASK, &oldmask, NULL); if (warnings) { fputs("....", stderr); *************** *** 640,650 **** (void) signal(SIGTSTP, SIG_DFL); /* unblock the signal and send ourselves one */ ! #ifdef SIGRELSE ! sigrelse(SIGTSTP); ! #else ! (void) sigsetmask(sigblock(0) & ~(1 << (SIGTSTP - 1))); ! #endif (void) kill(0, SIGTSTP); /* reset the signal handler */ --- 627,635 ---- (void) signal(SIGTSTP, SIG_DFL); /* unblock the signal and send ourselves one */ ! sigemptyset(&mask); ! sigaddset(&mask, SIGTSTP); ! sigprocmask(SIG_UNBLOCK, &mask, NULL); (void) kill(0, SIGTSTP); /* reset the signal handler */