1SHM_UNLINK(3P)             POSIX Programmer's Manual            SHM_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
11

NAME

13       shm_unlink — remove a shared memory object (REALTIME)
14

SYNOPSIS

16       #include <sys/mman.h>
17
18       int shm_unlink(const char *name);
19

DESCRIPTION

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

RETURN VALUE

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

ERRORS

43       The shm_unlink() function shall fail if:
44
45       EACCES Permission is denied to unlink the named shared memory object.
46
47       ENOENT The named shared memory object does not exist.
48
49       The shm_unlink() function may fail if:
50
51       ENAMETOOLONG
52              The length of the name  argument  exceeds  {_POSIX_PATH_MAX}  on
53              systems   that   do  not  support  the  XSI  option  or  exceeds
54              {_XOPEN_PATH_MAX} on XSI systems, or has  a  pathname  component
55              that  is  longer  than  {_POSIX_NAME_MAX} on systems that do not
56              support the XSI option or longer than {_XOPEN_NAME_MAX}  on  XSI
57              systems.   A call to shm_unlink() with a name argument that con‐
58              tains the same shared memory object name as was previously  used
59              in a successful shm_open() call shall not give an [ENAMETOOLONG]
60              error.
61
62       The following sections are informative.
63

EXAMPLES

65       None.
66

APPLICATION USAGE

68       Names of memory objects that were allocated  with  open()  are  deleted
69       with  unlink()  in the usual fashion. Names of memory objects that were
70       allocated with shm_open() are deleted with shm_unlink().  Note that the
71       actual memory object is not destroyed until the last close and unmap on
72       it have occurred if it was already in use.
73

RATIONALE

75       None.
76

FUTURE DIRECTIONS

78       A future version might require the shm_open()  and  shm_unlink()  func‐
79       tions to have semantics similar to normal file system operations.
80

SEE ALSO

82       close(), mmap(), munmap(), shmat(), shmctl(), shmdt(), shm_open()
83
84       The Base Definitions volume of POSIX.1‐2008, <sys_mman.h>
85
87       Portions  of  this text are reprinted and reproduced in electronic form
88       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
89       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
90       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
91       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
92       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
93       event of any discrepancy between this version and the original IEEE and
94       The Open Group Standard, the original IEEE and The Open Group  Standard
95       is  the  referee document. The original Standard can be obtained online
96       at http://www.unix.org/online.html .
97
98       Any typographical or formatting errors that appear  in  this  page  are
99       most likely to have been introduced during the conversion of the source
100       files to man page format. To report such errors,  see  https://www.ker
101       nel.org/doc/man-pages/reporting_bugs.html .
102
103
104
105IEEE/The Open Group                  2013                       SHM_UNLINK(3P)
Impressum