summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkleink <kleink@NetBSD.org>1999-02-11 15:20:47 +0000
committerkleink <kleink@NetBSD.org>1999-02-11 15:20:47 +0000
commit8c809f7e03aab166a0baa2f0d2a4cf352dd794cd (patch)
tree508bf1a36f664ab00d783787b4a43c0d9aee22cb /lib
parent1590f3bcdadfbfd6e7690ce6af4ed0d63a9d0312 (diff)
Document clock_settime(2) and friends.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc8
-rw-r--r--lib/libc/sys/clock_settime.2157
2 files changed, 162 insertions, 3 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index b199bc37612..287f74c67c9 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.87 1998/09/26 23:58:14 christos Exp $
+# $NetBSD: Makefile.inc,v 1.88 1999/02/11 15:20:47 kleink Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -170,8 +170,8 @@ LintSysPseudoNoerr.c: ${.CURDIR}/sys/makelintstub \
-s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR}
MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
- chflags.2 chmod.2 chown.2 chroot.2 close.2 connect.2 dup.2 \
- execve.2 _exit.2 fcntl.2 fdatasync.2 flock.2 fork.2 fsync.2 \
+ chflags.2 chmod.2 chown.2 chroot.2 clock_settime.c close.2 connect.2 \
+ dup.2 execve.2 _exit.2 fcntl.2 fdatasync.2 flock.2 fork.2 fsync.2 \
getdents.2 getdirentries.3 getfh.2 getfsstat.2 getgid.2 getgroups.2 \
getitimer.2 getlogin.2 getpeername.2 getpgrp.2 getpid.2 \
getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
@@ -196,6 +196,8 @@ MLINKS+=chdir.2 fchdir.2
MLINKS+=chflags.2 fchflags.2
MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2
+MLINKS+=clock_settime.2 clock_gettime.2
+MLINKS+=clock_settime.2 clock_getres.2
MLINKS+=getgid.2 getegid.2
MLINKS+=getitimer.2 setitimer.2
MLINKS+=getlogin.2 setlogin.2
diff --git a/lib/libc/sys/clock_settime.2 b/lib/libc/sys/clock_settime.2
new file mode 100644
index 00000000000..ce3f29b47f6
--- /dev/null
+++ b/lib/libc/sys/clock_settime.2
@@ -0,0 +1,157 @@
+.\" $NetBSD: clock_settime.2,v 1.1 1999/02/11 15:20:48 kleink Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Klaus Klein.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" 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 February 11, 1999
+.Dt CLOCK_SETTIME 2
+.Os NetBSD 1.3
+.Sh NAME
+.Nm clock_settime ,
+.Nm clock_gettime ,
+.Nm clock_getres
+.Nd clock and timer functions
+.Sh SYNOPSIS
+.Fd #include <time.h>
+.Ft int
+.Fn clock_settime "clockid_t clock_id" "const struct timespec *tp"
+.Ft int
+.Fn clock_gettime "clockid_t clock_id" "struct timespec *tp"
+.Ft int
+.Fn clock_getres "clockid_t clock_id" "struct timespec *res"
+.Sh DESCRIPTION
+The
+.Fn clock_settime
+function sets the clock identified by
+.Fa clock_id
+to the absolute time specified by
+.Fa tp .
+If the time specified by
+.Fa tp
+is not a multiple of the resolution of the clock,
+.Fa tp
+is truncated to a multiple of the resolution.
+.Pp
+.The
+.Fn clock_gettime
+function stores the time of the clock identified by
+.Fa clock_id
+into the location specified by
+.Fa tp.
+.Pp
+The
+.Fn clock_getres
+function stores the resolution of the clock identified by
+.Fa clock_id
+into the location specified by
+.Fa res ,
+unless
+.Fa res
+is
+.Dv NULL .
+.Pp
+A
+.Fa clock_id
+of
+.Dv CLOCK_REALTIME
+identifies the realtime clock for the system.
+For this clock, the values specified by
+.Fn clock_settime
+and obtained by
+.Fn clock_gettime
+represent the amount of time (in seconds and nanoseconds)
+since 00:00 Universal Coordinated Time, January 1, 1970.
+.Sh RETURN VALUES
+A value of 0 is returned on success. Otherwise, a value -1 is returned and
+.Dv errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn clock_settime ,
+.Fn clock_gettime
+and
+.Fn clock_getres
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa clock_id
+argument does not specify a known clock.
+.It Bq Er ENOSYS
+The function is not supported by this implementation.
+.El
+.Pp
+The
+.Fn clock_settime
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa tp
+argument is outside the range for the specified clock,
+.Fa clock_id .
+.It Bq Er EINVAL
+The
+.Fa tp
+argument specified a nanosecond value less than zero of greater than or equal
+1000 million.
+.It Bq Er EPERM
+The
+calling process does not have the appropriate privilege to set the specified
+clock,
+.Fa clock_id .
+.El
+.Pp
+The
+.Fn clock_gettime
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The
+.Fa tp
+argument specifies an address that is not a valid part of the process address
+space.
+.El
+.Sh SEE ALSO
+.Xr ctime 3 ,
+.Xr time 3
+.\" .Xr timer_gettime 3
+.Sh STANDARDS
+The
+.Fn clock_settime ,
+.Fn clock_gettime
+and
+.Fn clock_getres
+functions conform to
+.St -p1003.1b-93 .