summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2015-11-29 06:10:01 +0000
committerpgoyette <pgoyette@NetBSD.org>2015-11-29 06:10:01 +0000
commitc6e83f46f8c4c0b0336897b76332300a6180fda3 (patch)
tree5d0c182f76b2c9f9d33ee85cced28a451273b55e /lib
parent62e42e33ba90d85f8dbae3463151d4cd50499690 (diff)
Initial documentation of the internal syscalls that implement the librt
posix semaphores. As requested in PR kern/37427 XXX Feel free to expand this page!
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc14
-rw-r--r--lib/libc/sys/_ksem.297
2 files changed, 109 insertions, 2 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index e75f54063a2..733cba2bc8f 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.227 2015/01/31 23:10:56 christos Exp $
+# $NetBSD: Makefile.inc,v 1.228 2015/11/29 06:10:01 pgoyette Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -249,7 +249,7 @@ MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
getitimer.2 getlogin.2 getpeername.2 getpgrp.2 getpid.2 \
getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
getsockopt.2 gettimeofday.2 getuid.2 intro.2 ioctl.2 issetugid.2 \
- kill.2 kqueue.2 ktrace.2 \
+ kill.2 kqueue.2 ktrace.2 _ksem.2 \
lfs_bmapv.2 lfs_markv.2 lfs_segclean.2 lfs_segwait.2 \
link.2 listen.2 lseek.2 \
_lwp_create.2 _lwp_ctl.2 _lwp_detach.2 _lwp_exit.2 \
@@ -321,6 +321,16 @@ MLINKS+=gettimeofday.2 settimeofday.2
MLINKS+=getuid.2 geteuid.2
MLINKS+=intro.2 errno.2
MLINKS+=kqueue.2 kevent.2
+MLINKS+=_ksem.2 _ksem_open.2
+MLINKS+=_ksem.2 _ksem_close.2
+MLINKS+=_ksem.2 _ksem_init.2
+MLINKS+=_ksem.2 _ksem_destroy.2
+MLINKS+=_ksem.2 _ksem_getvalue.2
+MLINKS+=_ksem.2 _ksem_post.2
+MLINKS+=_ksem.2 _ksem_wait.2
+MLINKS+=_ksem.2 _ksem_timedwait.2
+MLINKS+=_ksem.2 _ksem_trywait.2
+MLINKS+=_ksem.2 _ksem_unlink.2
MLINKS+=ktrace.2 fktrace.2
MLINKS+=lseek.2 seek.2
MLINKS+=link.2 linkat.2
diff --git a/lib/libc/sys/_ksem.2 b/lib/libc/sys/_ksem.2
new file mode 100644
index 00000000000..a9a2b2530bf
--- /dev/null
+++ b/lib/libc/sys/_ksem.2
@@ -0,0 +1,97 @@
+.\" $NetBSD: _ksem.2,v 1.1 2015/11/29 06:10:01 pgoyette Exp $
+.\"
+.\" Copyright (c) 2015 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd November 30, 2015
+.Dt _KSEM 2
+.Os
+.Sh NAME
+.Nm _ksem ,
+.Nm _ksem_init ,
+.Nm _ksem_open ,
+.Nm _ksem_close ,
+.Nm _ksem_unlink ,
+.Nm _ksem_destroy ,
+.Nm _ksem_getvalue ,
+.Nm _ksem_post ,
+.Nm _ksem_wait ,
+.Nm _ksem_timedwait ,
+.Nm _ksem_trywait
+.Nd back-end implementation for POSIX semaphores
+.Sh SYNOPSIS
+.In sys/ksem.h
+.Ft int
+.Fn _ksem_init "int value" "intptr_t *idp"
+.Ft int
+.Fn _ksem_open "const char *name" "int oflag" "mode_t mode" "unsigned int value" "intptr_t *idp"
+.Ft int
+.Fn _ksem_close "intptr_t id"
+.Ft int
+.Fn _ksem_unlink "const char *name"
+.Ft int
+.Fn _ksem_destroy "intptr_t id"
+.Ft int
+.Fn _ksem_getvalue "intptr_t id" "unsigned int *value"
+.Ft int
+.Fn _ksem_post "intptr_t id"
+.Ft int
+.Fn _ksem_wait "intptr_t id"
+.Ft int
+.Fn _ksem_timedwait "intptr_t id" "const struct timespec *abstime"
+.Ft int
+.Fn _ksem_trywait "intptr_t id"
+.Sh DESCRIPTION
+The
+.Fn _ksem_*
+family of system calls provide the kernel implementation of POSIX
+semaphores.
+.Sh RETURN VALUES
+Successful calls to the
+.Fn _ksem_*
+system calls return a value of zero.
+Otherwise, \-1 is returned and
+.Va errno
+is set to provide more information.
+.Sh ERRORS
+Please see the section 3 manual pages for specific error information.
+.Sh SEE ALSO
+.Xr sem_close 3 ,
+.Xr sem_destroy 3 ,
+.Xr sem_getvalue 3 ,
+.Xr sem_init 3 ,
+.Xr sem_open 3 ,
+.Xr sem_post 3 ,
+.Xr sem_unlink 3 ,
+.Xr sem_wait 3 ,
+.Xr sem 4
+.Sh HISTORY
+Most of the
+.Fn _ksem_*
+system calls first appeared in
+.Nx 2.0 .
+The
+.Fn _ksem_timedwait
+system call first appeared in
+.Nx 5.0 .