diff options
author | alfred <alfred@FreeBSD.org> | 2002-08-05 05:16:09 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-08-05 05:16:09 +0000 |
commit | 0a5393ffc8182ca70dacf0825f2e4e91bb10beb6 (patch) | |
tree | 7b64cd0895cbfca16fec09a89d46b6ad8e5236fb | |
parent | e363dee16bcc6c1949f7c72df32c890db5c0cd70 (diff) | |
download | FreeBSD-src-0a5393ffc8182ca70dacf0825f2e4e91bb10beb6.zip FreeBSD-src-0a5393ffc8182ca70dacf0825f2e4e91bb10beb6.tar.gz |
Cleanup:
Fix line wrapping.
Remove 'register'.
malloc(9) with M_WAITOK can't fail, so remove checks for that.
-rw-r--r-- | sys/kern/sysv_sem.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 010fbe0..a45573b 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -128,7 +128,8 @@ struct sem_undo { /* * Macro to find a particular sem_undo vector */ -#define SEMU(ix) ((struct sem_undo *)(((intptr_t)semu)+ix * seminfo.semusz)) +#define SEMU(ix) \ + ((struct sem_undo *)(((intptr_t)semu)+ix * seminfo.semusz)) /* * semaphore info struct @@ -163,7 +164,7 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLFLAG_RD, static void seminit(void) { - register int i; + int i; TUNABLE_INT_FETCH("kern.ipc.semmap", &seminfo.semmap); TUNABLE_INT_FETCH("kern.ipc.semmni", &seminfo.semmni); @@ -177,21 +178,16 @@ seminit(void) TUNABLE_INT_FETCH("kern.ipc.semaem", &seminfo.semaem); sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); - if (sem == NULL) - panic("sem is NULL"); - sema = malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, M_WAITOK); - if (sema == NULL) - panic("sema is NULL"); + sema = malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, + M_WAITOK); semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); - if (semu == NULL) - panic("semu is NULL"); for (i = 0; i < seminfo.semmni; i++) { sema[i].sem_base = 0; sema[i].sem_perm.mode = 0; } for (i = 0; i < seminfo.semmnu; i++) { - register struct sem_undo *suptr = SEMU(i); + struct sem_undo *suptr = SEMU(i); suptr->un_proc = NULL; } semu_list = NULL; @@ -286,9 +282,9 @@ static struct sem_undo * semu_alloc(td) struct thread *td; { - register int i; - register struct sem_undo *suptr; - register struct sem_undo **supptr; + int i; + struct sem_undo *suptr; + struct sem_undo **supptr; int attempt; /* @@ -354,14 +350,14 @@ semu_alloc(td) static int semundo_adjust(td, supptr, semid, semnum, adjval) - register struct thread *td; + struct thread *td; struct sem_undo **supptr; int semid, semnum; int adjval; { struct proc *p = td->td_proc; - register struct sem_undo *suptr; - register struct undo *sunptr; + struct sem_undo *suptr; + struct undo *sunptr; int i; /* Look for and remember the sem_undo if the caller doesn't provide @@ -428,11 +424,11 @@ static void semundo_clear(semid, semnum) int semid, semnum; { - register struct sem_undo *suptr; + struct sem_undo *suptr; for (suptr = semu_list; suptr != NULL; suptr = suptr->un_next) { - register struct undo *sunptr = &suptr->un_ent[0]; - register int i = 0; + struct undo *sunptr = &suptr->un_ent[0]; + int i = 0; while (i < suptr->un_cnt) { if (sunptr->un_id == semid) { @@ -470,7 +466,7 @@ struct __semctl_args { int __semctl(td, uap) struct thread *td; - register struct __semctl_args *uap; + struct __semctl_args *uap; { int semid = uap->semid; int semnum = uap->semnum; @@ -480,7 +476,7 @@ __semctl(td, uap) struct ucred *cred = td->td_ucred; int i, rval, error; struct semid_ds sbuf; - register struct semid_ds *semaptr; + struct semid_ds *semaptr; u_short usval; DPRINTF(("call to semctl(%d, %d, %d, 0x%x)\n", @@ -683,7 +679,7 @@ struct semget_args { int semget(td, uap) struct thread *td; - register struct semget_args *uap; + struct semget_args *uap; { int semid, error = 0; int key = uap->key; @@ -791,14 +787,14 @@ struct semop_args { int semop(td, uap) struct thread *td; - register struct semop_args *uap; + struct semop_args *uap; { int semid = uap->semid; u_int nsops = uap->nsops; struct sembuf *sops = NULL; - register struct semid_ds *semaptr; - register struct sembuf *sopptr = 0; - register struct sem *semptr = 0; + struct semid_ds *semaptr; + struct sembuf *sopptr = 0; + struct sem *semptr = 0; struct sem_undo *suptr; int i, j, error; int do_wakeup, do_undos; @@ -1064,8 +1060,8 @@ static void semexit_myhook(p) struct proc *p; { - register struct sem_undo *suptr; - register struct sem_undo **supptr; + struct sem_undo *suptr; + struct sem_undo **supptr; /* * Go through the chain of undo vectors looking for one |