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

NAME

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

SYNOPSIS

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

DESCRIPTION

20       The shm_unlink() function shall remove the name of  the  shared  memory
21       object named by the string pointed to by name.
22
23       If  one  or  more references to the shared memory object exist when the
24       object is unlinked, the  name  shall  be  removed  before  shm_unlink()
25       returns,  but  the removal of the memory object contents shall be post‐
26       poned until all open and map references to  the  shared  memory  object
27       have been removed.
28
29       Even  if the object continues to exist after the last shm_unlink(), re‐
30       use of the name shall subsequently cause shm_open() to behave as if  no
31       shared memory object of this name exists (that is, shm_open() will fail
32       if O_CREAT is not set, or will create a new  shared  memory  object  if
33       O_CREAT is set).
34

RETURN VALUE

36       Upon  successful completion, a value of zero shall be returned.  Other‐
37       wise, a value of -1 shall be returned and errno  set  to  indicate  the
38       error.  If  -1 is returned, the named shared memory object shall not be
39       changed by this function call.
40

ERRORS

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

EXAMPLES

64       None.
65

APPLICATION USAGE

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

RATIONALE

74       None.
75

FUTURE DIRECTIONS

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

SEE ALSO

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