From owner-freebsd-current@FreeBSD.ORG Wed Dec 2 21:19:32 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4030610656A6 for ; Wed, 2 Dec 2009 21:19:32 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id A6CBF8FC18 for ; Wed, 2 Dec 2009 21:19:31 +0000 (UTC) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id nB2LJO7Q024929; Wed, 2 Dec 2009 16:19:24 -0500 (EST) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.2.2 (mail.netplex.net [204.213.176.10]); Wed, 02 Dec 2009 16:19:24 -0500 (EST) Date: Wed, 2 Dec 2009 16:19:24 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Andrew Gallatin In-Reply-To: <4B16D802.6030904@cs.duke.edu> Message-ID: References: <4B16D802.6030904@cs.duke.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org Subject: Re: process shared semaphores? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 21:19:32 -0000 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