[BACK]Return to top.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Diff for /src/usr.bin/top/top.c between version 1.9 and 1.10

version 1.9, 2001/07/27 17:13:42 version 1.10, 2001/09/04 23:35:59
Line 25 
Line 25 
  * The following preprocessor variables, when defined, are used to   * The following preprocessor variables, when defined, are used to
  * distinguish between different Unix implementations:   * 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   *      FD_SET   - macros FD_SET and FD_ZERO are used when defined
  */   */
   
Line 56 
Line 54 
 /* The buffer that stdio will use */  /* The buffer that stdio will use */
 char stdoutbuf[Buffersize];  char stdoutbuf[Buffersize];
   
 /* build Signal masks */  
 #define Smask(s)        (1 << ((s) - 1))  
   
 /* imported from screen.c */  /* imported from screen.c */
 extern int overstrike;  extern int overstrike;
   
Line 120 
Line 115 
   
     static char tempbuf1[50];      static char tempbuf1[50];
     static char tempbuf2[50];      static char tempbuf2[50];
     int old_sigmask;            /* only used for BSD-style signals */      sigset_t mask, oldmask;
     int topn = Default_TOPN;      int topn = Default_TOPN;
     int delay = Default_DELAY;      int delay = Default_DELAY;
     int displays = 0;           /* indicates unspecified */      int displays = 0;           /* indicates unspecified */
Line 457 
Line 452 
         displays = smart_terminal ? Infinity : 1;          displays = smart_terminal ? Infinity : 1;
     }      }
   
     /* hold interrupt signals while setting up the screen and the handlers */      /* block interrupt signals while setting up the screen and the handlers */
 #ifdef SIGHOLD      sigemptyset(&mask);
     sighold(SIGINT);      sigaddset(&mask, SIGINT);
     sighold(SIGQUIT);      sigaddset(&mask, SIGQUIT);
     sighold(SIGTSTP);      sigaddset(&mask, SIGTSTP);
 #else      sigprocmask(SIG_BLOCK, &mask, &oldmask);
     old_sigmask = sigblock(Smask(SIGINT) | Smask(SIGQUIT) | Smask(SIGTSTP));  
 #endif  
     init_screen();      init_screen();
     (void) signal(SIGINT, leave);      (void) signal(SIGINT, leave);
     (void) signal(SIGQUIT, leave);      (void) signal(SIGQUIT, leave);
Line 472 
Line 465 
 #ifdef SIGWINCH  #ifdef SIGWINCH
     (void) signal(SIGWINCH, winch);      (void) signal(SIGWINCH, winch);
 #endif  #endif
 #ifdef SIGRELSE      sigprocmask(SIG_SETMASK, &oldmask, NULL);
     sigrelse(SIGINT);  
     sigrelse(SIGQUIT);  
     sigrelse(SIGTSTP);  
 #else  
     (void) sigsetmask(old_sigmask);  
 #endif  
     if (warnings)      if (warnings)
     {      {
         fputs("....", stderr);          fputs("....", stderr);
Line 640 
Line 627 
                     (void) signal(SIGTSTP, SIG_DFL);                      (void) signal(SIGTSTP, SIG_DFL);
   
                     /* unblock the signal and send ourselves one */                      /* unblock the signal and send ourselves one */
 #ifdef SIGRELSE                      sigemptyset(&mask);
                     sigrelse(SIGTSTP);                      sigaddset(&mask, SIGTSTP);
 #else                      sigprocmask(SIG_UNBLOCK, &mask, NULL);
                     (void) sigsetmask(sigblock(0) & ~(1 << (SIGTSTP - 1)));  
 #endif  
                     (void) kill(0, SIGTSTP);                      (void) kill(0, SIGTSTP);
   
                     /* reset the signal handler */                      /* reset the signal handler */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10