From 790767dcd5e563c726e419ff426ad7e01c516262 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 17 Feb 2009 19:57:52 +0000 Subject: MFC: Rework the lifetime management of the kernel implementation of POSIX semaphores. Specifically, semaphores are now represented as new file descriptor type that is set to close on exec. This removes the need for all of the manual process reference counting (and fork, exec, and exit event handlers) as the normal file descriptor operations handle all of that for us nicely. It is also suggested as one possible implementation in the spec and at least one other OS (OS X) uses this approach. Refer to the original commit for more details on specific bug fixes, etc. A notable difference in this MFC relative to the original commit to HEAD is that the MAC entry points are unchanged to preserve the ABI for MAC policy modules. fstat() on a POSIX semaphore in 7 uses the mac_check_posix_sem_getvalue() hook to determine access as that is the closest match to stat() of the available hooks. Discussed with: rwatson (MAC bits (or lack thereof)) --- usr.bin/procstat/procstat_files.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'usr.bin') diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c index d9a8cdab0970..8dd6dabb2cd5 100644 --- a/usr.bin/procstat/procstat_files.c +++ b/usr.bin/procstat/procstat_files.c @@ -197,6 +197,10 @@ procstat_files(pid_t pid, struct kinfo_proc *kipp) str = "m"; break; + case KF_TYPE_SEM: + str = "e"; + break; + case KF_TYPE_NONE: case KF_TYPE_UNKNOWN: default: -- cgit v1.3