From owner-freebsd-current@FreeBSD.ORG Thu Dec 3 15:30:06 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 B631B1065672; Thu, 3 Dec 2009 15:30:06 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id 7AD2D8FC19; Thu, 3 Dec 2009 15:30:06 +0000 (UTC) Received: from [172.31.193.10] (cpe-174-097-131-132.nc.res.rr.com [174.97.131.132]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id nB3FTxsP016756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Dec 2009 10:30:05 -0500 (EST) Message-ID: <4B17D972.3000903@cs.duke.edu> Date: Thu, 03 Dec 2009 10:29:54 -0500 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Daniel Eischen References: <4B16D802.6030904@cs.duke.edu> <20091203003705.GA1769@grapeape1.cs.duke.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: process shared semaphores? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 15:30:06 -0000 Daniel Eischen wrote: > We had this same discussion last time. You have a > short memory, don't you? :-) :-) > > The sem_t in FreeBSD is a pointer to a malloc'd struct > (see sem_alloc() in libc/gen/sem.c). A pointer to malloc'd > memory cannot be shared across processes (unless they are > all children I suppose). > Argh! I keep forgetting that is the root of the problem. I think the previous discussion was more about pthreads. I guess I'm just a bloody idiot for not realizing that sems had the same problem. Now that you remind me, I even remember groping around in the library sources, and trying to use _pthread_mutex_init_calloc_cb() to force the mutex allocation to come from shared memory. But now the project author wants to use semaphores, and I just didn't make the connection. Sorry to waste your time.. Drew