1: /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/tc.sig.h,v 3.0 1991/07/04 23:34:26 christos Exp $ */
   2: /*
   3:  * tc.sig.h: Signal handling
   4:  *
   5:  */
   6: /*-
   7:  * Copyright (c) 1980, 1991 The Regents of the University of California.
   8:  * All rights reserved.
   9:  *
  10:  * Redistribution and use in source and binary forms, with or without
  11:  * modification, are permitted provided that the following conditions
  12:  * are met:
  13:  * 1. Redistributions of source code must retain the above copyright
  14:  *    notice, this list of conditions and the following disclaimer.
  15:  * 2. Redistributions in binary form must reproduce the above copyright
  16:  *    notice, this list of conditions and the following disclaimer in the
  17:  *    documentation and/or other materials provided with the distribution.
  18:  * 3. All advertising materials mentioning features or use of this software
  19:  *    must display the following acknowledgement:
  20:  *	This product includes software developed by the University of
  21:  *	California, Berkeley and its contributors.
  22:  * 4. Neither the name of the University nor the names of its contributors
  23:  *    may be used to endorse or promote products derived from this software
  24:  *    without specific prior written permission.
  25:  *
  26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36:  * SUCH DAMAGE.
  37:  */
  38: #ifndef _h_tc_sig
  39: #define _h_tc_sig
  40: 
  41: #if SVID > 0
  42: # include <signal.h>
  43: # ifndef SIGCHLD
  44: #  define SIGCHLD SIGCLD
  45: # endif				/* SIGCHLD */
  46: #else               /* SVID == 0 */
  47: # include <sys/signal.h>
  48: #endif				/* SVID > 0 */
  49: 
  50: #ifdef sun
  51: # define SAVESIGVEC
  52: #endif
  53: 
  54: #ifdef BSDSIGS
  55: /*
  56:  * sigvec is not the same everywhere
  57:  */
  58: # ifdef _SEQUENT_
  59: #  define HAVE_SIGVEC
  60: #  define mysigvec(a, b, c) sigaction(a, b, c)
  61: typedef struct sigaction sigvec_t;
  62: #  define sv_handler sa_handler
  63: # endif	/* _SEQUENT */
  64: 
  65: # ifdef hpux
  66: #  define HAVE_SIGVEC
  67: #  define mysigvec(a, b, c) sigvector(a, b, c)
  68: #  define NEEDsignal
  69: typedef struct sigvec sigvec_t;
  70: # endif	/* hpux */
  71: 
  72: # ifndef HAVE_SIGVEC
  73: #  define mysigvec(a, b, c) sigvec(a, b, c)
  74: typedef struct sigvec sigvec_t;
  75: # endif	/* HAVE_SIGVEC */
  76: 
  77: # undef HAVE_SIGVEC
  78: #endif /* BSDSIGS */
  79: 
  80: #if SVID > 0
  81: # ifdef BSDJOBS
  82: /* here I assume that systems that have bsdjobs implement the
  83:  * the setpgrp call correctly. Otherwise defining this would
  84:  * work, but it would kill the world, because all the setpgrp
  85:  * code is the the part defined when BSDJOBS are defined
  86:  * NOTE: we don't want killpg(a, b) == kill(-getpgrp(a), b)
  87:  * cause process a might be already dead and getpgrp would fail
  88:  */
  89: #  define killpg(a, b) kill(-(a), (b))
  90: # else
  91: /* this is the poor man's version of killpg()! Just kill the
  92:  * current process and don't worry about the rest. Someday
  93:  * I hope I get to fix that.
  94:  */
  95: #  define killpg(a, b) kill((a), (b))
  96: # endif	/* BSDJOBS */
  97: #endif /* SVID > 0 */
  98: 
  99: 
 100: #ifdef BSDSIGS
 101: /*
 102:  * For 4.2bsd signals.
 103:  */
 104: # ifdef sigmask
 105: #  undef sigmask
 106: # endif				/* sigmask */
 107: # define    sigmask(s)  ((sigmask_t)1 << ((s)-1))
 108: # ifdef _SEQUENT_
 109: #  define   sigpause(a) b_sigpause(a)
 110: #  define   signal(a, b)    sigset(a, b)
 111: # else /* _SEQUENT_ */
 112: #  define   sighold(s)  sigblock(sigmask(s))
 113: #  define   sigignore(s)    signal(s, SIG_IGN)
 114: #  define   sigset(s, a)    signal(s, a)
 115: # endif	/* _SEQUENT_ */
 116: # ifdef aiws
 117: #  define   sigrelse(a) sigsetmask(sigblock(0) & ~sigmask(a))
 118: #  undef    killpg
 119: #  define   killpg(a, b)    kill(-getpgrp(a), b)
 120: #  define   NEEDsignal
 121: # endif	/* aiws */
 122: #endif /* BSDSIGS */
 123: 
 124: 
 125: /*
 126:  * We choose a define for the window signal if it exists..
 127:  */
 128: #ifdef SIGWINCH
 129: # define SIG_WINDOW SIGWINCH
 130: #else
 131: # ifdef SIGWINDOW
 132: #  define SIG_WINDOW SIGWINDOW
 133: # endif	/* SIGWINDOW */
 134: #endif /* SIGWINCH */
 135: 
 136: #if defined(convex) || defined(__convex__)
 137: # define SIGSYNCH       0
 138: # ifdef SIGSYNCH
 139: #  define SYNCHMASK     (sigmask(SIGCHLD)|sigmask(SYNCH_SIG))
 140: # else
 141: #  define SYNCHMASK     (sigmask(SIGCHLD))
 142: # endif
 143: extern sigret_t synch_handler();
 144: #endif /* convex || __convex__ */
 145: 
 146: #ifdef SAVESIGVEC
 147: # define NSIGSAVED 7
 148:  /*
 149:   * These are not inline for speed. gcc -traditional -O on the sparc ignores
 150:   * the fact that vfork() corrupts the registers. Calling a routine is not
 151:   * nice, since it can make the comp_r put some things that we want saved
 152:   * into registers 				- christos
 153:   */
 154: # define savesigvec(sv)                     \
 155:    (mysigvec(SIGINT,  (sigvec_t *) 0, &(sv)[0]),        \
 156:     mysigvec(SIGQUIT, (sigvec_t *) 0, &(sv)[1]),        \
 157:     mysigvec(SIGTSTP, (sigvec_t *) 0, &(sv)[2]),        \
 158:     mysigvec(SIGTTIN, (sigvec_t *) 0, &(sv)[3]),        \
 159:     mysigvec(SIGTTOU, (sigvec_t *) 0, &(sv)[4]),        \
 160:     mysigvec(SIGTERM, (sigvec_t *) 0, &(sv)[5]),        \
 161:     mysigvec(SIGHUP,  (sigvec_t *) 0, &(sv)[6]),        \
 162:     sigblock(sigmask(SIGINT) | sigmask(SIGQUIT) |       \
 163:         sigmask(SIGTSTP) | sigmask(SIGTTIN) |       \
 164:         sigmask(SIGTTOU) | sigmask(SIGTERM) |       \
 165:         sigmask(SIGHUP)))
 166: 
 167: # define restoresigvec(sv, sm)                  \
 168:     (void) (mysigvec(SIGINT,  &(sv)[0], (sigvec_t *) 0),    \
 169:         mysigvec(SIGQUIT, &(sv)[1], (sigvec_t *) 0),    \
 170:         mysigvec(SIGTSTP, &(sv)[2], (sigvec_t *) 0),    \
 171:         mysigvec(SIGTTIN, &(sv)[3], (sigvec_t *) 0),    \
 172:         mysigvec(SIGTTOU, &(sv)[4], (sigvec_t *) 0),    \
 173:         mysigvec(SIGTERM, &(sv)[5], (sigvec_t *) 0),    \
 174:         mysigvec(SIGHUP,  &(sv)[6], (sigvec_t *) 0),    \
 175:         sigsetmask(sm))
 176: # endif				/* SAVESIGVEC */
 177: 
 178: #endif				/* _h_tc_sig */

Defined typedef's

sigvec_t defined in line 61; used 21 times

Defined macros

HAVE_SIGVEC defined in line 66; used 2 times
NEEDsignal defined in line 120; used 1 times
NSIGSAVED defined in line 147; used 1 times
SAVESIGVEC defined in line 51; used 5 times
SIGCHLD defined in line 44; used 3 times
SIGSYNCH defined in line 137; used 10 times
SYNCHMASK defined in line 141; used 1 times
_h_tc_sig defined in line 39; used 1 times
  • in line 38
killpg defined in line 119; used 5 times
mysigvec defined in line 73; used 20 times
restoresigvec defined in line 167; used 2 times
savesigvec defined in line 154; used 1 times
sigmask defined in line 107; used 14 times
signal defined in line 110; used 2 times
sigpause defined in line 109; used 5 times
sv_handler defined in line 62; used 4 times

Usage of this include

tc.sig.h used 1 times
Last modified: 1991-08-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3197
Valid CSS Valid XHTML 1.0 Strict