summaryrefslogtreecommitdiff
path: root/sys/kern
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/kern
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/kern')
-rw-r--r--sys/kern/kern_sig.c51
-rw-r--r--sys/kern/syscalls.master8
2 files changed, 53 insertions, 6 deletions
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); }