summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-01-14 05:23:26 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-01-14 05:23:26 +0000
commitba3a1fe6f6a939bb6061bf13a07b569599ae745a (patch)
treec6853cb91f7dc8a4b8771cd51017f0471acb6d5d /sys
parentb9909d3b24a7a9c97d247379a16ff7683b6d571d (diff)
change sigaltstack.ss_size type to size_t. handle syscall fallout.
add stack_t and ucontext_t typedefs. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/bsdos/syscalls.master6
-rw-r--r--sys/compat/netbsd/netbsd_signal.c75
-rw-r--r--sys/compat/netbsd/netbsd_signal.h8
-rw-r--r--sys/compat/netbsd/syscalls.master12
-rw-r--r--sys/kern/kern_sig.c51
-rw-r--r--sys/kern/syscalls.master8
-rw-r--r--sys/sys/signal.h18
7 files changed, 78 insertions, 100 deletions
diff --git a/sys/compat/bsdos/syscalls.master b/sys/compat/bsdos/syscalls.master
index 96999fc6369..85f5fb1e4f0 100644
--- a/sys/compat/bsdos/syscalls.master
+++ b/sys/compat/bsdos/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.11 2003/05/10 17:53:53 miod Exp $
+ $OpenBSD: syscalls.master,v 1.12 2004/01/14 05:23:25 tedu Exp $
; OpenBSD COMPAT_BSDOS system call name/number "master" file.
; (See syscalls.conf to see what it is processed into.)
@@ -119,8 +119,8 @@
50 NOARGS { int sys_setlogin(char *namebuf); }
51 NOARGS { int sys_acct(char *path); }
52 NOARGS { int sys_sigpending(void); }
-53 NOARGS { int sys_sigaltstack(struct sigaltstack *nss, \
- struct sigaltstack *oss); }
+53 NOARGS { int sys_osigaltstack(struct osigaltstack *nss, \
+ struct osigaltstack *oss); }
54 STD { int bsdos_sys_ioctl(int fd, u_long com, \
caddr_t data); }
55 NOARGS { int sys_reboot(int opt); }
diff --git a/sys/compat/netbsd/netbsd_signal.c b/sys/compat/netbsd/netbsd_signal.c
index abc7ac77381..44c1fcc443c 100644
--- a/sys/compat/netbsd/netbsd_signal.c
+++ b/sys/compat/netbsd/netbsd_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netbsd_signal.c,v 1.6 2003/06/02 23:28:00 millert Exp $ */
+/* $OpenBSD: netbsd_signal.c,v 1.7 2004/01/14 05:23:25 tedu Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
@@ -55,12 +55,6 @@ static void netbsd_to_openbsd_sigaction(struct netbsd_sigaction *,
static void openbsd_to_netbsd_sigaction(struct sigaction *,
struct netbsd_sigaction *);
-static void netbsd_to_openbsd_sigaltstack(struct netbsd_sigaltstack *,
- struct sigaltstack *);
-
-static void openbsd_to_netbsd_sigaltstack(struct sigaltstack *,
- struct netbsd_sigaltstack *);
-
static void
openbsd_to_netbsd_sigaction(obsa, nbsa)
struct sigaction *obsa;
@@ -84,28 +78,6 @@ netbsd_to_openbsd_sigaction(nbsa, obsa)
obsa->sa_flags = nbsa->netbsd_sa_flags;
}
-static void
-netbsd_to_openbsd_sigaltstack(nbss, obss)
- struct netbsd_sigaltstack *nbss;
- struct sigaltstack *obss;
-{
- obss->ss_sp = nbss->netbsd_ss_sp;
- obss->ss_size = nbss->netbsd_ss_size; /* XXX may cause truncation */
- obss->ss_flags = nbss->netbsd_ss_flags;
-}
-
-static void
-openbsd_to_netbsd_sigaltstack(obss, nbss)
- struct sigaltstack *obss;
- struct netbsd_sigaltstack *nbss;
-{
- bzero(nbss, sizeof(nbss));
- nbss->netbsd_ss_sp = obss->ss_sp;
- nbss->netbsd_ss_size = (size_t)obss->ss_size;
- nbss->netbsd_ss_flags = obss->ss_flags;
-}
-
-
/* ARGSUSED */
int
netbsd_sys___sigaction14(p, v, retval)
@@ -171,51 +143,6 @@ netbsd_sys___sigaction14(p, v, retval)
/* ARGSUSED */
int
-netbsd_sys___sigaltstack14(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct netbsd_sys___sigaltstack14_args /* {
- syscallarg(struct netbsd_sigaltstack *) nss;
- syscallarg(struct netbsd_sigaltstack *) oss;
- } */ *uap = v;
- struct sigacts *psp;
- struct sigaltstack ss;
- struct netbsd_sigaltstack nbss;
- int error;
-
- psp = p->p_sigacts;
- if ((psp->ps_flags & SAS_ALTSTACK) == 0)
- psp->ps_sigstk.ss_flags |= SS_DISABLE;
- if (SCARG(uap, oss)) {
- openbsd_to_netbsd_sigaltstack(&psp->ps_sigstk, &nbss);
- if ((error = copyout((caddr_t)&nbss, (caddr_t)SCARG(uap, oss),
- sizeof (struct netbsd_sigaltstack))))
- return (error);
- }
- if (SCARG(uap, nss) == 0)
- return (0);
- error = copyin((caddr_t)SCARG(uap, nss), (caddr_t)&nbss, sizeof(nbss));
- if (error)
- return (error);
- netbsd_to_openbsd_sigaltstack(&nbss, &ss);
- if (ss.ss_flags & SS_DISABLE) {
- if (psp->ps_sigstk.ss_flags & SS_ONSTACK)
- return (EINVAL);
- psp->ps_flags &= ~SAS_ALTSTACK;
- psp->ps_sigstk.ss_flags = ss.ss_flags;
- return (0);
- }
- if (ss.ss_size < MINSIGSTKSZ)
- return (ENOMEM);
- psp->ps_flags |= SAS_ALTSTACK;
- psp->ps_sigstk= ss;
- return (0);
-}
-
-/* ARGSUSED */
-int
netbsd_sys___sigpending14(p, v, retval)
struct proc *p;
void *v;
diff --git a/sys/compat/netbsd/netbsd_signal.h b/sys/compat/netbsd/netbsd_signal.h
index 51530135fda..8158ef009ee 100644
--- a/sys/compat/netbsd/netbsd_signal.h
+++ b/sys/compat/netbsd/netbsd_signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netbsd_signal.h,v 1.4 2003/06/02 23:28:00 millert Exp $ */
+/* $OpenBSD: netbsd_signal.h,v 1.5 2004/01/14 05:23:25 tedu Exp $ */
/* $NetBSD: signal.h,v 1.42 1998/12/21 10:35:00 drochner Exp $ */
/*
@@ -54,10 +54,4 @@ struct netbsd_sigaction {
int netbsd_sa_flags; /* see signal options below */
};
-struct netbsd_sigaltstack {
- void *netbsd_ss_sp; /* signal stack base */
- size_t netbsd_ss_size; /* signal stack length */
- int netbsd_ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
-};
-
#endif /* !_NETBSD_SYS_SIGNAL_H_ */
diff --git a/sys/compat/netbsd/syscalls.master b/sys/compat/netbsd/syscalls.master
index 506be6f8809..c1ae49e6b5a 100644
--- a/sys/compat/netbsd/syscalls.master
+++ b/sys/compat/netbsd/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.20 2003/05/11 19:45:18 deraadt Exp $
+; $OpenBSD: syscalls.master,v 1.21 2004/01/14 05:23:25 tedu Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -148,8 +148,8 @@
50 NOARGS { int sys_setlogin(const char *namebuf); }
51 NOARGS { int sys_acct(const char *path); }
52 NOARGS { int sys_sigpending(void); }
-53 NOARGS { int sys_sigaltstack(const struct sigaltstack *nss, \
- struct sigaltstack *oss); }
+53 NOARGS { int sys_osigaltstack(const struct osigaltstack *nss, \
+ struct osigaltstack *oss); }
54 NOARGS { int sys_ioctl(int fd, \
u_long com, ... void *data); }
55 NOARGS { int sys_reboot(int opt); }
@@ -564,9 +564,9 @@
struct netbsd_stat *ub); }
280 STD { int netbsd_sys___lstat13(char *path, \
struct netbsd_stat *ub); }
-281 STD { int netbsd_sys___sigaltstack14( \
- const struct netbsd_sigaltstack *nss, \
- struct netbsd_sigaltstack *oss); }
+281 NOARGS { int sys_sigaltstack( \
+ const struct sigaltstack *nss, \
+ struct sigaltstack *oss); }
282 STD { int netbsd_sys___vfork14(void); }
283 UNIMPL
;283 STD { int netbsd_sys___posix_chown(const char *path, \
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index c6c59495628..236cc828960 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.68 2003/09/01 18:06:03 henning Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.69 2004/01/14 05:23:25 tedu Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -507,6 +507,51 @@ sys_sigsuspend(p, v, retval)
/* ARGSUSED */
int
+sys_osigaltstack(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct sys_osigaltstack_args /* {
+ syscallarg(const struct osigaltstack *) nss;
+ syscallarg(struct osigaltstack *) oss;
+ } */ *uap = v;
+ struct sigacts *psp;
+ struct osigaltstack ss;
+ int error;
+
+ psp = p->p_sigacts;
+ if ((psp->ps_flags & SAS_ALTSTACK) == 0)
+ psp->ps_sigstk.ss_flags |= SS_DISABLE;
+ if (SCARG(uap, oss)) {
+ ss.ss_sp = psp->ps_sigstk.ss_sp;
+ ss.ss_size = psp->ps_sigstk.ss_size;
+ ss.ss_flags = psp->ps_sigstk.ss_flags;
+ if ((error = copyout(&ss, SCARG(uap, oss), sizeof(ss))))
+ return (error);
+ }
+ if (SCARG(uap, nss) == NULL)
+ return (0);
+ error = copyin(SCARG(uap, nss), &ss, sizeof(ss));
+ if (error)
+ return (error);
+ if (ss.ss_flags & SS_DISABLE) {
+ if (psp->ps_sigstk.ss_flags & SS_ONSTACK)
+ return (EINVAL);
+ psp->ps_flags &= ~SAS_ALTSTACK;
+ psp->ps_sigstk.ss_flags = ss.ss_flags;
+ return (0);
+ }
+ if (ss.ss_size < MINSIGSTKSZ)
+ return (ENOMEM);
+ psp->ps_flags |= SAS_ALTSTACK;
+ psp->ps_sigstk.ss_sp = ss.ss_sp;
+ psp->ps_sigstk.ss_size = ss.ss_size;
+ psp->ps_sigstk.ss_flags = ss.ss_flags;
+ return (0);
+}
+
+int
sys_sigaltstack(p, v, retval)
struct proc *p;
void *v;
@@ -524,11 +569,11 @@ sys_sigaltstack(p, v, retval)
if ((psp->ps_flags & SAS_ALTSTACK) == 0)
psp->ps_sigstk.ss_flags |= SS_DISABLE;
if (SCARG(uap, oss) && (error = copyout(&psp->ps_sigstk,
- SCARG(uap, oss), sizeof (struct sigaltstack))))
+ SCARG(uap, oss), sizeof(struct sigaltstack))))
return (error);
if (SCARG(uap, nss) == NULL)
return (0);
- error = copyin(SCARG(uap, nss), &ss, sizeof (ss));
+ error = copyin(SCARG(uap, nss), &ss, sizeof(ss));
if (error)
return (error);
if (ss.ss_flags & SS_DISABLE) {
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 6b5d16cc497..2226ab4d15b 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.66 2004/01/12 18:06:51 tedu Exp $
+; $OpenBSD: syscalls.master,v 1.67 2004/01/14 05:23:25 tedu Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -132,8 +132,8 @@
50 STD { int sys_setlogin(const char *namebuf); }
51 STD { int sys_acct(const char *path); }
52 STD { int sys_sigpending(void); }
-53 STD { int sys_sigaltstack(const struct sigaltstack *nss, \
- struct sigaltstack *oss); }
+53 STD { int sys_osigaltstack(const struct osigaltstack *nss, \
+ struct osigaltstack *oss); }
54 STD { int sys_ioctl(int fd, \
u_long com, ... void *data); }
55 STD { int sys_reboot(int opt); }
@@ -576,3 +576,5 @@
286 STD { void *sys_mquery(void *addr, size_t len, int prot, \
int flags, int fd, long pad, off_t pos); }
287 STD { int sys_closefrom(int fd); }
+288 STD { int sys_sigaltstack(const struct sigaltstack *nss, \
+ struct sigaltstack *oss); }
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index 2c2642690d2..e262f751d67 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.15 2003/06/02 23:28:21 millert Exp $ */
+/* $OpenBSD: signal.h,v 1.16 2004/01/14 05:23:25 tedu Exp $ */
/* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */
/*
@@ -149,16 +149,24 @@ typedef void (*sig_t)(int); /* type of signal function */
/*
* Structure used in sigaltstack call.
*/
-struct sigaltstack {
+typedef struct sigaltstack {
void *ss_sp; /* signal stack base */
- int ss_size; /* signal stack length */
+ size_t ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
-};
+} stack_t;
#define SS_ONSTACK 0x0001 /* take signals on alternate stack */
#define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define MINSIGSTKSZ 8192 /* minimum allowable stack */
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
+#ifdef _KERNEL
+struct osigaltstack {
+ void *ss_sp; /* signal stack base */
+ int ss_size; /* signal stack length */
+ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
+};
+#endif
+
/*
* 4.3 compatibility:
* Signal vector "template" used in sigvec call.
@@ -181,6 +189,8 @@ struct sigstack {
int ss_onstack; /* current status */
};
+typedef struct sigcontext ucontext_t;
+
/*
* Macro for converting signal number to a mask suitable for
* sigblock().