From owner-freebsd-hackers Wed Sep 18 21: 9:28 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E92C337B401 for ; Wed, 18 Sep 2002 21:09:27 -0700 (PDT) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E74B43E65 for ; Wed, 18 Sep 2002 21:09:27 -0700 (PDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.3/8.12.5) with ESMTP id g8J49QVo045800 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Thu, 19 Sep 2002 00:09:26 -0400 (EDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.3/8.12.5/Submit) id g8J49QcN045797; Thu, 19 Sep 2002 00:09:26 -0400 (EDT) (envelope-from wollman) Date: Thu, 19 Sep 2002 00:09:26 -0400 (EDT) From: Garrett Wollman Message-Id: <200209190409.g8J49QcN045797@khavrinen.lcs.mit.edu> To: Daniel Eischen Cc: hackers@FreeBSD.org Subject: Re: sem_init help? In-Reply-To: References: <20020919015911.GQ86737@elvis.mu.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG < said: > The semaphore remains active until it is destroyed. If you don't > want to track its page, can you hook it into ipcrm(1)? A simple way of implementing process-shared anonymous semaphores, using the kernel support, is to simply create a temporary semaphore, and (important part) store the pathname in the sem_t. Then, every semaphore operation becomes sem_open, kernel operation, sem_close, and destroy unlinks the temporary semaphore. This would be a poor-quality implementation, but it would work. A better implementation would not use a temporary semaphore at all. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message