From owner-freebsd-arch@FreeBSD.ORG Wed Nov 17 13:32:13 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CBF616A4CE for ; Wed, 17 Nov 2004 13:32:13 +0000 (GMT) Received: from postman.ripe.net (postman.ripe.net [193.0.0.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id B499F43D1D for ; Wed, 17 Nov 2004 13:32:12 +0000 (GMT) (envelope-from marks@ripe.net) Received: by postman.ripe.net (Postfix, from userid 8) id 1079924D8E; Wed, 17 Nov 2004 14:32:12 +0100 (CET) Received: from birch.ripe.net (birch.ripe.net [193.0.1.96]) by postman.ripe.net (Postfix) with ESMTP id 0C49324DCA for ; Wed, 17 Nov 2004 14:32:11 +0100 (CET) Received: from ripe.net (cow.ripe.net [193.0.1.239]) by birch.ripe.net (8.12.10/8.11.6) with SMTP id iAHDWALE023223 for ; Wed, 17 Nov 2004 14:32:10 +0100 Received: (nullmailer pid 55182 invoked by uid 1001); Wed, 17 Nov 2004 13:32:10 -0000 Date: Wed, 17 Nov 2004 14:32:10 +0100 From: Mark Santcroos To: freebsd-arch@freebsd.org Message-ID: <20041117133210.GA17117@laptop.6bone.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Handles: MS6-6BONE, MS18417-RIPE X-RIPE-Spam-Level: X-RIPE-Spam-Tests: ALL_TRUSTED,BAYES_00 X-RIPE-Spam-Status: N 0.005899 / -5.9 X-RIPE-Signature: 50dc45c1f8f4d5fe7bedaa4f7d7428a2 Subject: ntp_gettime(2) system call implementation X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2004 13:32:13 -0000 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