From owner-svn-src-head@FreeBSD.ORG Tue Dec 8 20:48:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CED46106568F; Tue, 8 Dec 2009 20:48:06 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDAB58FC18; Tue, 8 Dec 2009 20:48:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8Km6xp099422; Tue, 8 Dec 2009 20:48:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8Km6aP099420; Tue, 8 Dec 2009 20:48:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912082048.nB8Km6aP099420@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 8 Dec 2009 20:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200274 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 20:48:06 -0000 Author: jilles Date: Tue Dec 8 20:48:06 2009 New Revision: 200274 URL: http://svn.freebsd.org/changeset/base/200274 Log: sem_init(3): document process shared semaphores and their restrictions Modified: head/lib/libc/gen/sem_init.3 Modified: head/lib/libc/gen/sem_init.3 ============================================================================== --- head/lib/libc/gen/sem_init.3 Tue Dec 8 20:47:10 2009 (r200273) +++ head/lib/libc/gen/sem_init.3 Tue Dec 8 20:48:06 2009 (r200274) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2000 +.Dd December 8, 2009 .Dt SEM_INIT 3 .Os .Sh NAME @@ -48,8 +48,7 @@ to have the value .Fa value . A non-zero value for .Fa pshared -specifies a shared semaphore that can be used by multiple processes, which this -implementation is not capable of. +specifies a shared semaphore that can be used by multiple processes. .Pp Following a successful call to .Fn sem_init , @@ -78,8 +77,6 @@ argument exceeds .Dv SEM_VALUE_MAX . .It Bq Er ENOSPC Memory allocation error. -.It Bq Er EPERM -Unable to initialize a shared semaphore. .El .Sh SEE ALSO .Xr sem_destroy 3 , @@ -93,16 +90,10 @@ The .Fn sem_init function conforms to .St -p1003.1-96 . -.Pp -This implementation does not support shared semaphores, and reports this fact -by setting -.Va errno -to -.Er EPERM . -This is perhaps a stretch of the intention of -.Tn POSIX , -but is -compliant, with the caveat that -.Fn sem_init -always reports a permissions error when an attempt to create a shared semaphore -is made. +.Sh BUGS +A sem_t is a pointer to a separately allocated structure, +therefore process shared semaphores only work between related processes +and do not perform very well +(each operation is a system call, +while single-process semaphores only do a system call +if they need to block or wake up a thread).