1.\" $NetBSD: clockctl.4,v 1.4 2002/08/20 15:47:46 wiz Exp $ 2.\" 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Emmanuel Dreyfus. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd October 20, 2001 38.Dt CLOCKCTL 4 39.Os 40.Sh NAME 41.Nm clockctl 42.Nd Clock subsystem user control 43.Sh SYNOPSIS 44.Cd pseudo-device clockctl 45.Sh DESCRIPTION 46The 47.Nm 48interface brings clock control to non-root users. Any user with write access 49to 50.Pa /dev/clockctl 51will be able to perform operations such as 52.Xr settimeofday 2 , 53.Xr clock_settime 2 , 54.Xr adjtime 2 , 55or 56.Xr ntp_adjtime 2 , 57which are normally restricted to the super-user. Using the 58.Nm 59pseudo-device, it is possible to run daemons such as 60.Xr ntpd 8 61as non-privileged users, thus reducing the security exposure if a 62compromise is found in such a daemon. 63.Pp 64The 65.Nm 66pseudo-device driver provides an 67.Xr ioctl 2 68call for each privileged clock-related system call. The system 69call stubs in C library will use the 70.Xr ioctl 2 71on 72.Pa /dev/clockctl 73if the special file is present and accessible, or will revert to the 74plain super-user-restricted system call if the special file is not accessible. 75.Pp 76The following 77.Xr ioctl 2 78calls are defined in 79.Aq Pa sys/clockctl.h : 80.Bl -tag -width CLOCKCTL 81.It Dv CLOCKCTL_SETTIMEOFDAY 82This will run the 83.Xr settimeofday 2 84system call. Argument should be a pointer to a 85.Va struct clockctl_settimeofday_args : 86.Bd -literal 87struct clockctl_settimeofday_args { 88 struct timeval tv; 89 struct timezone tzp; 90}; 91.Ed 92.It Dv CLOCKCTL_CLOCK_SETTIME 93This will run the 94.Xr clock_settime 2 95system call. Argument should be a pointer to a 96.Va struct clockctl_clock_settime_args : 97.Bd -literal 98struct clockctl_clock_settime_args { 99 clockid_t clock_id; 100 struct timespec tp; 101}; 102.Ed 103.It Dv CLOCKCTL_ADJTIME 104This will run the 105.Xr adjtime 2 106system call. Argument should be a pointer to a 107.Va struct clockctl_adjtime_args : 108.Bd -literal 109struct clockctl_adjtime_args { 110 struct timeval delta; 111 struct timeval olddelta; 112}; 113.Ed 114.It Dv CLOCKCTL_NTP_ADJTIME 115This will run the 116.Xr ntp_adjtime 2 117system call. Argument should be a pointer to a 118.Va struct clockctl_ntp_adjtime_args : 119.Bd -literal 120struct clockctl_ntp_adjtime_args { 121 struct timex tp; 122}; 123.Ed 124.El 125.Sh SEE ALSO 126.Xr adjtime 2 , 127.Xr clock_settime 2 , 128.Xr ioctl 2 , 129.Xr settimeofday 2 130.Sh HISTORY 131.Nm 132appeared in 133.Nx 1.6 . 134