1sem_unlink(3C) Standard C Library Functions sem_unlink(3C)
2
3
4
6 sem_unlink - remove a named semaphore
7
9 #include <semaphore.h>
10
11 int sem_unlink(const char *name);
12
13
15 The sem_unlink() function removes the semaphore named by the string
16 name. If the semaphore named by name is currently referenced by other
17 processes, then sem_unlink() has no effect on the state of the sema‐
18 phore. If one or more processes have the semaphore open when
19 sem_unlink() is called, destruction of the semaphore is postponed until
20 all references to the semaphore have been destroyed by calls to
21 sem_close(3C), _Exit(2), or one of the exec functions (see exec(2)) .
22 Calls to sem_open(3C) to re-create or re-connect to the semaphore refer
23 to a new semaphore after sem_unlink() is called. The sem_unlink()
24 call does not block until all references have been destroyed; it
25 returns immediately.
26
28 Upon successful completion, sem_unlink() returns 0. Otherwise, the sem‐
29 aphore is not changed and the function returns a value of −1 and sets
30 errno to indicate the error.
31
33 The sem_unlink() function will fail if:
34
35 EACCES Permission is denied to unlink the named semaphore.
36
37
38 ENAMETOOLONG The length of name string exceeds PATH_MAX, or a path‐
39 name component is longer than NAME_MAX while
40 _POSIX_NO_TRUNC is in effect.
41
42
43 ENOENT The named semaphore does not exist.
44
45
46 ENOSYS The sem_unlink() function is not supported by the sys‐
47 tem.
48
49
51 See attributes(5) for descriptions of the following attributes:
52
53
54
55
56 ┌─────────────────────────────┬─────────────────────────────┐
57 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
58 ├─────────────────────────────┼─────────────────────────────┤
59 │Interface Stability │Committed │
60 ├─────────────────────────────┼─────────────────────────────┤
61 │MT-Level │MT-Safe │
62 ├─────────────────────────────┼─────────────────────────────┤
63 │Standard │See standards(5). │
64 └─────────────────────────────┴─────────────────────────────┘
65
67 exec(2), exit(2), sem_close(3C), sem_open(3C), attributes(5), stan‐
68 dards(5)
69
71 Solaris 2.6 was the first release to support the Asynchronous Input and
72 Output option. Prior to this release, this function always returned −1
73 and set errno to ENOSYS.
74
75
76
77SunOS 5.11 5 Feb 2008 sem_unlink(3C)