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

Diff for /src/usr.bin/less/os.c between version 1.6 and 1.7

version 1.6, 2003/04/13 18:26:26 version 1.7, 2003/06/07 03:35:19
Line 23 
Line 23 
   
 #include "less.h"  #include "less.h"
 #include <signal.h>  #include <signal.h>
 #include <setjmp.h>  
 #if HAVE_TIME_H  #if HAVE_TIME_H
 #include <time.h>  #include <time.h>
 #endif  #endif
Line 40 
Line 39 
 #define time_type       long  #define time_type       long
 #endif  #endif
   
 /*  
  * BSD setjmp() saves (and longjmp() restores) the signal mask.  
  * This costs a system call or two per setjmp(), so if possible we clear the  
  * signal mask with sigsetmask(), and use _setjmp()/_longjmp() instead.  
  * On other systems, setjmp() doesn't affect the signal mask and so  
  * _setjmp() does not exist; we just use setjmp().  
  */  
 #if HAVE__SETJMP && HAVE_SIGSETMASK  
 #define SET_JUMP        _setjmp  
 #define LONG_JUMP       _longjmp  
 #else  
 #define SET_JUMP        setjmp  
 #define LONG_JUMP       longjmp  
 #endif  
   
 public int reading;  
   
 static jmp_buf read_label;  
   
 extern int sigs;  extern int sigs;
   
 /*  /*
  * Like read() system call, but is deliberately interruptible.   * Like read() system call, but is deliberately interruptible.
  * A call to intread() from a signal handler will interrupt  
  * any pending iread().  
  */   */
         public int          public int
 iread(fd, buf, len)  iread(fd, buf, len)
Line 90 
Line 68 
         }          }
 #endif  #endif
 #endif  #endif
         if (SET_JUMP(read_label))  
         {  
                 /*  
                  * We jumped here from intread.  
                  */  
                 reading = 0;  
 #if HAVE_SIGPROCMASK  
                 {  
                   sigset_t mask;  
                   sigemptyset(&mask);  
                   sigprocmask(SIG_SETMASK, &mask, NULL);  
                 }  
 #else  
 #if HAVE_SIGSETMASK  
                 sigsetmask(0);  
 #else  
 #ifdef _OSK  
                 sigmask(~0);  
 #endif  
 #endif  
 #endif  
                 return (READ_INTR);  
         }  
   
         flush();          flush();
         reading = 1;  
 #if MSDOS_COMPILER==DJGPPC  #if MSDOS_COMPILER==DJGPPC
         if (isatty(fd))          if (isatty(fd))
         {          {
Line 154 
Line 108 
                 }                  }
         }          }
 #endif  #endif
         reading = 0;  
         if (n < 0)          if (n < 0)
                 return (-1);                  return (errno == EINTR ? READ_INTR : -1);
         return (n);          return (n);
 }  
   
 /*  
  * Interrupt a pending iread().  
  */  
         public void  
 intread()  
 {  
         LONG_JUMP(read_label, 1);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7