# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2015-02-04 23:33+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: build/C/man3/sem_close.3:26 #, no-wrap msgid "SEM_CLOSE" msgstr "" #. type: TH #: build/C/man3/sem_close.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 #, no-wrap msgid "2012-05-13" msgstr "" #. type: TH #: build/C/man3/sem_close.3:26 build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 build/C/man3/sem_init.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26 build/C/man2/semctl.2:41 build/C/man2/semget.2:36 build/C/man2/semop.2:35 #, no-wrap msgid "Linux" msgstr "" #. type: TH #: build/C/man3/sem_close.3:26 build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 build/C/man3/sem_init.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26 build/C/man2/semctl.2:41 build/C/man2/semget.2:36 build/C/man2/semop.2:35 #, no-wrap msgid "Linux Programmer's Manual" msgstr "" #. type: SH #: build/C/man3/sem_close.3:27 build/C/man3/sem_destroy.3:27 build/C/man3/sem_getvalue.3:27 build/C/man3/sem_init.3:27 build/C/man3/sem_open.3:27 build/C/man7/sem_overview.7:27 build/C/man3/sem_post.3:27 build/C/man3/sem_unlink.3:27 build/C/man3/sem_wait.3:27 build/C/man2/semctl.2:42 build/C/man2/semget.2:37 build/C/man2/semop.2:36 #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:29 msgid "sem_close - close a named semaphore" msgstr "" #. type: SH #: build/C/man3/sem_close.3:29 build/C/man3/sem_destroy.3:29 build/C/man3/sem_getvalue.3:29 build/C/man3/sem_init.3:29 build/C/man3/sem_open.3:29 build/C/man3/sem_post.3:29 build/C/man3/sem_unlink.3:29 build/C/man3/sem_wait.3:29 build/C/man2/semctl.2:44 build/C/man2/semget.2:39 build/C/man2/semop.2:38 #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:32 build/C/man3/sem_destroy.3:32 build/C/man3/sem_getvalue.3:32 build/C/man3/sem_init.3:32 build/C/man3/sem_post.3:32 build/C/man3/sem_unlink.3:32 build/C/man3/sem_wait.3:32 #, no-wrap msgid "B<#include Esemaphore.hE>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:34 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:37 build/C/man3/sem_destroy.3:37 build/C/man3/sem_getvalue.3:37 build/C/man3/sem_init.3:37 build/C/man3/sem_open.3:41 build/C/man3/sem_post.3:37 build/C/man3/sem_unlink.3:37 build/C/man3/sem_wait.3:41 msgid "Link with I<-pthread>." msgstr "" #. type: SH #: build/C/man3/sem_close.3:37 build/C/man3/sem_destroy.3:37 build/C/man3/sem_getvalue.3:37 build/C/man3/sem_init.3:37 build/C/man3/sem_open.3:41 build/C/man7/sem_overview.7:29 build/C/man3/sem_post.3:37 build/C/man3/sem_unlink.3:37 build/C/man3/sem_wait.3:49 build/C/man2/semctl.2:52 build/C/man2/semget.2:49 build/C/man2/semop.2:57 #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:43 msgid "" "B() closes the named semaphore referred to by I, allowing " "any resources that the system has allocated to the calling process for this " "semaphore to be freed." msgstr "" #. type: SH #: build/C/man3/sem_close.3:43 build/C/man3/sem_destroy.3:55 build/C/man3/sem_getvalue.3:54 build/C/man3/sem_init.3:77 build/C/man3/sem_open.3:104 build/C/man3/sem_post.3:45 build/C/man3/sem_unlink.3:44 build/C/man3/sem_wait.3:108 build/C/man2/semctl.2:340 build/C/man2/semget.2:147 build/C/man2/semop.2:298 #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:49 msgid "" "On success B() returns 0; on error, -1 is returned, with " "I set to indicate the error." msgstr "" #. type: SH #: build/C/man3/sem_close.3:49 build/C/man3/sem_destroy.3:61 build/C/man3/sem_getvalue.3:60 build/C/man3/sem_init.3:83 build/C/man3/sem_open.3:116 build/C/man3/sem_post.3:52 build/C/man3/sem_unlink.3:50 build/C/man3/sem_wait.3:114 build/C/man2/semctl.2:387 build/C/man2/semget.2:153 build/C/man2/semop.2:308 #, no-wrap msgid "ERRORS" msgstr "" #. type: TP #: build/C/man3/sem_close.3:50 build/C/man3/sem_destroy.3:62 build/C/man3/sem_getvalue.3:61 build/C/man3/sem_init.3:84 build/C/man3/sem_open.3:132 build/C/man3/sem_open.3:137 build/C/man3/sem_post.3:53 build/C/man3/sem_wait.3:119 build/C/man3/sem_wait.3:133 build/C/man2/semctl.2:420 build/C/man2/semget.2:177 build/C/man2/semget.2:183 build/C/man2/semop.2:356 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:54 build/C/man3/sem_destroy.3:66 build/C/man3/sem_getvalue.3:65 build/C/man3/sem_post.3:57 build/C/man3/sem_wait.3:123 msgid "I is not a valid semaphore." msgstr "" #. type: SH #: build/C/man3/sem_close.3:54 build/C/man3/sem_destroy.3:71 build/C/man3/sem_getvalue.3:70 build/C/man3/sem_init.3:100 build/C/man3/sem_open.3:170 build/C/man7/sem_overview.7:138 build/C/man3/sem_post.3:66 build/C/man3/sem_unlink.3:67 build/C/man3/sem_wait.3:151 build/C/man2/semctl.2:462 build/C/man2/semget.2:210 build/C/man2/semop.2:386 #, no-wrap msgid "CONFORMING TO" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:56 build/C/man3/sem_destroy.3:73 build/C/man3/sem_getvalue.3:72 build/C/man3/sem_init.3:102 build/C/man3/sem_open.3:172 build/C/man7/sem_overview.7:140 build/C/man3/sem_post.3:68 build/C/man3/sem_unlink.3:69 build/C/man3/sem_wait.3:153 msgid "POSIX.1-2001." msgstr "" #. type: SH #: build/C/man3/sem_close.3:56 build/C/man3/sem_destroy.3:73 build/C/man3/sem_getvalue.3:72 build/C/man3/sem_init.3:102 build/C/man7/sem_overview.7:140 build/C/man3/sem_post.3:68 build/C/man3/sem_wait.3:153 build/C/man2/semctl.2:476 build/C/man2/semget.2:214 build/C/man2/semop.2:389 #, no-wrap msgid "NOTES" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:60 msgid "" "All open named semaphores are automatically closed on process termination, " "or upon B(2)." msgstr "" #. type: SH #: build/C/man3/sem_close.3:60 build/C/man3/sem_destroy.3:79 build/C/man3/sem_getvalue.3:76 build/C/man3/sem_init.3:107 build/C/man3/sem_open.3:172 build/C/man7/sem_overview.7:152 build/C/man3/sem_post.3:75 build/C/man3/sem_unlink.3:69 build/C/man3/sem_wait.3:270 build/C/man2/semctl.2:536 build/C/man2/semget.2:296 build/C/man2/semop.2:533 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:67 msgid "" "B(3), B(3), B(3), B(3), " "B(3), B(7)" msgstr "" #. type: SH #: build/C/man3/sem_close.3:67 build/C/man3/sem_destroy.3:84 build/C/man3/sem_getvalue.3:80 build/C/man3/sem_init.3:112 build/C/man3/sem_open.3:179 build/C/man7/sem_overview.7:162 build/C/man3/sem_post.3:79 build/C/man3/sem_unlink.3:75 build/C/man3/sem_wait.3:276 build/C/man2/semctl.2:543 build/C/man2/semget.2:303 build/C/man2/semop.2:542 #, no-wrap msgid "COLOPHON" msgstr "" #. type: Plain text #: build/C/man3/sem_close.3:75 build/C/man3/sem_destroy.3:92 build/C/man3/sem_getvalue.3:88 build/C/man3/sem_init.3:120 build/C/man3/sem_open.3:187 build/C/man7/sem_overview.7:170 build/C/man3/sem_post.3:87 build/C/man3/sem_unlink.3:83 build/C/man3/sem_wait.3:284 build/C/man2/semctl.2:551 build/C/man2/semget.2:311 build/C/man2/semop.2:550 msgid "" "This page is part of release 3.79 of the Linux I project. A " "description of the project, information about reporting bugs, and the latest " "version of this page, can be found at " "\\%http://www.kernel.org/doc/man-pages/." msgstr "" #. type: TH #: build/C/man3/sem_destroy.3:26 #, no-wrap msgid "SEM_DESTROY" msgstr "" #. type: TH #: build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 #, no-wrap msgid "2014-03-03" msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:29 msgid "sem_destroy - destroy an unnamed semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:34 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:41 msgid "" "B() destroys the unnamed semaphore at the address pointed to " "by I." msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:46 msgid "" "Only a semaphore that has been initialized by B(3) should be " "destroyed using B()." msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:51 msgid "" "Destroying a semaphore that other processes or threads are currently blocked " "on (in B(3)) produces undefined behavior." msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:55 msgid "" "Using a semaphore that has been destroyed produces undefined results, until " "the semaphore has been reinitialized using B(3)." msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:61 msgid "" "B() returns 0 on success; on error, -1 is returned, and " "I is set to indicate the error." msgstr "" #. type: SH #: build/C/man3/sem_destroy.3:66 build/C/man3/sem_getvalue.3:65 build/C/man3/sem_init.3:95 build/C/man3/sem_post.3:61 build/C/man3/sem_unlink.3:62 build/C/man3/sem_wait.3:143 #, no-wrap msgid "ATTRIBUTES" msgstr "" #. type: SS #: build/C/man3/sem_destroy.3:67 build/C/man3/sem_getvalue.3:66 build/C/man3/sem_init.3:96 build/C/man3/sem_post.3:62 build/C/man3/sem_unlink.3:63 build/C/man3/sem_wait.3:144 #, no-wrap msgid "Multithreading (see pthreads(7))" msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:71 msgid "The B() function is thread-safe." msgstr "" #. But not on NPTL, where sem_destroy () is a no-op.. #. type: Plain text #: build/C/man3/sem_destroy.3:79 msgid "" "An unnamed semaphore should be destroyed with B() before the " "memory in which it is located is deallocated. Failure to do this can result " "in resource leaks on some implementations." msgstr "" #. type: Plain text #: build/C/man3/sem_destroy.3:84 msgid "B(3), B(3), B(3), B(7)" msgstr "" #. type: TH #: build/C/man3/sem_getvalue.3:26 #, no-wrap msgid "SEM_GETVALUE" msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:29 msgid "sem_getvalue - get the value of a semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:34 #, no-wrap msgid "BIB<, int *>IB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:43 msgid "" "B() places the current value of the semaphore pointed to " "I into the integer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:54 msgid "" "If one or more processes or threads are blocked waiting to lock the " "semaphore with B(3), POSIX.1-2001 permits two possibilities for " "the value returned in I: either 0 is returned; or a negative number " "whose absolute value is the count of the number of processes and threads " "currently blocked in B(3). Linux adopts the former behavior." msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:60 msgid "" "B() returns 0 on success; on error, -1 is returned and " "I is set to indicate the error." msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:70 msgid "The B() function is thread-safe." msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:76 msgid "" "The value of the semaphore may already have changed by the time " "B() returns." msgstr "" #. type: Plain text #: build/C/man3/sem_getvalue.3:80 msgid "B(3), B(3), B(7)" msgstr "" #. type: TH #: build/C/man3/sem_init.3:26 #, no-wrap msgid "SEM_INIT" msgstr "" #. type: TH #: build/C/man3/sem_init.3:26 #, no-wrap msgid "2014-03-10" msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:29 msgid "sem_init - initialize an unnamed semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:34 #, no-wrap msgid "" "BIB<, int >IB<, unsigned int " ">IB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:44 msgid "" "B() initializes the unnamed semaphore at the address pointed to " "by I. The I argument specifies the initial value for the " "semaphore." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:49 msgid "" "The I argument indicates whether this semaphore is to be shared " "between the threads of a process, or between processes." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:57 msgid "" "If I has the value 0, then the semaphore is shared between the " "threads of a process, and should be located at some address that is visible " "to all threads (e.g., a global variable, or a variable allocated dynamically " "on the heap)." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:74 msgid "" "If I is nonzero, then the semaphore is shared between processes, " "and should be located in a region of shared memory (see B(3), " "B(2), and B(2)). (Since a child created by B(2) " "inherits its parent's memory mappings, it can also access the semaphore.) " "Any process that can access the shared memory region can operate on the " "semaphore using B(3), B(3), and so on." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:77 msgid "" "Initializing a semaphore that has already been initialized results in " "undefined behavior." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:83 msgid "" "B() returns 0 on success; on error, -1 is returned, and I " "is set to indicate the error." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:89 msgid "I exceeds B." msgstr "" #. type: TP #: build/C/man3/sem_init.3:89 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:95 msgid "" "I is nonzero, but the system does not support process-shared " "semaphores (see B(7))." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:100 msgid "The B() function is thread-safe." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:107 msgid "" "Bizarrely, POSIX.1-2001 does not specify the value that should be returned " "by a successful call to B(). POSIX.1-2008 rectifies this, " "specifying the zero return on success." msgstr "" #. type: Plain text #: build/C/man3/sem_init.3:112 msgid "B(3), B(3), B(3), B(7)" msgstr "" #. type: TH #: build/C/man3/sem_open.3:26 #, no-wrap msgid "SEM_OPEN" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:29 msgid "sem_open - initialize and open a named semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:34 #, no-wrap msgid "" "B<#include Efcntl.hE> /* For O_* constants */\n" "B<#include Esys/stat.hE> /* For mode constants */\n" "B<#include Esemaphore.hE>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:38 #, no-wrap msgid "" "BIB<, int >IB<);>\n" "BIB<, int >IB<, >\n" "B< mode_t >IB<, unsigned int >IB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:50 msgid "" "B() creates a new POSIX semaphore or opens an existing " "semaphore. The semaphore is identified by I. For details of the " "construction of I, see B(7)." msgstr "" #. In reality the filesystem IDs are used on Linux. #. type: Plain text #: build/C/man3/sem_open.3:76 msgid "" "The I argument specifies flags that control the operation of the " "call. (Definitions of the flags values can be obtained by including " "Ifcntl.hE>.) If B is specified in I, then the " "semaphore is created if it does not already exist. The owner (user ID) of " "the semaphore is set to the effective user ID of the calling process. The " "group ownership (group ID) is set to the effective group ID of the calling " "process. If both B and B are specified in I, then " "an error is returned if a semaphore with the given I already exists." msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:104 msgid "" "If B is specified in I, then two additional arguments must " "be supplied. The I argument specifies the permissions to be placed on " "the new semaphore, as for B(2). (Symbolic definitions for the " "permissions bits can be obtained by including Isys/stat.hE>.) The " "permissions settings are masked against the process umask. Both read and " "write permission should be granted to each class of user that will access " "the semaphore. The I argument specifies the initial value for the " "new semaphore. If B is specified, and a semaphore with the given " "I already exists, then I and I are ignored." msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:116 msgid "" "On success, B() returns the address of the new semaphore; this " "address is used when calling other semaphore-related functions. On error, " "B() returns B, with I set to indicate the " "error." msgstr "" #. type: TP #: build/C/man3/sem_open.3:117 build/C/man3/sem_unlink.3:51 build/C/man2/semctl.2:391 build/C/man2/semget.2:157 build/C/man2/semop.2:320 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:121 msgid "The semaphore exists, but the caller does not have permission to open it." msgstr "" #. type: TP #: build/C/man3/sem_open.3:121 build/C/man2/semget.2:165 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:132 msgid "" "Both B and B were specified in I, but a semaphore " "with this I already exists." msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:137 msgid "I was greater than B." msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:141 msgid "I consists of just \"/\", followed by no other characters." msgstr "" #. type: TP #: build/C/man3/sem_open.3:141 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:144 msgid "The process already has the maximum number of files and open." msgstr "" #. type: TP #: build/C/man3/sem_open.3:144 build/C/man3/sem_unlink.3:54 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:148 build/C/man3/sem_unlink.3:58 msgid "I was too long." msgstr "" #. type: TP #: build/C/man3/sem_open.3:148 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:151 msgid "The system limit on the total number of open files has been reached." msgstr "" #. type: TP #: build/C/man3/sem_open.3:151 build/C/man3/sem_unlink.3:58 build/C/man2/semget.2:190 #, no-wrap msgid "B" msgstr "" #. this error can occur if we have a name of the (nonportable) form #. /dir/name, and the directory /dev/shm/dir does not exist. #. type: Plain text #: build/C/man3/sem_open.3:167 msgid "" "The B flag was not specified in I and no semaphore with this " "I exists; or, B was specified, but I wasn't well " "formed." msgstr "" #. type: TP #: build/C/man3/sem_open.3:167 build/C/man2/semget.2:198 build/C/man2/semop.2:363 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:170 msgid "Insufficient memory." msgstr "" #. type: Plain text #: build/C/man3/sem_open.3:179 msgid "" "B(3), B(3), B(3), B(3), " "B(3), B(7)" msgstr "" #. type: TH #: build/C/man7/sem_overview.7:26 #, no-wrap msgid "SEM_OVERVIEW" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:29 msgid "sem_overview - overview of POSIX semaphores" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:31 msgid "POSIX semaphores allow processes and threads to synchronize their actions." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:41 msgid "" "A semaphore is an integer whose value is never allowed to fall below zero. " "Two operations can be performed on semaphores: increment the semaphore value " "by one (B(3)); and decrement the semaphore value by one " "(B(3)). If the value of a semaphore is currently zero, then a " "B(3) operation will block until the value becomes greater than " "zero." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:44 msgid "POSIX semaphores come in two forms: named semaphores and unnamed semaphores." msgstr "" #. type: TP #: build/C/man7/sem_overview.7:44 #, no-wrap msgid "B" msgstr "" #. 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. #. 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. #. type: Plain text #: build/C/man7/sem_overview.7:64 msgid "" "A named semaphore is identified by a name of the form I; that is, " "a null-terminated string of up to BI<-4> (i.e., 251) characters " "consisting of an initial slash, followed by one or more characters, none of " "which are slashes. Two processes can operate on the same named semaphore by " "passing the same name to B(3)." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:79 msgid "" "The B(3) function creates a new named semaphore or opens an " "existing named semaphore. After the semaphore has been opened, it can be " "operated on using B(3) and B(3). When a process has " "finished using the semaphore, it can use B(3) to close the " "semaphore. When all processes have finished using the semaphore, it can be " "removed from the system using B(3)." msgstr "" #. type: TP #: build/C/man7/sem_overview.7:79 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:94 msgid "" "An unnamed semaphore does not have a name. Instead the semaphore is placed " "in a region of memory that is shared between multiple threads (a " "I) or processes (a I). " "A thread-shared semaphore is placed in an area of memory shared between the " "threads of a process, for example, a global variable. A process-shared " "semaphore must be placed in a shared memory region (e.g., a System V shared " "memory segment created using B(2), or a POSIX shared memory object " "built created using B(3))." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:105 msgid "" "Before being used, an unnamed semaphore must be initialized using " "B(3). It can then be operated on using B(3) and " "B(3). When the semaphore is no longer required, and before the " "memory in which it is located is deallocated, the semaphore should be " "destroyed using B(3)." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:108 msgid "" "The remainder of this section describes some specific details of the Linux " "implementation of POSIX semaphores." msgstr "" #. type: SS #: build/C/man7/sem_overview.7:108 #, no-wrap msgid "Versions" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:114 msgid "" "Prior to kernel 2.6, Linux supported only unnamed, thread-shared " "semaphores. On a system with Linux 2.6 and a glibc that provides the NPTL " "threading implementation, a complete implementation of POSIX semaphores is " "provided." msgstr "" #. type: SS #: build/C/man7/sem_overview.7:114 #, no-wrap msgid "Persistence" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:119 msgid "" "POSIX named semaphores have kernel persistence: if not removed by " "B(3), a semaphore will exist until the system is shut down." msgstr "" #. type: SS #: build/C/man7/sem_overview.7:119 #, no-wrap msgid "Linking" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:124 msgid "" "Programs using the POSIX semaphores API must be compiled with I " "to link against the real-time library, I." msgstr "" #. type: SS #: build/C/man7/sem_overview.7:124 #, no-wrap msgid "Accessing named semaphores via the filesystem" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:135 msgid "" "On Linux, named semaphores are created in a virtual filesystem, normally " "mounted under I, with names of the form BI. (This " "is the reason that semaphore names are limited to BI<-4> rather " "than B characters.)" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:138 msgid "" "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." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:149 msgid "" "System V semaphores (B(2), B(2), etc.) are an older semaphore " "API. POSIX semaphores provide a simpler, and better designed interface than " "System V semaphores; on the other hand POSIX semaphores are less widely " "available (especially on older systems) than System V semaphores." msgstr "" #. type: SH #: build/C/man7/sem_overview.7:149 build/C/man3/sem_post.3:72 build/C/man3/sem_wait.3:161 build/C/man2/semop.2:508 #, no-wrap msgid "EXAMPLE" msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:152 msgid "" "An example of the use of various POSIX semaphore functions is shown in " "B(3)." msgstr "" #. type: Plain text #: build/C/man7/sem_overview.7:162 msgid "" "B(3), B(3), B(3), B(3), " "B(3), B(3), B(3), B(3), " "B(7)" msgstr "" #. type: TH #: build/C/man3/sem_post.3:26 #, no-wrap msgid "SEM_POST" msgstr "" #. type: TH #: build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26 #, no-wrap msgid "2014-02-26" msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:29 msgid "sem_post - unlock a semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:34 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:45 msgid "" "B() increments (unlocks) the semaphore pointed to by I. If " "the semaphore's value consequently becomes greater than zero, then another " "process or thread blocked in a B(3) call will be woken up and " "proceed to lock the semaphore." msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:52 msgid "" "B() returns 0 on success; on error, the value of the semaphore is " "left unchanged, -1 is returned, and I is set to indicate the error." msgstr "" #. type: TP #: build/C/man3/sem_post.3:57 #, no-wrap msgid "B" msgstr "" #. Added in POSIX.1-2008 TC1 (Austin Interpretation 213) #. type: Plain text #: build/C/man3/sem_post.3:61 msgid "The maximum allowable value for a semaphore would be exceeded." msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:66 msgid "The B() function is thread-safe." msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:72 msgid "" "B() is async-signal-safe: it may be safely called within a signal " "handler." msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:75 msgid "See B(3)." msgstr "" #. type: Plain text #: build/C/man3/sem_post.3:79 msgid "B(3), B(3), B(7)" msgstr "" #. type: TH #: build/C/man3/sem_unlink.3:26 #, no-wrap msgid "SEM_UNLINK" msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:29 msgid "sem_unlink - remove a named semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:34 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:44 msgid "" "B() removes the named semaphore referred to by I. The " "semaphore name is removed immediately. The semaphore is destroyed once all " "other processes that have the semaphore open close it." msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:50 msgid "" "On success B() returns 0; on error, -1 is returned, with " "I set to indicate the error." msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:54 msgid "The caller does not have permission to unlink this semaphore." msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:62 msgid "There is no semaphore with the given I." msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:67 msgid "The B() function is thread-safe." msgstr "" #. type: Plain text #: build/C/man3/sem_unlink.3:75 msgid "" "B(3), B(3), B(3), B(3), " "B(7)" msgstr "" #. type: TH #: build/C/man3/sem_wait.3:26 #, no-wrap msgid "SEM_WAIT" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:29 msgid "sem_wait, sem_timedwait, sem_trywait - lock a semaphore" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:34 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:36 #, no-wrap msgid "BIB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:38 #, no-wrap msgid "" "BIB<, const struct timespec " "*>IB<);>\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:45 build/C/man2/semop.2:53 msgid "Feature Test Macro Requirements for glibc (see B(7)):" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:49 msgid "" "B(): _POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ " "E=\\ 600" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:59 msgid "" "B() decrements (locks) the semaphore pointed to by I. If " "the semaphore's value is greater than zero, then the decrement proceeds, and " "the function returns, immediately. If the semaphore currently has the value " "zero, then the call blocks until either it becomes possible to perform the " "decrement (i.e., the semaphore value rises above zero), or a signal handler " "interrupts the call." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:69 msgid "" "B() is the same as B(), except that if the decrement " "cannot be immediately performed, then call returns an error (I set to " "B) instead of blocking." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:82 msgid "" "B() is the same as B(), except that I " "specifies a limit on the amount of time that the call should block if the " "decrement cannot be immediately performed. The I argument " "points to a structure that specifies an absolute timeout in seconds and " "nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This " "structure is defined as follows:" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:89 #, no-wrap msgid "" "struct timespec {\n" " time_t tv_sec; /* Seconds */\n" " long tv_nsec; /* Nanoseconds [0 .. 999999999] */\n" "};\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:100 msgid "" "If the timeout has already expired by the time of the call, and the " "semaphore could not be locked immediately, then B() fails " "with a timeout error (I set to B)." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:108 msgid "" "If the operation can be performed immediately, then B() " "never fails with a timeout error, regardless of the value of " "I. Furthermore, the validity of I is not checked " "in this case." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:114 msgid "" "All of these functions return 0 on success; on error, the value of the " "semaphore is left unchanged, -1 is returned, and I is set to indicate " "the error." msgstr "" #. type: TP #: build/C/man3/sem_wait.3:115 build/C/man2/semop.2:352 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:119 msgid "The call was interrupted by a signal handler; see B(7)." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:126 msgid "The following additional error can occur for B():" msgstr "" #. type: TP #: build/C/man3/sem_wait.3:126 build/C/man2/semop.2:327 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:130 msgid "" "The operation could not be performed without blocking (i.e., the semaphore " "currently has the value zero)." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:133 msgid "The following additional errors can occur for B():" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:138 msgid "" "The value of I is less than 0, or greater than or " "equal to 1000 million." msgstr "" #. type: TP #: build/C/man3/sem_wait.3:138 #, no-wrap msgid "B" msgstr "" #. POSIX.1-2001 also allows EDEADLK -- "A deadlock condition #. was detected", but this does not occur on Linux(?). #. type: Plain text #: build/C/man3/sem_wait.3:143 msgid "The call timed out before the semaphore could be locked." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:151 msgid "" "The B(), B(), and B() functions are " "thread-safe." msgstr "" #. sem_wait() is always interrupted on most other implementations, #. but on FreeBSD 5.4 SA_RESTART does cause restarting. #. type: Plain text #: build/C/man3/sem_wait.3:161 msgid "" "A signal handler always interrupts a blocked call to one of these functions, " "regardless of the use of the B(2) B flag." msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:180 msgid "" "The (somewhat trivial) program shown below operates on an unnamed " "semaphore. The program expects two command-line arguments. The first " "argument specifies a seconds value that is used to set an alarm timer to " "generate a B signal. This handler performs a B(3) to " "increment the semaphore that is being waited on in I using " "B(). The second command-line argument specifies the length " "of the timeout, in seconds, for B(). The following shows " "what happens on two different runs of the program:" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:190 #, no-wrap msgid "" "$B< ./a.out 2 3>\n" "About to call sem_timedwait()\n" "sem_post() from handler\n" "sem_timedwait() succeeded\n" "$B< ./a.out 2 1>\n" "About to call sem_timedwait()\n" "sem_timedwait() timed out\n" msgstr "" #. type: SS #: build/C/man3/sem_wait.3:192 #, no-wrap msgid "Program source" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:203 #, no-wrap msgid "" "#include Eunistd.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esemaphore.hE\n" "#include Etime.hE\n" "#include Eassert.hE\n" "#include Eerrno.hE\n" "#include Esignal.hE\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:205 #, no-wrap msgid "sem_t sem;\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:208 #, no-wrap msgid "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:218 #, no-wrap msgid "" "static void\n" "handler(int sig)\n" "{\n" " write(STDOUT_FILENO, \"sem_post() from handler\\en\", 24);\n" " if (sem_post(&sem) == -1) {\n" " write(STDERR_FILENO, \"sem_post() failed\\en\", 18);\n" " _exit(EXIT_FAILURE);\n" " }\n" "}\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:225 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " struct sigaction sa;\n" " struct timespec ts;\n" " int s;\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:231 #, no-wrap msgid "" " if (argc != 3) {\n" " fprintf(stderr, \"Usage: %s Ealarm-secsE " "Ewait-secsE\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:234 #, no-wrap msgid "" " if (sem_init(&sem, 0, 0) == -1)\n" " handle_error(\"sem_init\");\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:236 #, no-wrap msgid " /* Establish SIGALRM handler; set alarm timer using argv[1] */\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:242 #, no-wrap msgid "" " sa.sa_handler = handler;\n" " sigemptyset(&sa.sa_mask);\n" " sa.sa_flags = 0;\n" " if (sigaction(SIGALRM, &sa, NULL) == -1)\n" " handle_error(\"sigaction\");\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:244 #, no-wrap msgid " alarm(atoi(argv[1]));\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:247 #, no-wrap msgid "" " /* Calculate relative interval as current time plus\n" " number of seconds given argv[2] */\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:250 #, no-wrap msgid "" " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n" " handle_error(\"clock_gettime\");\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:252 #, no-wrap msgid " ts.tv_sec += atoi(argv[2]);\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:256 #, no-wrap msgid "" " printf(\"main() about to call sem_timedwait()\\en\");\n" " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n" " continue; /* Restart if interrupted by handler */\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:258 #, no-wrap msgid " /* Check what happened */\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:266 #, no-wrap msgid "" " if (s == -1) {\n" " if (errno == ETIMEDOUT)\n" " printf(\"sem_timedwait() timed out\\en\");\n" " else\n" " perror(\"sem_timedwait\");\n" " } else\n" " printf(\"sem_timedwait() succeeded\\en\");\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:269 #, no-wrap msgid "" " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n" "}\n" msgstr "" #. type: Plain text #: build/C/man3/sem_wait.3:276 msgid "" "B(2), B(3), B(3), B(7), " "B