Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys Update to match reality. For these functions, ...



details:   https://anonhg.NetBSD.org/src/rev/372a4a251608
branches:  trunk
changeset: 342130:372a4a251608
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Dec 07 23:20:57 2015 +0000

description:
Update to match reality.  For these functions, we still try the system
call first, and only fall back to /dev/clockctl if the system call
fails.

diffstat:

 lib/libc/sys/adjtime.2       |  15 ++++++++-------
 lib/libc/sys/clock_settime.2 |  15 ++++++++-------
 lib/libc/sys/gettimeofday.2  |  16 +++++++++-------
 lib/libc/sys/ntp_adjtime.2   |  19 +++++++++++++++++--
 4 files changed, 42 insertions(+), 23 deletions(-)

diffs (173 lines):

diff -r 38378e28eace -r 372a4a251608 lib/libc/sys/adjtime.2
--- a/lib/libc/sys/adjtime.2    Mon Dec 07 20:59:44 2015 +0000
+++ b/lib/libc/sys/adjtime.2    Mon Dec 07 23:20:57 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: adjtime.2,v 1.20 2004/05/13 10:20:57 wiz Exp $
+.\"    $NetBSD: adjtime.2,v 1.21 2015/12/07 23:20:57 pgoyette Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)adjtime.2  8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd December 8, 2015
 .Dt ADJTIME 2
 .Os
 .Sh NAME
@@ -77,19 +77,20 @@
 Such time servers would slow down the clocks of some machines
 and speed up the clocks of others to bring them to the average network time.
 .Pp
-If the calling user is not the super user, then the
+If the calling user is not the super user, the
+.Fn adjtime
+system call will fail, and the
 .Fn adjtime
 function in the standard C library will try to use the
 .Xr clockctl 4
-device if present, thus making possible for non privileged users to
+device if present, thus making it possible for non privileged users to
 adjust the system time.
 If
 .Xr clockctl 4
 is not present or not accessible, then
 .Fn adjtime
-reverts to the
-.Fn adjtime
-system call, which is restricted to the super user.
+returns
+.Er EPERM .
 .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
diff -r 38378e28eace -r 372a4a251608 lib/libc/sys/clock_settime.2
--- a/lib/libc/sys/clock_settime.2      Mon Dec 07 20:59:44 2015 +0000
+++ b/lib/libc/sys/clock_settime.2      Mon Dec 07 23:20:57 2015 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: clock_settime.2,v 1.22 2014/03/28 15:35:55 wiz Exp $
+.\" $NetBSD: clock_settime.2,v 1.23 2015/12/07 23:20:57 pgoyette Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 11, 1999
+.Dd December 8, 2016
 .Dt CLOCK_SETTIME 2
 .Os
 .Sh NAME
@@ -119,19 +119,20 @@
 identifies a clock that increments when the CPU is running in user
 or kernel mode on behalf of the calling process.
 .Pp
-If the calling user is not the super-user, then the
+If the calling user is not the super-user, the
+.Fn clock_settime
+system call will fail, and the
 .Fn clock_settime
 function in the standard C library will try to use the
 .Xr clockctl 4
-device if present, thus making possible for non privileged users to
+device if present, thus making it possible for non privileged users to
 set the system time.
 If
 .Xr clockctl 4
 is not present or not accessible, then
 .Fn clock_settime
-reverts to the
-.Fn clock_settime
-system call, which is restricted to the super user.
+returns
+.Er EPERM .
 .Sh RETURN VALUES
 A value of 0 is returned on success.
 Otherwise, a value of \-1 is returned and
diff -r 38378e28eace -r 372a4a251608 lib/libc/sys/gettimeofday.2
--- a/lib/libc/sys/gettimeofday.2       Mon Dec 07 20:59:44 2015 +0000
+++ b/lib/libc/sys/gettimeofday.2       Mon Dec 07 23:20:57 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: gettimeofday.2,v 1.27 2010/05/18 07:14:18 jruoho Exp $
+.\"    $NetBSD: gettimeofday.2,v 1.28 2015/12/07 23:20:57 pgoyette Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)gettimeofday.2     8.2 (Berkeley) 5/26/95
 .\"
-.Dd May 18, 2010
+.Dd December 8, 2016
 .Dt GETTIMEOFDAY 2
 .Os
 .Sh NAME
@@ -98,19 +98,21 @@
 .Fn gettimeofday
 will always return zeroes.
 .Pp
-If the calling user is not the super-user, then the
+The
+.Fn settimeofday
+system call is available only for the super-user.
+If the calling user is not the super-user, the system call will fail, and the
 .Fn settimeofday
 function in the standard C library will try to use the
 .Xr clockctl 4
-device if present, thus making possible for non privileged users to
+device if present, thus making it possible for non privileged users to
 set the system time.
 If
 .Xr clockctl 4
 is not present or not accessible, then
 .Fn settimeofday
-reverts to the
-.Fn settimeofday
-system call, which is restricted to the super user.
+returns
+.Er EPERM .
 .\" XXX uncomment when/if this is put into place!
 .\" If the system is running in secure mode (see
 .\" .Xr init 8 ),
diff -r 38378e28eace -r 372a4a251608 lib/libc/sys/ntp_adjtime.2
--- a/lib/libc/sys/ntp_adjtime.2        Mon Dec 07 20:59:44 2015 +0000
+++ b/lib/libc/sys/ntp_adjtime.2        Mon Dec 07 23:20:57 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ntp_adjtime.2,v 1.10 2009/05/18 09:28:51 wiz Exp $
+.\"    $NetBSD: ntp_adjtime.2,v 1.11 2015/12/07 23:20:57 pgoyette Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 22, 2007
+.Dd December 8, 2015
 .Dt NTP_ADJTIME 2
 .Os
 .Sh NAME
@@ -55,6 +55,21 @@
 .Fn ntp_adjtime
 function is used by the NTP daemon to adjust the system clock to an
 externally derived time.
+The
+.Fn ntp_adjtime
+system call is available only for the super user.
+If the system call fails, the
+.Fn ntp_adjtime
+function in the standard C library will try to use the
+.Xr clockctl 4 device if present, thus making it possible for the NTP
+daemon to run as a non-privileged user.
+If
+.X4 clockctl 4
+is not present,
+.Fn ntp_adjtime
+returns
+.Er EPERM .
+.Pp
 The time offset and related variables which are set by
 .Fn ntp_adjtime
 are used by



Home | Main Index | Thread Index | Old Index