Date: Wed, 2 Dec 2009 16:19:24 -0500 (EST) From: Daniel Eischen <deischen@freebsd.org> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-current@freebsd.org Subject: Re: process shared semaphores? Message-ID: <Pine.GSO.4.64.0912021617070.16008@sea.ntplx.net> In-Reply-To: <4B16D802.6030904@cs.duke.edu> References: <4B16D802.6030904@cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2 Dec 2009, Andrew Gallatin wrote:
>
> The man page for sem_init(3) says:
>
> A non-zero value for pshared specifies a
> shared semaphore that can be used by multiple processes, which this
> implementation is not capable of.
>
> Is this still correct? I'm asking, both because it seems strange to
> not return an error if the implementation does not support pshared
> semaphores, and because the threads library seems to expect
> it to work. Eg:
>
> int
> _sem_init(sem_t *sem, int pshared, unsigned int value)
> {
> semid_t semid;
>
> semid = (semid_t)SEM_USER;
> if ((pshared != 0) && (ksem_init(&semid, value) != 0))
> return (-1);
> <....
>
>
> So is the man page out of date, or is the userspace code future-proof
> for when the kernel catches up?
The code should probably return -1 and ENOTSUP.
Why don't you use named semaphores if you want
process shared (sem_open)? Shouldn't those work?
--
DE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0912021617070.16008>
