aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-10-25 19:10:58 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-10-25 19:10:58 +0000
commit23eeeff7bee66bd81fa2d7ec9d648339bd0d041f (patch)
tree96a1089f558875f808b1fd36f885179cd78f55de /sys/sys
parentfb3a308a4ac3ca2c6fcd097a2990d7ea52ab230f (diff)
downloadsrc-23eeeff7bee66bd81fa2d7ec9d648339bd0d041f.tar.gz
src-23eeeff7bee66bd81fa2d7ec9d648339bd0d041f.zip
Split 4.x and 5.x signal handling so that we can keep 4.x signal
handling clean and functional as 5.x evolves. This allows some of the nasty bandaids in the 5.x codepaths to be unwound. Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an anti-foot-shooting measure in place, 5.x folks need this for a while) and finish encapsulating the older stuff under COMPAT_43. Since the ancient stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *' to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn is supposed to take), add a compile time check to prevent foot shooting there too. Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc. Tested on: i386, alpha, ia64. Compiled on sparc64 (a few days ago). Approved by: re
Notes
Notes: svn path=/head/; revision=105950
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/_sigset.h4
-rw-r--r--sys/sys/signal.h8
-rw-r--r--sys/sys/signalvar.h7
-rw-r--r--sys/sys/syscall.h8
-rw-r--r--sys/sys/syscall.mk7
-rw-r--r--sys/sys/syscallsubr.h6
-rw-r--r--sys/sys/sysproto.h38
-rw-r--r--sys/sys/ucontext.h14
8 files changed, 67 insertions, 25 deletions
diff --git a/sys/sys/_sigset.h b/sys/sys/_sigset.h
index dfb954e5b762..77f2a9acfc97 100644
--- a/sys/sys/_sigset.h
+++ b/sys/sys/_sigset.h
@@ -56,4 +56,8 @@ typedef struct __sigset {
__uint32_t __bits[_SIG_WORDS];
} __sigset_t;
+#if defined(_KERNEL) && defined(COMPAT_43)
+typedef unsigned int osigset_t;
+#endif
+
#endif /* !_SYS__SIGSET_H_ */
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index edbb46097b28..deae42d69976 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -302,6 +302,14 @@ struct sigvec {
#define sv_onstack sv_flags /* isn't compatibility wonderful! */
#endif
+/* Keep this in one place only */
+#if defined(_KERNEL) && defined(COMPAT_43) && \
+ !defined(__i386__) && !defined(__alpha__)
+struct osigcontext {
+ int _not_used;
+};
+#endif
+
#if __XSI_VISIBLE
/*
* Structure used in sigstack call.
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index d2fbacf95d28..d7d7227e0ab7 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -56,11 +56,12 @@ struct sigacts {
sigset_t ps_sigreset; /* signals that reset when caught */
sigset_t ps_signodefer; /* signals not masked while handled */
sigset_t ps_siginfo; /* signals that want SA_SIGINFO args */
- sigset_t ps_osigset; /* signals that use osigset_t */
+ sigset_t ps_freebsd4; /* signals that use freebsd4 ucontext */
+ sigset_t ps_osigset; /* signals that use <= 3.x osigset_t */
sigset_t ps_usertramp; /* SunOS compat; libc sigtramp XXX */
};
-#ifdef _KERNEL
+#if defined(_KERNEL) && defined(COMPAT_43)
/*
* Compatibility.
*/
@@ -81,7 +82,7 @@ struct osigaction {
};
typedef void __osiginfohandler_t(int, osiginfo_t *, void *);
-#endif /* _KERNEL */
+#endif /* _KERNEL && COMPAT_43 */
/* additional signal action values, used only temporarily/internally */
#define SIG_CATCH ((__sighandler_t *)2)
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index b1da44913dc1..a72b3179b3ed 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -107,7 +107,7 @@
#define SYS_getpriority 100
/* 101 is old send */
/* 102 is old recv */
-#define SYS_osigreturn 103
+ /* 103 is old sigreturn */
#define SYS_bind 104
#define SYS_setsockopt 105
#define SYS_listen 106
@@ -265,9 +265,9 @@
#define SYS_jail 338
#define SYS_sigprocmask 340
#define SYS_sigsuspend 341
-#define SYS_sigaction 342
+ /* 342 is old sigaction */
#define SYS_sigpending 343
-#define SYS_sigreturn 344
+ /* 344 is old sigreturn */
#define SYS___acl_get_file 347
#define SYS___acl_set_file 348
#define SYS___acl_get_fd 349
@@ -323,4 +323,6 @@
#define SYS_extattr_set_link 412
#define SYS_extattr_get_link 413
#define SYS_extattr_delete_link 414
+#define SYS_sigaction 416
+#define SYS_sigreturn 417
#define SYS_MAXSYSCALL 421
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index 4e6f0ea5d536..51fc2f943e17 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -82,7 +82,6 @@ MIASM = \
socket.o \
connect.o \
getpriority.o \
- osigreturn.o \
bind.o \
setsockopt.o \
listen.o \
@@ -214,9 +213,7 @@ MIASM = \
jail.o \
sigprocmask.o \
sigsuspend.o \
- sigaction.o \
sigpending.o \
- sigreturn.o \
__acl_get_file.o \
__acl_set_file.o \
__acl_get_fd.o \
@@ -271,4 +268,6 @@ MIASM = \
__mac_set_link.o \
extattr_set_link.o \
extattr_get_link.o \
- extattr_delete_link.o
+ extattr_delete_link.o \
+ sigaction.o \
+ sigreturn.o
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index aa434c2574ee..25c2f53d4185 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -67,7 +67,7 @@ int kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
fd_set *fd_ex, struct timeval *tvp);
int kern_sigaction(struct thread *td, int sig, struct sigaction *act,
- struct sigaction *oact, int old);
+ struct sigaction *oact, int flags);
int kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);
int kern_sigsuspend(struct thread *td, sigset_t mask);
int kern_symlink(struct thread *td, char *path, char *link,
@@ -78,4 +78,8 @@ int kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
int kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
struct timeval *tptr, enum uio_seg tptrseg);
+/* flags for kern_sigaction */
+#define KSA_OSIGSET 0x0001 /* uses osigact_t */
+#define KSA_FREEBSD4 0x0002 /* uses ucontext4 */
+
#endif /* !_SYS_SYSCALLSUBR_H_ */
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index 6f1904a8a2a3..683c722d08c4 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -361,9 +361,6 @@ struct getpriority_args {
char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
char who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)];
};
-struct osigreturn_args {
- char sigcntxp_l_[PADL_(struct osigcontext *)]; struct osigcontext * sigcntxp; char sigcntxp_r_[PADR_(struct osigcontext *)];
-};
struct bind_args {
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];
@@ -923,17 +920,9 @@ struct sigprocmask_args {
struct sigsuspend_args {
char sigmask_l_[PADL_(const sigset_t *)]; const sigset_t * sigmask; char sigmask_r_[PADR_(const sigset_t *)];
};
-struct sigaction_args {
- char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
- char act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];
- char oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];
-};
struct sigpending_args {
char set_l_[PADL_(sigset_t *)]; sigset_t * set; char set_r_[PADR_(sigset_t *)];
};
-struct sigreturn_args {
- char sigcntxp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct __ucontext *)];
-};
struct __acl_get_file_args {
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];
@@ -1188,6 +1177,14 @@ struct extattr_delete_link_args {
char attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];
char attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];
};
+struct sigaction_args {
+ char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
+ char act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];
+ char oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];
+};
+struct sigreturn_args {
+ char sigcntxp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct __ucontext *)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_exit(struct thread *, struct sys_exit_args *);
int fork(struct thread *, struct fork_args *);
@@ -1267,7 +1264,6 @@ int setpriority(struct thread *, struct setpriority_args *);
int socket(struct thread *, struct socket_args *);
int connect(struct thread *, struct connect_args *);
int getpriority(struct thread *, struct getpriority_args *);
-int osigreturn(struct thread *, struct osigreturn_args *);
int bind(struct thread *, struct bind_args *);
int setsockopt(struct thread *, struct setsockopt_args *);
int listen(struct thread *, struct listen_args *);
@@ -1397,9 +1393,7 @@ int kldsym(struct thread *, struct kldsym_args *);
int jail(struct thread *, struct jail_args *);
int sigprocmask(struct thread *, struct sigprocmask_args *);
int sigsuspend(struct thread *, struct sigsuspend_args *);
-int sigaction(struct thread *, struct sigaction_args *);
int sigpending(struct thread *, struct sigpending_args *);
-int sigreturn(struct thread *, struct sigreturn_args *);
int __acl_get_file(struct thread *, struct __acl_get_file_args *);
int __acl_set_file(struct thread *, struct __acl_set_file_args *);
int __acl_get_fd(struct thread *, struct __acl_get_fd_args *);
@@ -1456,6 +1450,8 @@ int __mac_set_link(struct thread *, struct __mac_set_link_args *);
int extattr_set_link(struct thread *, struct extattr_set_link_args *);
int extattr_get_link(struct thread *, struct extattr_get_link_args *);
int extattr_delete_link(struct thread *, struct extattr_delete_link_args *);
+int sigaction(struct thread *, struct sigaction_args *);
+int sigreturn(struct thread *, struct sigreturn_args *);
#ifdef COMPAT_43
@@ -1523,6 +1519,9 @@ struct orecv_args {
char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
};
+struct osigreturn_args {
+ char sigcntxp_l_[PADL_(struct osigcontext *)]; struct osigcontext * sigcntxp; char sigcntxp_r_[PADR_(struct osigcontext *)];
+};
struct osigvec_args {
char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];
char nsv_l_[PADL_(struct sigvec *)]; struct sigvec * nsv; char nsv_r_[PADR_(struct sigvec *)];
@@ -1602,6 +1601,7 @@ int osethostname(struct thread *, struct sethostname_args *);
int oaccept(struct thread *, struct accept_args *);
int osend(struct thread *, struct osend_args *);
int orecv(struct thread *, struct orecv_args *);
+int osigreturn(struct thread *, struct osigreturn_args *);
int osigvec(struct thread *, struct osigvec_args *);
int osigblock(struct thread *, struct osigblock_args *);
int osigsetmask(struct thread *, struct osigsetmask_args *);
@@ -1636,7 +1636,17 @@ struct freebsd4_sendfile_args {
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
};
+struct freebsd4_sigaction_args {
+ char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
+ char act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];
+ char oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];
+};
+struct freebsd4_sigreturn_args {
+ char sigcntxp_l_[PADL_(const struct ucontext4 *)]; const struct ucontext4 * sigcntxp; char sigcntxp_r_[PADR_(const struct ucontext4 *)];
+};
int freebsd4_sendfile(struct thread *, struct freebsd4_sendfile_args *);
+int freebsd4_sigaction(struct thread *, struct freebsd4_sigaction_args *);
+int freebsd4_sigreturn(struct thread *, struct freebsd4_sigreturn_args *);
#endif /* COMPAT_FREEBSD4 */
diff --git a/sys/sys/ucontext.h b/sys/sys/ucontext.h
index 194b63a73595..dcce16e1a6fb 100644
--- a/sys/sys/ucontext.h
+++ b/sys/sys/ucontext.h
@@ -53,6 +53,20 @@ typedef struct __ucontext {
int __spare__[4];
} ucontext_t;
+#if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
+#if defined(__i386__) || defined(__alpha__)
+struct ucontext4 {
+ sigset_t uc_sigmask;
+ struct mcontext4 uc_mcontext;
+ struct ucontext4 *uc_link;
+ stack_t uc_stack;
+ int __spare__[8];
+};
+#else /* __i386__ || __alpha__ */
+#define ucontext4 ucontext
+#endif /* __i386__ || __alpha__ */
+#endif /* _KERNEL */
+
#ifndef _KERNEL
__BEGIN_DECLS