up | Inhaltsverzeichniss | Kommentar

Manual page for sem_close(3R)

sem_close - close a named semaphore

SYNOPSIS

cc [ flag ... ] file ... -lposix4 [ library ... ]

#include <semaphore.h>

int sem_close(sem_t *sem);

typedef struct {
...
} sem_t; /*opaque POSIX.4 semaphore*/

MT-LEVEL

MT-Safe

DESCRIPTION

sem_close() is used to indicate that the calling process is finished using the named semaphore sem. sem_close() deallocates any system resources for use by this process for this semaphore. If the semaphore has not been removed with a successful call to sem_unlink.3r then sem_close() has no effect on the state of the semaphore. If sem_unlink.3r has been successfully invoked for name after the most recent call to sem_open.3r with O_CREAT for this semaphore, then when all processes that have opened the semaphore close it, the semaphore will no longer be accessible.

sem_close() should not be called for an unnamed semaphore initialized by sem_init.3r

RETURN VALUES

If successful, sem_close() returns 0, otherwise it returns -1 and sets errno to indicate the error condition.

ERRORS

EINVAL
sem is not a valid semaphore descriptor.
ENOSYS
sem_close() is not supported by this implementation.

SEE ALSO

sem_init.3r sem_open.3r sem_unlink.3r

BUGS

In Solaris 2.5, these functions always return -1 and set errno to ENOSYS, because this release does not support the Semaphores option. It is our intention to provide support for these interfaces in future releases.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97