_KSEM(2)

_KSEM(2) | System Calls Manual | _KSEM(2)

# NAME

`_ksem`, `_ksem_init`, `_ksem_open`, `_ksem_close`, `_ksem_unlink`, `_ksem_destroy`, `_ksem_getvalue`, `_ksem_post`, `_ksem_wait`, `_ksem_timedwait`, `_ksem_trywait` — back-end implementation for POSIX semaphores

# SYNOPSIS

`#include <sys/ksem.h>`

int
`_ksem_init`(int value, intptr_t *idp);

int
`_ksem_open`(const char *name, int oflag, mode_t mode, unsigned int value, intptr_t *idp);

int
`_ksem_close`(intptr_t id);

int
`_ksem_unlink`(const char *name);

int
`_ksem_destroy`(intptr_t id);

int
`_ksem_getvalue`(intptr_t id, unsigned int *value);

int
`_ksem_post`(intptr_t id);

int
`_ksem_wait`(intptr_t id);

int
`_ksem_timedwait`(intptr_t id, const struct timespec *abstime);

int
`_ksem_trywait`(intptr_t id);

# DESCRIPTION

The `_ksem_*`() family of system calls provide the kernel implementation of POSIX semaphores.

# RETURN VALUES

Successful calls to the `_ksem_*`() system calls return a value of zero. Otherwise, -1 is returned and errno is set to provide more information.

# ERRORS

Please see the section 3 manual pages for specific error information.

# SEE ALSO

sem_close(3), sem_destroy(3), sem_getvalue(3), sem_init(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3), sem(4)

# HISTORY

Most of the `_ksem_*`() system calls first appeared in NetBSD 2.0. The `_ksem_timedwait`() system call first appeared in NetBSD 5.0.

November 30, 2015 | NetBSD 11.0