1SHM_UNLINK(3P) POSIX Programmer's Manual SHM_UNLINK(3P)
2
3
4
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
12 shm_unlink - remove a shared memory object (REALTIME)
13
15 #include <sys/mman.h>
16
17 int shm_unlink(const char *name);
18
19
21 The shm_unlink() function shall remove the name of the shared memory
22 object named by the string pointed to by name.
23
24 If one or more references to the shared memory object exist when the
25 object is unlinked, the name shall be removed before shm_unlink()
26 returns, but the removal of the memory object contents shall be post‐
27 poned until all open and map references to the shared memory object
28 have been removed.
29
30 Even if the object continues to exist after the last shm_unlink(), re‐
31 use of the name shall subsequently cause shm_open() to behave as if no
32 shared memory object of this name exists (that is, shm_open() will fail
33 if O_CREAT is not set, or will create a new shared memory object if
34 O_CREAT is set).
35
37 Upon successful completion, a value of zero shall be returned. Other‐
38 wise, a value of -1 shall be returned and errno set to indicate the
39 error. If -1 is returned, the named shared memory object shall not be
40 changed by this function call.
41
43 The shm_unlink() function shall fail if:
44
45 EACCES Permission is denied to unlink the named shared memory object.
46
47 ENAMETOOLONG
48 The length of the name argument exceeds {PATH_MAX} or a pathname
49 component is longer than {NAME_MAX}.
50
51 ENOENT The named shared memory object does not exist.
52
53
54 The following sections are informative.
55
57 None.
58
60 Names of memory objects that were allocated with open() are deleted
61 with unlink() in the usual fashion. Names of memory objects that were
62 allocated with shm_open() are deleted with shm_unlink(). Note that the
63 actual memory object is not destroyed until the last close and unmap on
64 it have occurred if it was already in use.
65
67 None.
68
70 None.
71
73 close(), mmap(), munmap(), shmat(), shmctl(), shmdt(), shm_open(), the
74 Base Definitions volume of IEEE Std 1003.1-2001, <sys/mman.h>
75
77 Portions of this text are reprinted and reproduced in electronic form
78 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79 -- Portable Operating System Interface (POSIX), The Open Group Base
80 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
81 Electrical and Electronics Engineers, Inc and The Open Group. In the
82 event of any discrepancy between this version and the original IEEE and
83 The Open Group Standard, the original IEEE and The Open Group Standard
84 is the referee document. The original Standard can be obtained online
85 at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group 2003 SHM_UNLINK(3P)