diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-06-08 07:29:22 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-06-08 07:29:22 +0000 |
commit | 1a25bf9ccd891b7e4b7c4ab39a2a188a3a640805 (patch) | |
tree | 72f38159cb5107e74f6fe5c4c3266828b01ef282 /sys/kern/uipc_sem.c | |
parent | b9243da904628c0f3bab2e1ed43ab2773cdc786e (diff) | |
download | FreeBSD-src-1a25bf9ccd891b7e4b7c4ab39a2a188a3a640805.zip FreeBSD-src-1a25bf9ccd891b7e4b7c4ab39a2a188a3a640805.tar.gz |
In sem_forkhook(), don't attempt to generate a copy of the process semaphore
list on fork() if the process doesn't actually have references to any
semaphores. This avoids extra work, as well as potentially asking to
allocate storage for 0 references.
Found by: avatar
MFC after: 1 week
Diffstat (limited to 'sys/kern/uipc_sem.c')
-rw-r--r-- | sys/kern/uipc_sem.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c index 394b6cb..de012b6 100644 --- a/sys/kern/uipc_sem.c +++ b/sys/kern/uipc_sem.c @@ -915,6 +915,10 @@ sem_forkhook(arg, p1, p2, flags) mtx_lock(&sem_lock); count = sem_count_proc(p1); + if (count == 0) { + mtx_unlock(&sem_lock); + return; + } race_lost: mtx_assert(&sem_lock, MA_OWNED); mtx_unlock(&sem_lock); |