diff options
Diffstat (limited to 'usr.bin/less/os.c')
-rw-r--r-- | usr.bin/less/os.c | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/usr.bin/less/os.c b/usr.bin/less/os.c index ac63960df95..c5343a043a8 100644 --- a/usr.bin/less/os.c +++ b/usr.bin/less/os.c @@ -23,7 +23,6 @@ #include "less.h" #include <signal.h> -#include <setjmp.h> #if HAVE_TIME_H #include <time.h> #endif @@ -40,31 +39,10 @@ #define time_type long #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; /* * Like read() system call, but is deliberately interruptible. - * A call to intread() from a signal handler will interrupt - * any pending iread(). */ public int iread(fd, buf, len) @@ -90,32 +68,8 @@ iread(fd, buf, len) } #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(); - reading = 1; #if MSDOS_COMPILER==DJGPPC if (isatty(fd)) { @@ -154,22 +108,12 @@ iread(fd, buf, len) } } #endif - reading = 0; if (n < 0) - return (-1); + return (errno == EINTR ? READ_INTR : -1); return (n); } /* - * Interrupt a pending iread(). - */ - public void -intread() -{ - LONG_JUMP(read_label, 1); -} - -/* * Return the current time. */ #if HAVE_TIME |