summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/signal.h14
-rw-r--r--sys/i386/include/signal.h14
-rw-r--r--sys/sys/_sigset.h53
-rw-r--r--sys/sys/signal.h53
4 files changed, 76 insertions, 58 deletions
diff --git a/sys/amd64/include/signal.h b/sys/amd64/include/signal.h
index 093278f..628a236 100644
--- a/sys/amd64/include/signal.h
+++ b/sys/amd64/include/signal.h
@@ -31,11 +31,11 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.1 (Berkeley) 6/11/93
- * $Id: signal.h,v 1.3 1994/08/02 07:39:01 davidg Exp $
+ * $Id: signal.h,v 1.4 1994/08/21 04:55:30 paul Exp $
*/
-#ifndef _I386_MACHINE_SIGNAL_H_
-#define _I386_MACHINE_SIGNAL_H_
+#ifndef _MACHINE_SIGNAL_H_
+#define _MACHINE_SIGNAL_H_
/*
* Machine-dependent signal definitions
@@ -43,9 +43,9 @@
typedef int sig_atomic_t;
-#ifndef _POSIX_SOURCE
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
-#endif
/*
* Information pushed on stack when a signal is delivered.
@@ -78,4 +78,6 @@ struct sigcontext {
# define sc_ps sc_efl
};
-#endif
+#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+
+#endif /* !_MACHINE_SIGNAL_H_ */
diff --git a/sys/i386/include/signal.h b/sys/i386/include/signal.h
index 093278f..628a236 100644
--- a/sys/i386/include/signal.h
+++ b/sys/i386/include/signal.h
@@ -31,11 +31,11 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.1 (Berkeley) 6/11/93
- * $Id: signal.h,v 1.3 1994/08/02 07:39:01 davidg Exp $
+ * $Id: signal.h,v 1.4 1994/08/21 04:55:30 paul Exp $
*/
-#ifndef _I386_MACHINE_SIGNAL_H_
-#define _I386_MACHINE_SIGNAL_H_
+#ifndef _MACHINE_SIGNAL_H_
+#define _MACHINE_SIGNAL_H_
/*
* Machine-dependent signal definitions
@@ -43,9 +43,9 @@
typedef int sig_atomic_t;
-#ifndef _POSIX_SOURCE
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
-#endif
/*
* Information pushed on stack when a signal is delivered.
@@ -78,4 +78,6 @@ struct sigcontext {
# define sc_ps sc_efl
};
-#endif
+#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+
+#endif /* !_MACHINE_SIGNAL_H_ */
diff --git a/sys/sys/_sigset.h b/sys/sys/_sigset.h
index c26054b..515a00d 100644
--- a/sys/sys/_sigset.h
+++ b/sys/sys/_sigset.h
@@ -36,16 +36,17 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.2 (Berkeley) 1/21/94
- * $Id: signal.h,v 1.2 1994/08/02 07:53:32 davidg Exp $
+ * $Id: signal.h,v 1.3 1995/01/29 01:19:25 ats Exp $
*/
#ifndef _SYS_SIGNAL_H_
#define _SYS_SIGNAL_H_
-#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
+#include <sys/cdefs.h>
+#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
-#ifndef _ANSI_SOURCE
-#include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
#endif
#define SIGHUP 1 /* hangup */
@@ -93,19 +94,27 @@
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
-#if defined(_ANSI_SOURCE) || defined(__cplusplus)
-/*
- * Language spec sez we must list exactly one parameter, even though we
+/*-
+ * Type of a signal handling function.
+ *
+ * Language spec sez signal handlers take exactly one arg, even though we
* actually supply three. Ugh!
+ *
+ * We don't try to hide the difference by leaving out the args because
+ * that would cause warnings about conformant programs. Nonconformant
+ * programs can avoid the warnings by casting to (__sighandler_t *) or
+ * sig_t before calling signal() or assigning to sa_handler or sv_handler.
+ *
+ * The kernel should reverse the cast before calling the function. It
+ * has no way to do this, but on most machines 1-arg and 3-arg functions
+ * have the same calling protocol so there is no problem in practice.
+ * A bit in sa_flags could be used to specify the number of args.
*/
-#define SIG_DFL (void (*)(int))0
-#define SIG_IGN (void (*)(int))1
-#define SIG_ERR (void (*)(int))-1
-#else
-#define SIG_DFL (void (*)())0
-#define SIG_IGN (void (*)())1
-#define SIG_ERR (void (*)())-1
-#endif
+typedef void __sighandler_t __P((int));
+
+#define SIG_DFL ((__sighandler_t *)0)
+#define SIG_IGN ((__sighandler_t *)1)
+#define SIG_ERR ((__sighandler_t *)-1)
#ifndef _ANSI_SOURCE
typedef unsigned int sigset_t;
@@ -114,13 +123,13 @@ typedef unsigned int sigset_t;
* Signal vector "template" used in sigaction call.
*/
struct sigaction {
- void (*sa_handler)(); /* signal handler */
+ __sighandler_t *sa_handler; /* signal handler */
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
};
#ifndef _POSIX_SOURCE
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
-#define SA_RESTART 0x0002 /* restart system on signal return */
+#define SA_RESTART 0x0002 /* restart system call on signal return */
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
#ifdef COMPAT_SUNOS
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
@@ -136,10 +145,7 @@ struct sigaction {
#define SIG_SETMASK 3 /* set specified signal set */
#ifndef _POSIX_SOURCE
-#ifndef KERNEL
-#include <sys/cdefs.h>
-#endif
-typedef void (*sig_t) __P((int)); /* type of signal function */
+typedef __sighandler_t *sig_t; /* type of pointer to a signal function */
/*
* Structure used in sigaltstack call.
@@ -157,7 +163,7 @@ struct sigaltstack {
* Signal vector "template" used in sigvec call.
*/
struct sigvec {
- void (*sv_handler)(); /* signal handler */
+ __sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
@@ -190,6 +196,7 @@ struct sigstack {
* defined by <sys/signal.h>.
*/
__BEGIN_DECLS
-void (*signal __P((int, void (*) __P((int))))) __P((int));
+__sighandler_t *signal __P((int, __sighandler_t *));
__END_DECLS
+
#endif /* !_SYS_SIGNAL_H_ */
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index c26054b..515a00d 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -36,16 +36,17 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.2 (Berkeley) 1/21/94
- * $Id: signal.h,v 1.2 1994/08/02 07:53:32 davidg Exp $
+ * $Id: signal.h,v 1.3 1995/01/29 01:19:25 ats Exp $
*/
#ifndef _SYS_SIGNAL_H_
#define _SYS_SIGNAL_H_
-#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
+#include <sys/cdefs.h>
+#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
-#ifndef _ANSI_SOURCE
-#include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
#endif
#define SIGHUP 1 /* hangup */
@@ -93,19 +94,27 @@
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
-#if defined(_ANSI_SOURCE) || defined(__cplusplus)
-/*
- * Language spec sez we must list exactly one parameter, even though we
+/*-
+ * Type of a signal handling function.
+ *
+ * Language spec sez signal handlers take exactly one arg, even though we
* actually supply three. Ugh!
+ *
+ * We don't try to hide the difference by leaving out the args because
+ * that would cause warnings about conformant programs. Nonconformant
+ * programs can avoid the warnings by casting to (__sighandler_t *) or
+ * sig_t before calling signal() or assigning to sa_handler or sv_handler.
+ *
+ * The kernel should reverse the cast before calling the function. It
+ * has no way to do this, but on most machines 1-arg and 3-arg functions
+ * have the same calling protocol so there is no problem in practice.
+ * A bit in sa_flags could be used to specify the number of args.
*/
-#define SIG_DFL (void (*)(int))0
-#define SIG_IGN (void (*)(int))1
-#define SIG_ERR (void (*)(int))-1
-#else
-#define SIG_DFL (void (*)())0
-#define SIG_IGN (void (*)())1
-#define SIG_ERR (void (*)())-1
-#endif
+typedef void __sighandler_t __P((int));
+
+#define SIG_DFL ((__sighandler_t *)0)
+#define SIG_IGN ((__sighandler_t *)1)
+#define SIG_ERR ((__sighandler_t *)-1)
#ifndef _ANSI_SOURCE
typedef unsigned int sigset_t;
@@ -114,13 +123,13 @@ typedef unsigned int sigset_t;
* Signal vector "template" used in sigaction call.
*/
struct sigaction {
- void (*sa_handler)(); /* signal handler */
+ __sighandler_t *sa_handler; /* signal handler */
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
};
#ifndef _POSIX_SOURCE
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
-#define SA_RESTART 0x0002 /* restart system on signal return */
+#define SA_RESTART 0x0002 /* restart system call on signal return */
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
#ifdef COMPAT_SUNOS
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
@@ -136,10 +145,7 @@ struct sigaction {
#define SIG_SETMASK 3 /* set specified signal set */
#ifndef _POSIX_SOURCE
-#ifndef KERNEL
-#include <sys/cdefs.h>
-#endif
-typedef void (*sig_t) __P((int)); /* type of signal function */
+typedef __sighandler_t *sig_t; /* type of pointer to a signal function */
/*
* Structure used in sigaltstack call.
@@ -157,7 +163,7 @@ struct sigaltstack {
* Signal vector "template" used in sigvec call.
*/
struct sigvec {
- void (*sv_handler)(); /* signal handler */
+ __sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
@@ -190,6 +196,7 @@ struct sigstack {
* defined by <sys/signal.h>.
*/
__BEGIN_DECLS
-void (*signal __P((int, void (*) __P((int))))) __P((int));
+__sighandler_t *signal __P((int, __sighandler_t *));
__END_DECLS
+
#endif /* !_SYS_SIGNAL_H_ */
OpenPOWER on IntegriCloud