cvs commit: src/sys/kern uipc_sem.c
Robert Watson
rwatson at FreeBSD.org
Fri Feb 25 19:10:51 GMT 2005
rwatson 2005-02-25 19:10:51 UTC
FreeBSD src repository
Modified files:
sys/kern uipc_sem.c
Log:
Add an exit hook, sem_forkhook(), which walks the list of POSIX semaphores
owned by a process when it forks, and creates a matching set of references
for the child process, as prescribed by POSIX.
In order to avoid races with other threads in the parent process during
fork(), it is necessary to allocate a temporary reference list while
holding the sem_lock, then transfer those references to the new process
once the sem_lock is released. The implementation is inefficient but
appears functional; in order to improve the efficiency, it will be
necessary to modify the existing structures and logic, which generally
rely on O(n) operations over the global set of semaphores.
Revision Changes Path
1.16 +113 -1 src/sys/kern/uipc_sem.c
More information about the cvs-src
mailing list