SHM_UNLINK(3) Library Functions Manual SHM_UNLINK(3)

shm_unlinkremove a shared memory object (REALTIME)

#include <sys/mman.h>

int shm_unlink(const char * name);

The shm_unlink() function removes the name of the shared memory object named by the string pointed to by name . If one or more references to the shared memory object exist when the object is unlinked, the name is removed before shm_unlink() returns, but the removal of the memory object contents is postponed until all open and map references to the shared memory object have been removed.

Upon successful completion, a value of zero is returned. Otherwise, a value of -1 is returned and errno will be set to indicate the error. If -1 is returned, the named shared memory object will not be changed by this function call.

The shm_unlink() function will fail if:

Permission is denied to unlink the named shared memory object.
The length of the name string exceeds {NAME_MAX} while _POSIX_NO_TRUNC is in effect.
The named shared memory object does not exist.
The function shm_unlink() is not supported by this implementation.

None.

None.

None.

close(3) , mmap(3) , munmap(3) , shmat(3) , shmctl(3) , shmdt(3) , shm_open(3) , <sys/mman.h> .

Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995)

February 1997 posix.fail