shm_unlink()

remove a shared memory object 

Realtime Function


SYNOPSIS

#include <sys/mman.h>

int shm_unlink(const char *name);


DESCRIPTION

The shm_unlink() function removes the name of the shared memory object named by the string pointed to by the name argument.

When 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.

Even if the object continues to exist after the last shm_unlink(), reuse of the name shall subsequently cause shm_open() to behave as if no shared memory object of this name exists (that is, shm_open() fails if O_CREAT is not set, or creates a new shared memory object if O_CREAT is set).


PARAMETERS

name 

Points to the name of a shared memory object.


RETURN VALUES

On success, shm_unlink() returns 0. On failure, it returns -1, the named shared memory object is not changed by this function call, and errno is set to one of the following:

EACCES 

Permission is denied to unlink the named shared memory object.

ENAMETOOLONG 

The length of the name argument is too long.

ENOENT 

The named shared memory object does not exist.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

When compiling programs that use this function, you must specify the -lrt option to cc or ld to ensure linking against the correct library.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
close(), mmap(), munmap(), shm_open(), shmat(), shmctl(), shmdt()


PTC MKS Toolkit 10.4 Documentation Build 39.