diff options
-rw-r--r-- | sys/compat/linux/linux_ipc.c | 4 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 10 | ||||
-rw-r--r-- | sys/sys/shm.h | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c index 67bf034dd4c..03be16c7dbd 100644 --- a/sys/compat/linux/linux_ipc.c +++ b/sys/compat/linux/linux_ipc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_ipc.c,v 1.8 2002/03/14 01:26:50 millert Exp $ */ +/* $OpenBSD: linux_ipc.c,v 1.9 2003/10/12 23:44:39 millert Exp $ */ /* $NetBSD: linux_ipc.c,v 1.10 1996/04/05 00:01:44 christos Exp $ */ /* @@ -538,7 +538,7 @@ linux_shmat(p, v, retval) SCARG(&bsa, shmaddr) = SCARG(uap, ptr); SCARG(&bsa, shmflg) = SCARG(uap, a2); - if ((error = sys_shmat(p, &bsa, retval))) + if ((error = sys_shmat1(p, &bsa, retval, 1))) return error; if ((error = copyout(&retval[0], (caddr_t) SCARG(uap, a3), diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index a755deb8549..944c2cddd2c 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.38 2003/08/21 05:20:07 kevlo Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.39 2003/10/12 23:44:39 millert Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -209,6 +209,12 @@ sys_shmdt(struct proc *p, void *v, register_t *retval) int sys_shmat(struct proc *p, void *v, register_t *retval) { + return (sys_shmat1(p, v, retval, 0)); +} + +int +sys_shmat1(struct proc *p, void *v, register_t *retval, int findremoved) +{ struct sys_shmat_args /* { syscallarg(int) shmid; syscallarg(const void *) shmaddr; @@ -235,7 +241,7 @@ sys_shmat(struct proc *p, void *v, register_t *retval) shmmap_s->shmid = -1; p->p_vmspace->vm_shm = (caddr_t)shmmap_h; } - shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid), 0); + shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid), findremoved); if (shmseg == NULL) return (EINVAL); error = ipcperm(cred, &shmseg->shm_perm, diff --git a/sys/sys/shm.h b/sys/sys/shm.h index e9a5cad56c4..a18d4989b92 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: shm.h,v 1.14 2002/12/17 23:11:31 millert Exp $ */ +/* $OpenBSD: shm.h,v 1.15 2003/10/12 23:44:39 millert Exp $ */ /* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */ /* @@ -156,6 +156,7 @@ void shmfork(struct vmspace *, struct vmspace *); void shmexit(struct vmspace *); void shmid_n2o(struct shmid_ds *, struct oshmid_ds *); int sysctl_sysvshm(int *, u_int, void *, size_t *, void *, size_t); +int sys_shmat1(struct proc *, void *, register_t *, int); #else /* !_KERNEL */ |