Whitespace nits and wrap some lines.

This commit is contained in:
enami 2004-03-18 22:53:16 +00:00
parent ef38ad00a0
commit a67d24818d
1 changed files with 62 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysv_sem.c,v 1.50 2004/03/18 01:16:44 christos Exp $ */
/* $NetBSD: sysv_sem.c,v 1.51 2004/03/18 22:53:16 enami Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysv_sem.c,v 1.50 2004/03/18 01:16:44 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysv_sem.c,v 1.51 2004/03/18 22:53:16 enami Exp $");
#define SYSVSEM
@ -86,9 +86,9 @@ seminit()
vaddr_t v;
/* Allocate pageable memory for our structures */
sz = seminfo.semmni * sizeof(struct semid_ds)
+ seminfo.semmns * sizeof(struct __sem)
+ seminfo.semmnu * seminfo.semusz;
sz = seminfo.semmni * sizeof(struct semid_ds) +
seminfo.semmns * sizeof(struct __sem) +
seminfo.semmnu * seminfo.semusz;
if ((v = uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
panic("sysv_sem: cannot allocate memory");
sema = (void *)v;
@ -117,6 +117,7 @@ sys_semconfig(l, v, retval)
void *v;
register_t *retval;
{
*retval = 0;
return 0;
}
@ -207,8 +208,10 @@ semundo_adjust(p, supptr, semid, semnum, adjval)
struct undo *sunptr;
int i;
/* Look for and remember the sem_undo if the caller doesn't provide
it */
/*
* Look for and remember the sem_undo if the caller doesn't
* provide it
*/
suptr = *supptr;
if (suptr == NULL) {
@ -229,8 +232,8 @@ semundo_adjust(p, supptr, semid, semnum, adjval)
}
/*
* Look for the requested entry and adjust it (delete if adjval becomes
* 0).
* Look for the requested entry and adjust it (delete if
* adjval becomes 0).
*/
sunptr = &suptr->un_ent[0];
for (i = 0; i < suptr->un_cnt; i++, sunptr++) {
@ -530,7 +533,8 @@ sys_semget(l, v, retval)
return (EINVAL);
}
if (nsems > seminfo.semmns - semtot) {
SEM_PRINTF(("not enough semaphores left (need %d, got %d)\n",
SEM_PRINTF(("not enough semaphores left "
"(need %d, got %d)\n",
nsems, seminfo.semmns - semtot));
return (ENOSPC);
}
@ -616,8 +620,8 @@ sys_semop(l, v, retval)
return (E2BIG);
}
if ((eval = copyin(SCARG(uap, sops), sops, nsops * sizeof(sops[0])))
!= 0) {
if ((eval = copyin(SCARG(uap, sops),
sops, nsops * sizeof(sops[0]))) != 0) {
SEM_PRINTF(("eval = %d from copyin(%p, %p, %lld)\n", eval,
SCARG(uap, sops), &sops,
(long long)(nsops * sizeof(sops[0]))));
@ -646,15 +650,18 @@ sys_semop(l, v, retval)
semptr = &semaptr->_sem_base[sopptr->sem_num];
SEM_PRINTF(("semop: semaptr=%p, sem_base=%p, semptr=%p, sem[%d]=%d : op=%d, flag=%s\n",
SEM_PRINTF(("semop: semaptr=%p, sem_base=%p, "
"semptr=%p, sem[%d]=%d : op=%d, flag=%s\n",
semaptr, semaptr->_sem_base, semptr,
sopptr->sem_num, semptr->semval, sopptr->sem_op,
(sopptr->sem_flg & IPC_NOWAIT) ? "nowait" : "wait"));
(sopptr->sem_flg & IPC_NOWAIT) ?
"nowait" : "wait"));
if (sopptr->sem_op < 0) {
if ((int)(semptr->semval +
sopptr->sem_op) < 0) {
SEM_PRINTF(("semop: can't do it now\n"));
SEM_PRINTF(("semop: "
"can't do it now\n"));
break;
} else {
semptr->semval += sopptr->sem_op;
@ -729,6 +736,7 @@ sys_semop(l, v, retval)
* The semaphore is still alive. Readjust the count of
* waiting processes.
*/
semptr = &semaptr->_sem_base[sopptr->sem_num];
if (sopptr->sem_op == 0)
semptr->semzcnt--;
else
@ -817,8 +825,8 @@ done:
}
/*
* Go through the undo structures for this process and apply the adjustments to
* semaphores.
* Go through the undo structures for this process and apply the
* adjustments to semaphores.
*/
/*ARGSUSED*/
void
@ -830,8 +838,8 @@ semexit(p, v)
struct sem_undo **supptr;
/*
* Go through the chain of undo vectors looking for one associated with
* this process.
* Go through the chain of undo vectors looking for one
* associated with this process.
*/
for (supptr = &semu_list; (suptr = *supptr) != NULL;
@ -872,7 +880,8 @@ semexit(p, v)
if (semnum >= semaptr->sem_nsems)
panic("semexit - semnum out of range");
SEM_PRINTF(("semexit: %p id=%d num=%d(adj=%d) ; sem=%d\n",
SEM_PRINTF(("semexit: %p id=%d num=%d(adj=%d) ; "
"sem=%d\n",
suptr->un_proc, suptr->un_ent[ix].un_id,
suptr->un_ent[ix].un_num,
suptr->un_ent[ix].un_adjval,