Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

clockctl(4) [netbsd man page]

CLOCKCTL(4)						   BSD Kernel Interfaces Manual 					       CLOCKCTL(4)

clockctl -- Clock subsystem user control SYNOPSIS
pseudo-device clockctl DESCRIPTION
The clockctl interface brings clock control to non-root users. Any user with write access to /dev/clockctl will be able to perform opera- tions such as settimeofday(2), clock_settime(2), adjtime(2), or ntp_adjtime(2), which are normally restricted to the super-user. Using the clockctl pseudo-device, it is possible to run daemons such as ntpd(8) as non-privileged users, thus reducing the security exposure if a com- promise is found in such a daemon. The clockctl pseudo-device driver provides an ioctl(2) call for each privileged clock-related system call. The system call stubs in C library will use the ioctl(2) on /dev/clockctl if the special file is present and accessible, or will revert to the plain super-user- restricted system call if the special file is not accessible. The following ioctl(2) calls are defined in <sys/clockctl.h>: CLOCKCTL_SETTIMEOFDAY This will run the settimeofday(2) system call. Argument should be a pointer to a struct clockctl_settimeofday: struct clockctl_settimeofday { const struct timeval *tv; const void *tzp; }; CLOCKCTL_CLOCK_SETTIME This will run the clock_settime(2) system call. Argument should be a pointer to a struct clockctl_clock_settime: struct clockctl_clock_settime { clockid_t clock_id; struct timespec *tp; }; CLOCKCTL_ADJTIME This will run the adjtime(2) system call. Argument should be a pointer to a struct clockctl_adjtime: struct clockctl_adjtime { const struct timeval *delta; struct timeval *olddelta; }; CLOCKCTL_NTP_ADJTIME This will run the ntp_adjtime(2) system call. Argument should be a pointer to a struct clockctl_ntp_adjtime: struct clockctl_ntp_adjtime { struct timex *tp; }; SEE ALSO
adjtime(2), clock_settime(2), ioctl(2), settimeofday(2) HISTORY
clockctl appeared in NetBSD 1.6. BSD
February 19, 2009 BSD

Check Out this Related Man Page

ADJTIME(2)						      BSD System Calls Manual							ADJTIME(2)

adjtime -- correct the time to allow synchronization of the system clock LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/time.h> int adjtime(const struct timeval *delta, struct timeval *olddelta); DESCRIPTION
adjtime() makes small adjustments to the system time, as returned by gettimeofday(2), advancing or retarding it by the time specified by the timeval delta. If delta is negative, the clock is slowed down by incrementing it more slowly than normal until the correction is complete. If delta is positive, a larger increment than normal is used. The skew used to perform the correction is generally a fraction of one per- cent. Thus, the time is always a monotonically increasing function. A time correction from an earlier call to adjtime() may not be finished when adjtime() is called again. If olddelta is non-nil, the structure pointed to will contain, upon return, the number of microseconds still to be corrected from the earlier call. This call may be used by time servers that synchronize the clocks of computers in a local area network. 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. If the calling user is not the super user, then the adjtime() function in the standard C library will try to use the clockctl(4) device if present, thus making possible for non privileged users to adjust the system time. If clockctl(4) is not present or not accessible, then adjtime() reverts to the adjtime() system call, which is restricted to the super user. 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 errno. ERRORS
adjtime() will fail if: [EFAULT] An argument points outside the process's allocated address space. [EPERM] The process's effective user ID is not that of the super user. SEE ALSO
date(1), gettimeofday(2), clockctl(4), timed(8), timedc(8) R. Gusella and S. Zatti, TSP: The Time Synchronization Protocol for UNIX 4.3BSD. HISTORY
The adjtime() function call appeared in 4.3BSD. BSD
June 4, 1993 BSD
Man Page