Date: Wed, 17 Nov 2004 14:32:10 +0100 From: Mark Santcroos <marks@ripe.net> To: freebsd-arch@freebsd.org Subject: ntp_gettime(2) system call implementation Message-ID: <20041117133210.GA17117@laptop.6bone.nl>
next in thread | raw e-mail | index | archive | help
Background: Since the early days in FreeBSD, ntp_gettime(2) is hacked as a libc wrapper around sysctlbyname(3). I propose to convert it into a system call. The patch[1] adds the ntp_gettime system call, preserving the sysctl behavior for now. However, I want to investigate at some point to get rid of it in -CURRENT, if we can work out libc compat issues. The output of my test program[2] is as follows: # time ./ntp_gettime-test -ctl 10000000 13.804u 66.966s 1:24.21 95.9% 5+168k 0+0io 0pf+0w # time ./ntp_gettime-test -call 10000000 4.917u 19.035s 0:24.66 97.0% 5+168k 0+0io 0pf+0w So the system call is also ~3x as fast as the sysctl version (for various reasons both in userspace and kernelspace). As far as the syscall number is concerned, NetBSD and OpenBSD both use 175, but that is already used in FreeBSD. However, in src/sys/compat/svr4/syscalls.master, 248 is used. So I choose to go for that. I don't feel strongly about that though, so any number would be fine for me. Comments welcome, especially about the compat issues later on. Mark [1] http://www.santcroos.net/mark/freebsd/files/ntp_gettime.diff [2] http://www.santcroos.net/mark/freebsd/files/ntp_gettime-test.c -- RIPE NCC - Delft University of Technology - The FreeBSD Project marks@ripe.net - m.a.santcroos@ewi.tudelft.nl - marks@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041117133210.GA17117>