Date: Fri, 30 Jan 2004 09:11:09 -0500 (EST) From: Daniel Eischen <eischen@vigrid.com> To: Andrey Chernov <ache@nagual.pp.ru> Cc: current@freebsd.org Subject: Re: POSIX semaphores? Message-ID: <Pine.GSO.4.10.10401300902100.6366-100000@pcnet5.pcnet.com> In-Reply-To: <20040130135802.GA57662@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 30 Jan 2004, Andrey Chernov wrote: > Could anybody enlighten me, please? > > 1) What is current status of POSIX semaphores? Are they at the production > quality? Are they better implemented than SYSV ones? > 2) What is kernel option to turn them on? Why I don't find it in NOTES or > GENERIC? You need option P1003_1B_SEMAPHORES. It's in sys/conf/NOTES. > The reason why I ever ask is that some ports try to sense POSIX semaphores > at configure stage (looking for sem_init()) and then compiled program > fails with "Unknown system call" diagnostic. They must be trying to use shared semaphores which currently don't work across processes (unless they are forked and semaphore is created before the fork). The problem is that semaphores (and mutexes, condition variables, etc) are all pointers to an allocated structure. You can't place this (the pointer) in shared memory and have processes other than the creating process access it. This probably won't be fixed until 6.0 because we'll need to change these synchronization types to be the actual structures instead of pointers (breaking binary compatibility). So we do support semaphores, but not pshared semaphores even though the library call honors pshared. And if you do try to use a pshared semaphore, then the kernel support (P1003_1B_SEMAPHORES) has to be there. -- Dan (currently reworking semaphores)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10401300902100.6366-100000>