Current-Users archive

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

Re: clockctl(4) vs settimeofday(2)

On Mon, 7 Dec 2015, Christos Zoulas wrote:

On Dec 7,  9:56am, (Rich Neswold) wrote:
-- Subject: Re: clockctl(4) vs settimeofday(2)

| > Using the syscall is simpler and cheaper, so I think the man page should
| > be updated.
| Is settimeofday() called frequently enough that "cheaper" is a concern?
| What is more correct (I don't know the answer)?

If you know that you are not going to succeed (because you are not
root), you should cache the fd, and just do the ioctl each time
you want to sync to reduce latency.  The dumb caller is probably
an old program that probably is used to be running as root, so
reducing the delay/overhead for it by trying syscall first is better.

Yes, the current syscall stub checks to see if it has a cached fd, and
if so uses it.

If not, it tries the syscall first, and falls back to /dev/clockctl if
the syscall fails.

This approach makes sense, so I will treat the code as "definitive"
and I will update the man pages accordingly.

| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at |

Home | Main Index | Thread Index | Old Index