From e2cbd4754e6db2e56c008e2d96298dcea46b1298 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 20 Feb 2009 15:54:45 +1300 Subject: [PATCH] sem_overview.7: Clarify construction rules for semaphore object names See also http://groups.google.com/group/comp.os.linux.development.apps/browse_thread/thread/b4a67caa765cb65f Reported-by: Jens Thoms Toerring Reported-by: Jan Engelhardt Signed-off-by: Michael Kerrisk --- man7/sem_overview.7 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/man7/sem_overview.7 b/man7/sem_overview.7 index 6575a3e43..d2c6c2762 100644 --- a/man7/sem_overview.7 +++ b/man7/sem_overview.7 @@ -23,7 +23,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH SEM_OVERVIEW 7 2008-06-15 "Linux" "Linux Programmer's Manual" +.TH SEM_OVERVIEW 7 2009-02-20 "Linux" "Linux Programmer's Manual" .SH NAME sem_overview \- Overview of POSIX semaphores .SH DESCRIPTION @@ -44,7 +44,20 @@ unnamed semaphores. .TP .B Named semaphores A named semaphore is identified by a name of the form -.IR /somename . +.IR /somename ; +that is, a null-terminated string of up to +.BI NAME_MAX +1 +(i.e., 256) characters consisting of an initial slash, +.\" glibc allows the initial slash to be omitted, and makes +.\" multiple initial slashes equivalent to a single slash. +.\" This differs from the implementation of POSIX message queues. +followed by one or more characters, none of which are slashes. +.\" glibc allows subdirectory components in the name, in which +.\" case the subdirectory tree must exist under /dev/shm, and +.\" the fist subdirectory component must exist as the name +.\" sem.name, and all of the subdirectory components must allow the +.\" required permissions if a user wants to create a semaphore +.\" object in a subdirectory. Two processes can operate on the same named semaphore by passing the same name to .BR sem_open (3). @@ -113,7 +126,7 @@ On Linux, named semaphores are created in a virtual file system, normally mounted under .IR /dev/shm , with names of the form -.IR \fBsem.\fPname . +.IR \fBsem.\fPsomename . Since Linux 2.6.19, ACLs can be placed on files under this directory, to control object permissions on a per-user and per-group basis.