BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / sys / signal.h
index a113e68..b6278ff 100644 (file)
@@ -1,34 +1,45 @@
 /*
 /*
- * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
+ * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
  * All rights reserved.
  *
  * All rights reserved.
  *
- * Redistribution is only permitted until one year after the first shipment
- * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
- * binary forms are permitted provided that: (1) source distributions retain
- * this entire copyright notice and comment, and (2) distributions including
- * binaries display the following acknowledgement:  This product includes
- * software developed by the University of California, Berkeley and its
- * contributors'' in the documentation or other materials provided with the
- * distribution and in all advertising materials mentioning features or use
- * of this software.  Neither the name of the University nor the names of
- * its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)signal.h    7.11 (Berkeley) 7/1/90
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)signal.h    7.16 (Berkeley) 3/17/91
  */
 
  */
 
-#ifndef        NSIG
+#ifndef        _SIGNAL_H_
+#define        _SIGNAL_H_
+
 #define NSIG   32              /* counting 0; could be 33 (mask is 1-32) */
 
 #ifndef _POSIX_SOURCE
 #define NSIG   32              /* counting 0; could be 33 (mask is 1-32) */
 
 #ifndef _POSIX_SOURCE
-#ifdef KERNEL
-#include "machine/trap.h"      /* codes for SIGILL, SIGFPE */
-#else
 #include <machine/trap.h>      /* codes for SIGILL, SIGFPE */
 #include <machine/trap.h>      /* codes for SIGILL, SIGFPE */
-#endif
 #endif /* _POSIX_SOURCE */
 
 #define        SIGHUP  1       /* hangup */
 #endif /* _POSIX_SOURCE */
 
 #define        SIGHUP  1       /* hangup */
 #define SIGUSR1 30     /* user defined signal 1 */
 #define SIGUSR2 31     /* user defined signal 2 */
 
 #define SIGUSR1 30     /* user defined signal 1 */
 #define SIGUSR2 31     /* user defined signal 2 */
 
-#ifndef _POSIX_SOURCE
-typedef        void (*sig_t)();
-#endif
+#include <sys/cdefs.h>
 
 
-#ifndef KERNEL
-void   (*signal())();
+#ifndef _POSIX_SOURCE
+typedef        void (*sig_t) __P((int));
 #endif
 
 typedef unsigned int sigset_t;
 
 #endif
 
 typedef unsigned int sigset_t;
 
-#if __STDC__ || c_plusplus
-int sigemptyset(sigset_t *);
-int sigfillset(sigset_t *);
-int sigaddset(sigset_t *, int);
-int sigdelset(sigset_t *, int);
-int sigismember(const sigset_t *, int);
-#else
-int sigemptyset();
-int sigfillset();
-int sigaddset();
-int sigdelset();
-int sigismember();
-#endif
+__BEGIN_DECLS
+int    sigaddset __P((sigset_t *, int));
+int    sigdelset __P((sigset_t *, int));
+int    sigemptyset __P((sigset_t *));
+int    sigfillset __P((sigset_t *));
+int    sigismember __P((const sigset_t *, int));
+__END_DECLS
 
 #define sigemptyset(set)       ( *(set) = 0 )
 #define sigfillset(set)                ( *(set) = ~(sigset_t)0, 0 )
 
 #define sigemptyset(set)       ( *(set) = 0 )
 #define sigfillset(set)                ( *(set) = ~(sigset_t)0, 0 )
@@ -141,6 +144,15 @@ struct     sigvec {
 #define SV_INTERRUPT   SA_RESTART      /* same bit, opposite sense */
 #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
 
 #define SV_INTERRUPT   SA_RESTART      /* same bit, opposite sense */
 #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
 
+/*
+ * Structure used in sigaltstack call.
+ */
+struct sigaltstack {
+       char    *ss_base;               /* signal stack base */
+       int     ss_len;                 /* signal stack length */
+       int     ss_onstack;             /* current status */
+};
+
 /*
  * Structure used in sigstack call.
  */
 /*
  * Structure used in sigstack call.
  */
@@ -178,44 +190,31 @@ struct    sigcontext {
 #define        SIG_DFL         (void (*)())0
 #define        SIG_IGN         (void (*)())1
 
 #define        SIG_DFL         (void (*)())0
 #define        SIG_IGN         (void (*)())1
 
-#ifdef KERNEL
-#define        SIG_CATCH       (void (*)())2
-#define        SIG_HOLD        (void (*)())3
-
-#define        sigcantmask     (sigmask(SIGKILL)|sigmask(SIGSTOP))
-/*
- * get signal action for process and signal; currently only for current process
- */
-#define SIGACTION(p, sig)      (u.u_signal[(sig)])
-
-/*
- * Determine signal that should be delivered to process p, the current process,
- * 0 if none.  If there is a pending stop signal with default action,
- * the process stops in issig().
- */
-#define        CURSIG(p) \
-       (((p)->p_sig == 0 || \
-           ((p)->p_flag&STRC) == 0 && ((p)->p_sig &~ (p)->p_sigmask) == 0) ? \
-           0 : issig())
-
-/*
- * Clear a pending signal from a process.
- */
-#define        CLRSIG(p, sig)  { (p)->p_sig &= ~sigmask(sig); }
-
-#endif /* KERNEL */
-
-#if __STDC__ || c_plusplus
-int kill(pid_t, int);
-int sigaction(int, const struct sigaction *, struct sigaction *);
-int sigprocmask(int, const sigset_t *, sigset_t *);
-int sigpending(sigset_t *);
-int sigsuspend(const sigset_t *);
-#else
-int kill();
-int sigaction();
-int sigprocmask();
-int sigpending();
-int sigsuspend();
-#endif
-#endif /* NSIG */
+#ifndef KERNEL
+#include <sys/types.h>
+
+__BEGIN_DECLS
+void   (*signal __P((int, void (*) __P((int))))) __P((int));
+int    raise __P((int));
+#ifndef        _ANSI_SOURCE
+int    kill __P((pid_t, int));
+int    sigaction __P((int, const struct sigaction *, struct sigaction *));
+int    sigpending __P((sigset_t *));
+int    sigprocmask __P((int, const sigset_t *, sigset_t *));
+int    sigsuspend __P((const sigset_t *));
+#endif /* !_ANSI_SOURCE */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+int    killpg __P((pid_t, int));
+void   psignal __P((unsigned, const char *));
+int    sigblock __P((int));
+int    siginterrupt __P((int, int));
+int    sigpause __P((int));
+int    sigreturn __P((struct sigcontext *));
+int    sigsetmask __P((int));
+int    sigstack __P((const struct sigstack *, struct sigstack *));
+int    sigvec __P((int, struct sigvec *, struct sigvec *));
+#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+__END_DECLS
+
+#endif /* !KERNEL */
+#endif /* !_SIGNAL_H_ */