sysvshm: fix up some whitespace issues and spurious initialisation

This commit is contained in:
Mateusz Guzik 2015-07-02 19:14:30 +00:00
parent 77a26248a3
commit e2f5418e73
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285057

View File

@ -216,7 +216,7 @@ shm_find_segment(int arg, bool is_shmid)
shmseg = &shmsegs[segnum];
if ((shmseg->u.shm_perm.mode & SHMSEG_ALLOCATED) == 0 ||
(!shm_allow_removed &&
(shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) ||
(shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) ||
(is_shmid && shmseg->u.shm_perm.seq != IPCID_TO_SEQ(arg)))
return (NULL);
return (shmseg);
@ -278,8 +278,9 @@ kern_shmdt_locked(struct thread *td, const void *shmaddr)
struct shmmap_state *shmmap_s;
#ifdef MAC
struct shmid_kernel *shmsegptr;
int error;
#endif
int error, i;
int i;
SYSVSHM_ASSERT_LOCKED();
if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
@ -301,8 +302,7 @@ kern_shmdt_locked(struct thread *td, const void *shmaddr)
if (error != 0)
return (error);
#endif
error = shm_delete_mapping(p->p_vmspace, shmmap_s);
return (error);
return (shm_delete_mapping(p->p_vmspace, shmmap_s));
}
#ifndef _SYS_SYSPROTO_H_
@ -441,7 +441,6 @@ kern_shmctl_locked(struct thread *td, int shmid, int cmd, void *buf,
if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
return (ENOSYS);
error = 0;
switch (cmd) {
/*
* It is possible that kern_shmctl is being called from the Linux ABI
@ -550,10 +549,10 @@ struct shmctl_args {
int
sys_shmctl(struct thread *td, struct shmctl_args *uap)
{
int error = 0;
int error;
struct shmid_ds buf;
size_t bufsz;
/*
* The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support
* Linux binaries. If we see the call come through the FreeBSD ABI,
@ -568,11 +567,11 @@ sys_shmctl(struct thread *td, struct shmctl_args *uap)
if ((error = copyin(uap->buf, &buf, sizeof(struct shmid_ds))))
goto done;
}
error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz);
if (error)
goto done;
/* Cases in which we need to copyout */
switch (uap->cmd) {
case IPC_STAT:
@ -894,7 +893,7 @@ shminit(void)
static int
shmunload(void)
{
int i;
int i;
if (shm_nused > 0)
return (EBUSY);
@ -995,8 +994,7 @@ oshmctl(struct thread *td, struct oshmctl_args *uap)
outbuf.shm_ctime = shmseg->u.shm_ctime;
outbuf.shm_handle = shmseg->object;
SYSVSHM_UNLOCK();
error = copyout(&outbuf, uap->ubuf, sizeof(outbuf));
return (error);
return (copyout(&outbuf, uap->ubuf, sizeof(outbuf)));
#else
return (EINVAL);
#endif
@ -1021,14 +1019,12 @@ struct shmsys_args {
int
sys_shmsys(struct thread *td, struct shmsys_args *uap)
{
int error;
if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
return (ENOSYS);
if (uap->which < 0 || uap->which >= nitems(shmcalls))
return (EINVAL);
error = (*shmcalls[uap->which])(td, &uap->a2);
return (error);
return ((*shmcalls[uap->which])(td, &uap->a2));
}
#endif /* i386 && (COMPAT_FREEBSD4 || COMPAT_43) */
@ -1087,7 +1083,7 @@ int
freebsd7_freebsd32_shmctl(struct thread *td,
struct freebsd7_freebsd32_shmctl_args *uap)
{
int error = 0;
int error;
union {
struct shmid_ds shmid_ds;
struct shm_info shm_info;
@ -1114,11 +1110,11 @@ freebsd7_freebsd32_shmctl(struct thread *td,
CP(u32.shmid_ds32, u.shmid_ds, shm_dtime);
CP(u32.shmid_ds32, u.shmid_ds, shm_ctime);
}
error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz);
if (error)
goto done;
/* Cases in which we need to copyout */
switch (uap->cmd) {
case IPC_INFO:
@ -1172,7 +1168,7 @@ freebsd7_freebsd32_shmctl(struct thread *td,
int
freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap)
{
int error = 0;
int error;
union {
struct shmid_ds shmid_ds;
struct shm_info shm_info;
@ -1184,7 +1180,7 @@ freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap)
struct shminfo32 shminfo32;
} u32;
size_t sz;
if (uap->cmd == IPC_SET) {
if ((error = copyin(uap->buf, &u32.shmid_ds32,
sizeof(u32.shmid_ds32))))
@ -1199,11 +1195,11 @@ freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap)
CP(u32.shmid_ds32, u.shmid_ds, shm_dtime);
CP(u32.shmid_ds32, u.shmid_ds, shm_ctime);
}
error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz);
if (error)
goto done;
/* Cases in which we need to copyout */
switch (uap->cmd) {
case IPC_INFO:
@ -1270,11 +1266,11 @@ struct freebsd7_shmctl_args {
int
freebsd7_shmctl(struct thread *td, struct freebsd7_shmctl_args *uap)
{
int error = 0;
int error;
struct shmid_ds_old old;
struct shmid_ds buf;
size_t bufsz;
/*
* The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support
* Linux binaries. If we see the call come through the FreeBSD ABI,
@ -1297,7 +1293,7 @@ freebsd7_shmctl(struct thread *td, struct freebsd7_shmctl_args *uap)
CP(old, buf, shm_dtime);
CP(old, buf, shm_ctime);
}
error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz);
if (error)
goto done;