diff options
Diffstat (limited to 'contrib/tcsh/tc.sig.h')
-rw-r--r-- | contrib/tcsh/tc.sig.h | 171 |
1 files changed, 58 insertions, 113 deletions
diff --git a/contrib/tcsh/tc.sig.h b/contrib/tcsh/tc.sig.h index 2a6637e..3578181 100644 --- a/contrib/tcsh/tc.sig.h +++ b/contrib/tcsh/tc.sig.h @@ -1,4 +1,4 @@ -/* $Header: /src/pub/tcsh/tc.sig.h,v 3.28 2005/01/18 20:24:51 christos Exp $ */ +/* $Header: /p/tcsh/cvsroot/tcsh/tc.sig.h,v 3.32 2006/03/11 15:32:00 mitr Exp $ */ /* * tc.sig.h: Signal handling * @@ -43,55 +43,9 @@ # include <sys/signal.h> #endif /* SYSVREL > 0 */ -#if defined(__APPLE__) || defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(POSIXSIGS) && defined(VFORK)) +#if defined(__APPLE__) || defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) # define SAVESIGVEC -#endif /* SUNOS4 || DGUX || hp800 || SVR4 & POSIXSIGS & VFORK */ - -#if (SYSVREL > 0 && SYSVREL < 3 && !defined(BSDSIGS)) || defined(_MINIX) || defined(COHERENT) -/* - * If we have unreliable signals... - */ -# define UNRELSIGS -#endif /* SYSVREL > 0 && SYSVREL < 3 && !BSDSIGS || _MINIX || COHERENT */ - -#ifdef BSDSIGS -/* - * sigvec is not the same everywhere - */ -# if defined(_SEQUENT_) || (defined(_POSIX_SOURCE) && !defined(hpux)) -# define HAVE_SIGVEC -# define mysigvec(a, b, c) sigaction(a, b, c) -typedef struct sigaction sigvec_t; -/* eliminate compiler warnings since these are defined in signal.h */ -# undef sv_handler -# undef sv_flags -# define sv_handler sa_handler -# define sv_flags sa_flags -# endif /* _SEQUENT || (_POSIX_SOURCE && !hpux) */ - -# ifdef hpux -# define HAVE_SIGVEC -# define mysigvec(a, b, c) sigvector(a, b, c) -typedef struct sigvec sigvec_t; -# define NEEDsignal -# endif /* hpux */ - -# ifndef HAVE_SIGVEC -# ifdef POSIXSIGS -# define mysigvec(a, b, c) sigaction(a, b, c) -typedef struct sigaction sigvec_t; -# undef sv_handler -# undef sv_flags -# define sv_handler sa_handler -# define sv_flags sa_flags -# else /* BSDSIGS */ -# define mysigvec(a, b, c) sigvec(a, b, c) -typedef struct sigvec sigvec_t; -# endif /* POSIXSIGS */ -# endif /* HAVE_SIGVEC */ - -# undef HAVE_SIGVEC -#endif /* BSDSIGS */ +#endif /* SUNOS4 || DGUX || hp800 || SVR4 & VFORK */ #if SYSVREL > 0 # ifdef BSDJOBS @@ -124,6 +78,11 @@ typedef struct sigvec sigvec_t; # define killpg(a, b) kill(-(a), (b)) #endif /* atp _VMS_POSIX */ +#ifdef aiws +# undef killpg +# define killpg(a, b) kill(-getpgrp(a), b) +#endif /* aiws */ + #if !defined(NSIG) && defined(SIGMAX) # define NSIG (SIGMAX+1) #endif /* !NSIG && SIGMAX */ @@ -140,35 +99,6 @@ typedef struct sigvec sigvec_t; # define MAXSIG NSIG #endif /* !MAXSIG && NSIG */ -#ifdef BSDSIGS -/* - * For 4.2bsd signals. - */ -# ifdef sigmask -# undef sigmask -# endif /* sigmask */ -# define sigmask(s) (1 << ((s)-1)) -# ifdef POSIXSIGS -# define sigpause(a) (void) bsd_sigpause(a) -# ifdef WINNT_NATIVE -# undef signal -# endif /* WINNT_NATIVE */ -# define signal(a, b) bsd_signal(a, b) -# endif /* POSIXSIGS */ -# ifndef _SEQUENT_ -# define sighold(s) sigblock(sigmask(s)) -# define sigignore(s) signal(s, SIG_IGN) -# define sigset(s, a) signal(s, a) -# endif /* !_SEQUENT_ */ -# ifdef aiws -# define sigrelse(a) sigsetmask(sigblock(0) & ~sigmask(a)) -# undef killpg -# define killpg(a, b) kill(-getpgrp(a), b) -# define NEEDsignal -# endif /* aiws */ -#endif /* BSDSIGS */ - - /* * We choose a define for the window signal if it exists.. */ @@ -180,19 +110,6 @@ typedef struct sigvec sigvec_t; # endif /* SIGWINDOW */ #endif /* SIGWINCH */ -#ifdef convex -# ifdef notdef -/* Does not seem to work right... Christos */ -# define SIGSYNCH 0 -# endif -# ifdef SIGSYNCH -# define SYNCHMASK (sigmask(SIGCHLD)|sigmask(SIGSYNCH)) -# else -# define SYNCHMASK (sigmask(SIGCHLD)) -# endif -extern RETSIGTYPE synch_handler(); -#endif /* convex */ - #ifdef SAVESIGVEC # define NSIGSAVED 7 /* @@ -201,28 +118,56 @@ extern RETSIGTYPE synch_handler(); * nice, since it can make the compiler put some things that we want saved * into registers - christos */ -# define savesigvec(sv) \ - ((void) mysigvec(SIGINT, (sigvec_t *) 0, &(sv)[0]), \ - (void) mysigvec(SIGQUIT, (sigvec_t *) 0, &(sv)[1]), \ - (void) mysigvec(SIGTSTP, (sigvec_t *) 0, &(sv)[2]), \ - (void) mysigvec(SIGTTIN, (sigvec_t *) 0, &(sv)[3]), \ - (void) mysigvec(SIGTTOU, (sigvec_t *) 0, &(sv)[4]), \ - (void) mysigvec(SIGTERM, (sigvec_t *) 0, &(sv)[5]), \ - (void) mysigvec(SIGHUP, (sigvec_t *) 0, &(sv)[6]), \ - sigblock(sigmask(SIGINT) | sigmask(SIGQUIT) | \ - sigmask(SIGTSTP) | sigmask(SIGTTIN) | \ - sigmask(SIGTTOU) | sigmask(SIGTERM) | \ - sigmask(SIGHUP))) - -# define restoresigvec(sv, sm) \ - (void) ((void) mysigvec(SIGINT, &(sv)[0], (sigvec_t *) 0), \ - (void) mysigvec(SIGQUIT, &(sv)[1], (sigvec_t *) 0), \ - (void) mysigvec(SIGTSTP, &(sv)[2], (sigvec_t *) 0), \ - (void) mysigvec(SIGTTIN, &(sv)[3], (sigvec_t *) 0), \ - (void) mysigvec(SIGTTOU, &(sv)[4], (sigvec_t *) 0), \ - (void) mysigvec(SIGTERM, &(sv)[5], (sigvec_t *) 0), \ - (void) mysigvec(SIGHUP, &(sv)[6], (sigvec_t *) 0), \ - (void) sigsetmask(sm)) +# define savesigvec(sv, sm) \ + do { \ + sigset_t m__; \ + \ + sigaction(SIGINT, NULL, &(sv)[0]); \ + sigaction(SIGQUIT, NULL, &(sv)[1]); \ + sigaction(SIGTSTP, NULL, &(sv)[2]); \ + sigaction(SIGTTIN, NULL, &(sv)[3]); \ + sigaction(SIGTTOU, NULL, &(sv)[4]); \ + sigaction(SIGTERM, NULL, &(sv)[5]); \ + sigaction(SIGHUP, NULL, &(sv)[6]); \ + sigemptyset(&m__); \ + sigaddset(&m__, SIGINT); \ + sigaddset(&m__, SIGQUIT); \ + sigaddset(&m__, SIGTSTP); \ + sigaddset(&m__, SIGTTIN); \ + sigaddset(&m__, SIGTTOU); \ + sigaddset(&m__, SIGTERM); \ + sigaddset(&m__, SIGHUP); \ + sigprocmask(SIG_BLOCK, &m__, &sm); \ + } while (0) + +# define restoresigvec(sv, sm) \ + do { \ + sigaction(SIGINT, &(sv)[0], NULL); \ + sigaction(SIGQUIT, &(sv)[1], NULL); \ + sigaction(SIGTSTP, &(sv)[2], NULL); \ + sigaction(SIGTTIN, &(sv)[3], NULL); \ + sigaction(SIGTTOU, &(sv)[4], NULL); \ + sigaction(SIGTERM, &(sv)[5], NULL); \ + sigaction(SIGHUP, &(sv)[6], NULL); \ + sigprocmask(SIG_SETMASK, &sm, NULL); \ + } while (0) # endif /* SAVESIGVEC */ +extern int alrmcatch_disabled; +extern int pchild_disabled; +extern int phup_disabled; +extern int pintr_disabled; + +extern void sigset_interrupting(int, void (*) (int)); +extern void handle_pending_signals(void); + +extern void queue_alrmcatch(int); +extern void queue_pchild(int); +extern void queue_phup(int); +extern void queue_pintr(int); + +extern void disabled_cleanup(void *); +extern void pintr_disabled_restore(void *); +extern void pintr_push_enable(int *); + #endif /* _h_tc_sig */ |