summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-06-14 19:55:25 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-06-14 19:55:25 +0000
commitcd373c5dc3dc20939e23c9ce15a4584d12a2c262 (patch)
tree71a5b0629479e8c10b326ff8e97b310dafef679c /lib
parentd2de5de218868161bb4fb45ca9790efd16219583 (diff)
Introducing adjfreq(2), to adjust the clock frequency.
Loosely based on dragonfly code. Man page help fro jmc@; ok deraadt@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/shlib_version2
-rw-r--r--lib/libc/sys/Makefile.inc8
-rw-r--r--lib/libc/sys/adjfreq.281
3 files changed, 87 insertions, 4 deletions
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 74f4fbf1ba6..48b7a8da18c 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,4 +1,4 @@
major=39
-minor=1
+minor=2
# note: If changes were made to include/thread_private.h or if system
# calls were added/changed then libpthread must also be updated.
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index a56664050ac..855ef5fcec7 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.77 2006/05/27 16:14:02 pedro Exp $
+# $OpenBSD: Makefile.inc,v 1.78 2006/06/14 19:55:24 otto Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -29,7 +29,8 @@ SRCS+= ftruncate.c lseek.c mquery.c mmap.c ptrace.c semctl.c truncate.c \
SRCS+= stack_protector.c
# modules with default implementations on all architectures:
-ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \
+ASM= accept.o access.o acct.o adjfreq.o adjtime.o bind.o chdir.o chflags.o \
+ chmod.o \
chown.o chroot.o clock_gettime.o clock_settime.o clock_getres.o \
close.o closefrom.o connect.o dup.o dup2.o execve.o fchdir.o \
fchflags.o fchmod.o fchown.o fcntl.o fhopen.o fhstat.o fhstatfs.o \
@@ -203,7 +204,8 @@ LintSysPseudoNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} -p \
-s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDO_NOERR}
-MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \
+MAN+= accept.2 access.2 acct.2 adjfreq.2 adjtime.2 bind.2 brk.2 chdir.2 \
+ chflags.2 \
chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 connect.2 \
dup.2 execve.2 _exit.2 fcntl.2 fhopen.2 \
flock.2 fork.2 fsync.2 getdirentries.2 \
diff --git a/lib/libc/sys/adjfreq.2 b/lib/libc/sys/adjfreq.2
new file mode 100644
index 00000000000..4cdbbe56596
--- /dev/null
+++ b/lib/libc/sys/adjfreq.2
@@ -0,0 +1,81 @@
+.\" $OpenBSD: adjfreq.2,v 1.1 2006/06/14 19:55:24 otto Exp $
+.\"
+.\" Copyright (c) 2006 Otto Moerbeek
+.\"
+.\" 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 REGENTS 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 REGENTS 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 June 13, 2006
+.Dt ADJFREQ 2
+.Os
+.Sh NAME
+.Nm adjfreq
+.Nd "correct the rate of the system clock"
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/time.h>
+.Ft int
+.Fn adjfreq "const int64_t *freq" "int64_t *oldfreq"
+.Sh DESCRIPTION
+.Fn adjfreq
+adjusts the rate in which time progresses if
+.Fa freq
+is non-null.
+The unit of the rate of adjustment is nanoseconds per second,
+shifted left 32 bits to allow for fractional values.
+.Pp
+If
+.Fa oldfreq
+is non-null, the current value is returned.
+.Sh RETURN VALUES
+A return value of 0 indicates that the call succeeded.
+A return value of \-1 indicates that an error occurred, and in this
+case an error code is stored in the global variable
+.Va errno .
+.Sh ERRORS
+.Fn adjfreq
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+Either of the arguments point outside the process's allocated address space.
+.It Bq Er EPERM
+The
+.Fa freq
+argument is non-null and the process's effective user ID is not that
+of the superuser.
+.El
+.Sh SEE ALSO
+.Xr date 1 ,
+.Xr adjtime 2 ,
+.Xr gettimeofday 2 ,
+.Xr ntpd 8 ,
+.Xr timed 8 ,
+.Xr timedc 8
+.Rs
+.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
+.%A R. Gusella
+.%A S. Zatti
+.Re
+.Sh HISTORY
+The
+.Fn adjfreq
+function call first appeared in
+.Ox 4.0 .