From: Mike Hibler Date: Sat, 23 Jun 1990 00:01:58 +0000 (-0800) Subject: add some missing returns, correct args to ipcaccess, general cleanup X-Git-Tag: BSD-4_3_Reno-Snapshot-Development~1892 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/015c074cc9fde61180d0ebc7a8cd7b1c594261d2?hp=dbfb508012616ee9c28ac6b8c8588cf683569f08 add some missing returns, correct args to ipcaccess, general cleanup SCCS-vsn: sys/kern/sysv_shm.c 7.7 --- diff --git a/usr/src/sys/kern/sysv_shm.c b/usr/src/sys/kern/sysv_shm.c index 1cfa1a9db1..f5d3bd9b90 100644 --- a/usr/src/sys/kern/sysv_shm.c +++ b/usr/src/sys/kern/sysv_shm.c @@ -11,7 +11,7 @@ * * from: Utah $Hdr: uipc_shm.c 1.9 89/08/14$ * - * @(#)sysv_shm.c 7.6 (Berkeley) %G% + * @(#)sysv_shm.c 7.7 (Berkeley) %G% */ /* @@ -150,7 +150,7 @@ shmget(p, uap, retval) /* XXX: probably not the right thing to do */ if (shp->shm_perm.mode & SHM_DEST) return (EBUSY); - if (error = ipcaccess(cred, &shp->shm_perm, uap->shmflg&0777)) + if (error = ipcaccess(&shp->shm_perm, uap->shmflg&0777, cred)) return (error); if (uap->size && uap->size > shp->shm_segsz) return (EINVAL); @@ -158,6 +158,7 @@ shmget(p, uap, retval) return (EEXIST); } *retval = shp->shm_perm.seq * SHMMMNI + rval; + return (0); } /* @@ -183,7 +184,7 @@ shmctl(p, uap, retval) shp = &shmsegs[uap->shmid % SHMMMNI]; switch (uap->cmd) { case IPC_STAT: - if (error = ipcaccess(cred, &shp->shm_perm, IPC_R)) + if (error = ipcaccess(&shp->shm_perm, IPC_R, cred)) return (error); return (copyout((caddr_t)shp, uap->buf, sizeof(*shp))); @@ -245,15 +246,15 @@ shmat(p, uap, retval) register int size; struct mapmem *mp; caddr_t uva; - int error, error1, prot, shmmapin(); + int error, prot, shmmapin(); if (error = shmvalid(uap->shmid)) return (error); shp = &shmsegs[uap->shmid % SHMMMNI]; if (shp->shm_handle == NULL) panic("shmat NULL handle"); - if (error = ipcaccess(u.u_cred, &shp->shm_perm, - (uap->shmflg&SHM_RDONLY) ? IPC_R : IPC_R|IPC_W)) + if (error = ipcaccess(&shp->shm_perm, + (uap->shmflg&SHM_RDONLY) ? IPC_R : IPC_R|IPC_W, u.u_cred)) return (error); uva = uap->shmaddr; if (uva && ((int)uva & (SHMLBA-1))) { @@ -284,8 +285,7 @@ shmat(p, uap, retval) if (error) return (error); if (error = mmmapin(p, mp, shmmapin)) { - if (error1 = mmfree(p, mp)) - return (error1); + (void) mmfree(p, mp); return (error); } /* @@ -295,6 +295,7 @@ shmat(p, uap, retval) shp->shm_atime = time.tv_sec; shp->shm_nattch++; *retval = (int) uva; + return (0); } /* @@ -344,10 +345,10 @@ shmfork(mp, ischild) /* * Detach from shared memory segment on exit (or exec) */ -shmexit(p, mp) - struct proc *p; +shmexit(mp) struct mapmem *mp; { + struct proc *p = u.u_procp; /* XXX */ return (shmufree(p, mp)); }