libthread_xu - implement pshared for sem_init
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 29 Jun 2009 22:38:53 +0000 (15:38 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 29 Jun 2009 22:38:53 +0000 (15:38 -0700)
commit328161bd22eeafdb109345d38e56c3e8948a7ad6
treec71c6b1ec6c8475dc768a00a32d72e36d0a3d96c
parent19b34835af33d6ccee845ff4ce754e7a936fe178
libthread_xu - implement pshared for sem_init

Implement the pshared flag, creating a semaphore in shared memory
that works across fork().  No additional kernel support is needed,
our umtx* system calls work on the underlying physical memory and
thus work just fine with shared memory.

sem_alloc() uses mmap() to allocate a page of shared memory.
Currently sem_destroy() does not recover the allocated memory for
shared semaphores as it is unclear how one is supposed to do so
in a fork()ed environment.

Requested-by: Hasso Tepper <hasso@estpak.ee>
lib/libthread_xu/thread/thr_sem.c