sem_destroy(3) — Subroutines
Digital
NAME
sem_destroy − Remove or destroy a specified binary semaphore set (P1003.4/D11)
SYNOPSIS
#include <binsem.h>
int sem_destroy (
const char ∗name);
PARAMETERS
∗name Points to the pathname of the binary semaphore set to be destroyed. Use the name argument originally supplied with the appropriate sem_mksem function.
DESCRIPTION
The sem_destroy function removes a link from a file, destroying the binary semaphore set named by name. If the binary semaphore set is open when a process calls the sem_destroy function, the binary semaphore set is not destroyed until the last sem_close function is complete. However, calls to sem_open after a call to the sem_destroy function will fail.
The potential for deadlock exists if a process calls sem_destroy for a binary semaphore set while there is a pending sem_wait, because a process may be waiting for a poster which has not yet opened the binary semaphore set.
RETURN VALUES
On successful completion, the function returns the value 0; otherwise, the function returns the value −1 and sets errno to indicate the error, without changing the file named in the name argument.
ERRORS
The sem_destroy function will fail under the following conditions:
[ENOENT] The binary semaphore set does not exist.
[ENOSYS] The function sem_destroy is not supported by this implementation.
[EPERM] The process lacks the appropriate privilege to destroy the specified binary semaphore set.
RELATED INFORMATION
Functions: fork(2), sem_close(3), sem_mksem(3), sem_open(3)