xref: /netbsd-src/lib/libc/sys/_ksem.2 (revision 374d132d421701cfd9b06070a982aeb61995e96f)
1.\"	$NetBSD: _ksem.2,v 1.2 2015/11/29 21:38:10 wiz Exp $
2.\"
3.\" Copyright (c) 2015 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25.\" POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd November 30, 2015
28.Dt _KSEM 2
29.Os
30.Sh NAME
31.Nm _ksem ,
32.Nm _ksem_init ,
33.Nm _ksem_open ,
34.Nm _ksem_close ,
35.Nm _ksem_unlink ,
36.Nm _ksem_destroy ,
37.Nm _ksem_getvalue ,
38.Nm _ksem_post ,
39.Nm _ksem_wait ,
40.Nm _ksem_timedwait ,
41.Nm _ksem_trywait
42.Nd back-end implementation for POSIX semaphores
43.Sh SYNOPSIS
44.In sys/ksem.h
45.Ft int
46.Fn _ksem_init "int value" "intptr_t *idp"
47.Ft int
48.Fn _ksem_open "const char *name" "int oflag" "mode_t mode" "unsigned int value" "intptr_t *idp"
49.Ft int
50.Fn _ksem_close "intptr_t id"
51.Ft int
52.Fn _ksem_unlink "const char *name"
53.Ft int
54.Fn _ksem_destroy "intptr_t id"
55.Ft int
56.Fn _ksem_getvalue "intptr_t id" "unsigned int *value"
57.Ft int
58.Fn _ksem_post "intptr_t id"
59.Ft int
60.Fn _ksem_wait "intptr_t id"
61.Ft int
62.Fn _ksem_timedwait "intptr_t id" "const struct timespec *abstime"
63.Ft int
64.Fn _ksem_trywait "intptr_t id"
65.Sh DESCRIPTION
66The
67.Fn _ksem_*
68family of system calls provide the kernel implementation of POSIX
69semaphores.
70.Sh RETURN VALUES
71Successful calls to the
72.Fn _ksem_*
73system calls return a value of zero.
74Otherwise, \-1 is returned and
75.Va errno
76is set to provide more information.
77.Sh ERRORS
78Please see the section 3 manual pages for specific error information.
79.Sh SEE ALSO
80.Xr sem_close 3 ,
81.Xr sem_destroy 3 ,
82.Xr sem_getvalue 3 ,
83.Xr sem_init 3 ,
84.Xr sem_open 3 ,
85.Xr sem_post 3 ,
86.Xr sem_unlink 3 ,
87.Xr sem_wait 3 ,
88.Xr sem 4
89.Sh HISTORY
90Most of the
91.Fn _ksem_*
92system calls first appeared in
93.Nx 2.0 .
94The
95.Fn _ksem_timedwait
96system call first appeared in
97.Nx 5.0 .
98