diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 07:11:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-13 07:11:15 +0000 |
commit | d2279fb6e2482b1a5f7780b7a6bf0f393e6040f3 (patch) | |
tree | 4c0b55a0f5653eca9718344fc4afdd2d34b307c0 /sys | |
parent | 7eaa1da8a65b7c1bc8323712e85e7711eb61a588 (diff) |
add getsid(2), XPG4
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_prot.c | 23 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 3 |
2 files changed, 23 insertions, 3 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 49edc5f2f86..d14fc931dac 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.10 1997/09/02 08:48:32 downsj Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.11 1997/11/13 07:11:11 deraadt Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -119,6 +119,25 @@ found: return 0; } +int +sys_getsid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct sys_getsid_args /* { + syscallarg(pid_t) pid; + } */ *uap = v; + + if (SCARG(uap, pid) == 0) + goto found; + if ((p == pfind(SCARG(uap, pid))) == 0) + return (ESRCH); +found: + *retval = p->p_pgrp->pg_session->s_leader->p_pid; + return 0; +} + /* ARGSUSED */ int sys_getuid(p, v, retval) @@ -289,7 +308,7 @@ sys_setpgid(curp, v, retval) SCARG(uap, pgid) = targp->p_pid; else if (SCARG(uap, pgid) != targp->p_pid) if ((pgrp = pgfind(SCARG(uap, pgid))) == 0 || - pgrp->pg_session != curp->p_session) + pgrp->pg_session != curp->p_session) return (EPERM); return (enterpgrp(targp, SCARG(uap, pgid), 0)); } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index d0ea958d481..8794f0f6483 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.16 1997/08/29 20:44:24 kstailey Exp $ + $OpenBSD: syscalls.master,v 1.17 1997/11/13 07:11:12 deraadt Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -463,3 +463,4 @@ unsigned long nfds, int timeout); } 253 STD { int sys_issetugid(void); } 254 STD { int sys_lchown(char *path, int uid, int gid); } +255 STD { int sys_getsid(pid_t pid); } |