diff options
author | trasz <trasz@FreeBSD.org> | 2011-07-06 20:06:44 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2011-07-06 20:06:44 +0000 |
commit | 4a17b24427e55ec7e1862b08a0a9247f0717d010 (patch) | |
tree | 443d8da9aef22fdf042ab6f2cf16f5e2d4f04bd3 /sys/kern/sysv_sem.c | |
parent | 1adac93bc0e2f40ac5d98734f9451cb1a0f42124 (diff) | |
download | FreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.zip FreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.tar.gz |
All the racct_*() calls need to happen with the proc locked. Fixing this
won't happen before 9.0. This commit adds "#ifdef RACCT" around all the
"PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order
to avoid useless locking/unlocking in kernels built without "options RACCT".
Diffstat (limited to 'sys/kern/sysv_sem.c')
-rw-r--r-- | sys/kern/sysv_sem.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index ac53a8d..4bbe787 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -931,6 +931,7 @@ semget(struct thread *td, struct semget_args *uap) error = ENOSPC; goto done2; } +#ifdef RACCT PROC_LOCK(td->td_proc); error = racct_add(td->td_proc, RACCT_NSEM, nsems); PROC_UNLOCK(td->td_proc); @@ -938,6 +939,7 @@ semget(struct thread *td, struct semget_args *uap) error = ENOSPC; goto done2; } +#endif DPRINTF(("semid %d is available\n", semid)); mtx_lock(&sema_mtx[semid]); KASSERT((sema[semid].u.sem_perm.mode & SEM_ALLOC) == 0, @@ -1023,12 +1025,14 @@ semop(struct thread *td, struct semop_args *uap) nsops)); return (E2BIG); } else { +#ifdef RACCT PROC_LOCK(td->td_proc); if (nsops > racct_get_available(td->td_proc, RACCT_NSEMOP)) { PROC_UNLOCK(td->td_proc); return (E2BIG); } PROC_UNLOCK(td->td_proc); +#endif sops = malloc(nsops * sizeof(*sops), M_TEMP, M_WAITOK); } |