1SEM_UNLINK(3P)             POSIX Programmer's Manual            SEM_UNLINK(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sem_unlink — remove a named semaphore
13

SYNOPSIS

15       #include <semaphore.h>
16
17       int sem_unlink(const char *name);
18

DESCRIPTION

20       The sem_unlink() function shall  remove  the  semaphore  named  by  the
21       string name.  If the semaphore named by name is currently referenced by
22       other processes, then sem_unlink() shall have no effect on the state of
23       the  semaphore.  If  one or more processes have the semaphore open when
24       sem_unlink() is called, destruction of the semaphore is postponed until
25       all  references  to  the  semaphore  have  been  destroyed  by calls to
26       sem_close(), _exit(), or exec.  Calls  to  sem_open()  to  recreate  or
27       reconnect  to the semaphore refer to a new semaphore after sem_unlink()
28       is called. The sem_unlink() call shall not block until  all  references
29       have been destroyed; it shall return immediately.
30

RETURN VALUE

32       Upon  successful  completion,  the sem_unlink() function shall return a
33       value of 0. Otherwise, the semaphore shall not be changed and the func‐
34       tion shall return a value of -1 and set errno to indicate the error.
35

ERRORS

37       The sem_unlink() function shall fail if:
38
39       EACCES Permission is denied to unlink the named semaphore.
40
41       ENOENT The named semaphore does not exist.
42
43       The sem_unlink() function may fail if:
44
45       ENAMETOOLONG
46              The  length  of  the  name argument exceeds {_POSIX_PATH_MAX} on
47              systems  that  do  not  support  the  XSI  option   or   exceeds
48              {_XOPEN_PATH_MAX}  on  XSI  systems, or has a pathname component
49              that is longer than {_POSIX_NAME_MAX} on  systems  that  do  not
50              support  the  XSI option or longer than {_XOPEN_NAME_MAX} on XSI
51              systems.  A call to sem_unlink() with a name argument that  con‐
52              tains  the  same semaphore name as was previously used in a suc‐
53              cessful sem_open() call shall not give an [ENAMETOOLONG] error.
54
55       The following sections are informative.
56

EXAMPLES

58       None.
59

APPLICATION USAGE

61       None.
62

RATIONALE

64       None.
65

FUTURE DIRECTIONS

67       A future version might require the sem_open()  and  sem_unlink()  func‐
68       tions to have semantics similar to normal file system operations.
69

SEE ALSO

71       semctl(), semget(), semop(), sem_close(), sem_open()
72
73       The Base Definitions volume of POSIX.1‐2017, <semaphore.h>
74
76       Portions  of  this text are reprinted and reproduced in electronic form
77       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
78       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
79       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
80       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
81       event of any discrepancy between this version and the original IEEE and
82       The  Open Group Standard, the original IEEE and The Open Group Standard
83       is the referee document. The original Standard can be  obtained  online
84       at http://www.opengroup.org/unix/online.html .
85
86       Any  typographical  or  formatting  errors that appear in this page are
87       most likely to have been introduced during the conversion of the source
88       files  to  man page format. To report such errors, see https://www.ker
89       nel.org/doc/man-pages/reporting_bugs.html .
90
91
92
93IEEE/The Open Group                  2017                       SEM_UNLINK(3P)
Impressum