Removes a shared memory object.
Standard C Library (libc.a)
#include <sys/mman.h>
int shm_unlink (name)
const char *name;
The shm_unlink subroutine removes the name of the shared memory object named by the string pointed to by the name parameter.
If one or more references to the shared memory object exist when the object is unlinked, the name is removed before the shm_unlink subroutine 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.
Even if the object continues to exist after the last shm_unlink call, reuse of the name subsequently causes the shm_open subroutine to behave as if no shared memory object of this name exists. In other words, the shm_open subroutine will fail if O_CREAT is not set, or will create a new shared memory object if O_CREAT is set.
Item | Description |
---|---|
name | Specifies the name of the shared memory object to be unlinked. |
Upon successful completion, zero is returned. Otherwise, -1 is returned and errno is set to indicate the error. If -1 is returned, the named shared memory object is not changed by the subroutine call.
Item | Description |
---|---|
EACCES | Permission is denied to unlink the named shared memory object. |
EFAULT | The name parameter points outside of the allocated address space of the process. |
EINVAL | The name parameter is an empty name string, or is missing. |
ENAMETOOLONG | The length of the name parameter exceeds PATH_MAX or a pathname component is longer than NAME_MAX. |
ENOENT | The named shared memory object does not exist. |
ENOTSUP | This function is not supported with processes that have been checkpoint-restart'ed. |