Current-Users archive

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

Re: clockctl(4) vs settimeofday(2)



In article <Pine.NEB.4.64.1512071017540.14191%vps1.whooppee.com@localhost>,
Paul Goyette  <paul%whooppee.com@localhost> wrote:
>According to the clockctl(4) man page, operations on system time should
>first try the /dev/clockctl device, and only fall-back to the syscall()
>if the device is not available:
>
> 	... 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.
>
>However, looking at the source file for lib/libc/sys/settimeofday.c we
>have the following comment which says that we first try the syscall()
>and only use the /dev/clockctl mechanism if the syscall() fails:
>
>int
>settimeofday(const struct timeval *tv, const void *tzp)
>{
>         struct clockctl_settimeofday args;
>         int rv;
>
>         /*
>          * try syscal first and attempt to switch to clockctl
>          * if that fails with EPERM
>          */
>
>Which of these is correct?  And which needs to be updated?

Using the syscall is simpler and cheaper, so I think the man page should
be updated.

christos



Home | Main Index | Thread Index | Old Index