source: trunk/third/tcsh/tc.sig.h @ 9006

Revision 9006, 6.8 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9005, which included commits to RCS files with non-trunk default branches.
Line 
1/* $Header: /afs/dev.mit.edu/source/repository/third/tcsh/tc.sig.h,v 1.1.1.1 1996-10-02 06:09:29 ghudson 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 (SYSVREL > 0) || defined(BSD4_4) || defined(_MINIX)
42# include <signal.h>
43# ifndef SIGCHLD
44#  define SIGCHLD SIGCLD
45# endif /* SIGCHLD */
46#else /* SYSVREL == 0 */
47# include <sys/signal.h>
48#endif /* SYSVREL > 0 */
49
50#if defined(SUNOS4) || defined(DGUX) || defined(hp800)
51# define SAVESIGVEC
52#endif /* SUNOS4 || DGUX || hp800 */
53
54#if (SYSVREL > 0 && SYSVREL < 3 && !defined(BSDSIGS)) || defined(_MINIX) || defined(COHERENT)
55/*
56 * If we have unreliable signals...
57 */
58# define UNRELSIGS
59#endif /* SYSVREL > 0 && SYSVREL < 3 && !BSDSIGS || _MINIX || COHERENT */
60
61#ifdef BSDSIGS
62/*
63 * sigvec is not the same everywhere
64 */
65# if defined(_SEQUENT_) || (defined(_POSIX_SOURCE) && !defined(hpux))
66#  define HAVE_SIGVEC
67#  define mysigvec(a, b, c)     sigaction(a, b, c)
68typedef struct sigaction sigvec_t;
69#  define sv_handler sa_handler
70#  define sv_flags sa_flags
71# endif /* _SEQUENT || (_POSIX_SOURCE && !hpux) */
72
73# ifdef hpux
74#  define HAVE_SIGVEC
75#  define mysigvec(a, b, c)     sigvector(a, b, c)
76typedef struct sigvec sigvec_t;
77#  define NEEDsignal
78# endif /* hpux */
79
80# ifndef HAVE_SIGVEC
81#  define mysigvec(a, b, c)     sigvec(a, b, c)
82typedef struct sigvec sigvec_t;
83# endif /* HAVE_SIGVEC */
84
85# undef HAVE_SIGVEC
86#endif /* BSDSIGS */
87
88#if SYSVREL > 0
89# ifdef BSDJOBS
90/* here I assume that systems that have bsdjobs implement the
91 * the setpgrp call correctly. Otherwise defining this would
92 * work, but it would kill the world, because all the setpgrp
93 * code is the the part defined when BSDJOBS are defined
94 * NOTE: we don't want killpg(a, b) == kill(-getpgrp(a), b)
95 * cause process a might be already dead and getpgrp would fail
96 */
97#  define killpg(a, b) kill(-(a), (b))
98# else
99/* this is the poor man's version of killpg()! Just kill the
100 * current process and don't worry about the rest. Someday
101 * I hope I get to fix that.
102 */
103#  define killpg(a, b) kill((a), (b))
104# endif /* BSDJOBS */
105#endif /* SYSVREL > 0 */
106
107#ifdef _MINIX
108# include <signal.h>
109#  define killpg(a, b) kill((a), (b))
110#endif /* _MINIX */
111
112#ifdef _VMS_POSIX
113# define killpg(a, b) kill(-(a), (b))
114#endif /* atp _VMS_POSIX */
115
116#if !defined(NSIG) && defined(SIGMAX)
117# define NSIG (SIGMAX+1)
118#endif /* !NSIG && SIGMAX */
119#if !defined(NSIG) && defined(_SIG_MAX)
120# define NSIG (_SIG_MAX+1)
121#endif /* !NSIG && _SIG_MAX */
122#if !defined(NSIG) && defined(_NSIG)
123# define NSIG _NSIG
124#endif /* !NSIG && _NSIG */
125#if !defined(MAXSIG) && defined(NSIG)
126# define MAXSIG NSIG
127#endif /* !MAXSIG && NSIG */
128
129#ifdef BSDSIGS
130/*
131 * For 4.2bsd signals.
132 */
133# ifdef sigmask
134#  undef sigmask
135# endif /* sigmask */
136# define        sigmask(s)      (1 << ((s)-1))
137# ifdef POSIXSIGS
138#  define       sigpause(a)     bsd_sigpause(a)
139#  define       signal(a, b)    bsd_signal(a, b)
140# endif /* POSIXSIGS */
141# ifndef _SEQUENT_
142#  define       sighold(s)      sigblock(sigmask(s))
143#  define       sigignore(s)    signal(s, SIG_IGN)
144#  define       sigset(s, a)    signal(s, a)
145# endif /* !_SEQUENT_ */
146# ifdef aiws
147#  define       sigrelse(a)     sigsetmask(sigblock(0) & ~sigmask(a))
148#  undef        killpg
149#  define       killpg(a, b)    kill(-getpgrp(a), b)
150#  define       NEEDsignal
151# endif /* aiws */
152#endif /* BSDSIGS */
153
154
155/*
156 * We choose a define for the window signal if it exists..
157 */
158#ifdef SIGWINCH
159# define SIG_WINDOW SIGWINCH
160#else
161# ifdef SIGWINDOW
162#  define SIG_WINDOW SIGWINDOW
163# endif /* SIGWINDOW */
164#endif /* SIGWINCH */
165
166#ifdef convex
167# ifdef notdef
168/* Does not seem to work right... Christos */
169#  define SIGSYNCH       0
170# endif
171# ifdef SIGSYNCH
172#  define SYNCHMASK     (sigmask(SIGCHLD)|sigmask(SIGSYNCH))
173# else
174#  define SYNCHMASK     (sigmask(SIGCHLD))
175# endif
176extern sigret_t synch_handler();
177#endif /* convex */
178
179#ifdef SAVESIGVEC
180# define NSIGSAVED 7
181 /*
182  * These are not inline for speed. gcc -traditional -O on the sparc ignores
183  * the fact that vfork() corrupts the registers. Calling a routine is not
184  * nice, since it can make the compiler put some things that we want saved
185  * into registers                              - christos
186  */
187# define savesigvec(sv)                                         \
188   (mysigvec(SIGINT,  (sigvec_t *) 0, &(sv)[0]),                \
189    mysigvec(SIGQUIT, (sigvec_t *) 0, &(sv)[1]),                \
190    mysigvec(SIGTSTP, (sigvec_t *) 0, &(sv)[2]),                \
191    mysigvec(SIGTTIN, (sigvec_t *) 0, &(sv)[3]),                \
192    mysigvec(SIGTTOU, (sigvec_t *) 0, &(sv)[4]),                \
193    mysigvec(SIGTERM, (sigvec_t *) 0, &(sv)[5]),                \
194    mysigvec(SIGHUP,  (sigvec_t *) 0, &(sv)[6]),                \
195    sigblock(sigmask(SIGINT) | sigmask(SIGQUIT) |               \
196            sigmask(SIGTSTP) | sigmask(SIGTTIN) |               \
197            sigmask(SIGTTOU) | sigmask(SIGTERM) |               \
198            sigmask(SIGHUP)))
199
200# define restoresigvec(sv, sm)                                  \
201    (void) (mysigvec(SIGINT,  &(sv)[0], (sigvec_t *) 0),        \
202            mysigvec(SIGQUIT, &(sv)[1], (sigvec_t *) 0),        \
203            mysigvec(SIGTSTP, &(sv)[2], (sigvec_t *) 0),        \
204            mysigvec(SIGTTIN, &(sv)[3], (sigvec_t *) 0),        \
205            mysigvec(SIGTTOU, &(sv)[4], (sigvec_t *) 0),        \
206            mysigvec(SIGTERM, &(sv)[5], (sigvec_t *) 0),        \
207            mysigvec(SIGHUP,  &(sv)[6], (sigvec_t *) 0),        \
208            sigsetmask(sm))
209# endif /* SAVESIGVEC */
210
211#endif /* _h_tc_sig */
Note: See TracBrowser for help on using the repository browser.