]> git.saurik.com Git - apple/xnu.git/blob - bsd/man/man2/sem_unlink.2
xnu-6153.121.1.tar.gz
[apple/xnu.git] / bsd / man / man2 / sem_unlink.2
1 .\" $Darwin$
2 .\"
3 .\" Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4 .\"
5 .\" @APPLE_LICENSE_HEADER_START@
6 .\"
7 .\" The contents of this file constitute Original Code as defined in and
8 .\" are subject to the Apple Public Source License Version 1.1 (the
9 .\" "License"). You may not use this file except in compliance with the
10 .\" License. Please obtain a copy of the License at
11 .\" http://www.apple.com/publicsource and read it before using this file.
12 .\"
13 .\" This Original Code and all software distributed under the License are
14 .\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 .\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
18 .\" License for the specific language governing rights and limitations
19 .\" under the License.
20 .\"
21 .\" @APPLE_LICENSE_HEADER_END@
22 .\"
23 .Dd June 8, 2000
24 .Dt SEM_UNLINK 2
25 .Os Darwin
26 .Sh NAME
27 .Nm sem_unlink
28 .Nd remove a named semaphore
29 .Sh SYNOPSIS
30 .Fd #include <semaphore.h>
31 .Ft int
32 .Fn sem_unlink "const char *name"
33 .Sh DESCRIPTION
34 The named semaphore named
35 .Fa name
36 is removed. If the semaphore is in use by other processes, then
37 .Fa name
38 is immediately disassociated with the semaphore, but the semaphore
39 itself will not be removed until all references to it have been
40 closed. Subsequent calls to
41 .Fn sem_open
42 using
43 .Fa name
44 will refer to or create a new semaphore named
45 .Fa name .
46 .Pp
47 If successful,
48 .Fn sem_unlink
49 will return 0. Otherwise, -1 is returned and
50 .Va errno
51 is set, and the state of the semaphore is unchanged.
52 .Sh ERRORS
53 .Fn sem_unlink
54 succeeds unless:
55 .Bl -tag -width Er
56 .It Bq Er EACCES
57 Permission is denied to be remove the semaphore.
58 .It Bq Er ENAMETOOLONG
59 .Fa name
60 exceeded
61 .Dv PSEMNAMLEN
62 characters.
63 .It Bq Er ENOENT
64 The named semaphore does not exist.
65 .El
66 .Sh SEE ALSO
67 .Xr sem_close 2 ,
68 .Xr sem_open 2 ,
69 .Xr semctl 2 ,
70 .Xr semget 2 ,
71 .Xr semop 2
72 .Sh HISTORY
73 .Fn sem_unlink
74 is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).