From nobody@FreeBSD.org  Thu Dec 14 19:25:18 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8B26716A40F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Dec 2006 19:25:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 02B8D43CAE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Dec 2006 19:21:53 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kBEJNSMG009546
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Dec 2006 19:23:28 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id kBEJNSXf009545;
	Thu, 14 Dec 2006 19:23:28 GMT
	(envelope-from nobody)
Message-Id: <200612141923.kBEJNSXf009545@www.freebsd.org>
Date: Thu, 14 Dec 2006 19:23:28 GMT
From: Judah Levine<jlevine@boulder.nist.gov>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ntp functions return wrong values
X-Send-Pr-Version: www-3.0

>Number:         106726
>Category:       bin
>Synopsis:       ntpd(8): ntp functions return wrong values
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 14 19:30:11 GMT 2006
>Closed-Date:    Tue May 31 15:32:21 UTC 2011
>Last-Modified:  Tue May 31 15:32:21 UTC 2011
>Originator:     Judah Levine
>Release:        6.1
>Organization:
NIST/University of Colorado
>Environment:
FreeBSD lap.colorado.edu 6.1-RELEASE /usr/src/sys/i386/compile/LAP
The system is a standard Dell system with full 6.1 installation from the CDs.
>Description:
The system calls ntp_gettime() and ntp_adjtime() return incorrect values.
This problem is new to 6.1 -- the same subroutines called from the identical
user program worked correctly in 5.1, the previous version that I was using.

I reported this problem directly to poul-henning kamp some time ago, but
I have not had a reply.

I am prepared to try and fix the problem myself, but I think the problem
is in ntp_gettime(), which I think is in libc. I have all of the CDs but
I can't find the source code for libc. Can you tell me where this code
is located? 
>How-To-Repeat:
A call to ntp_gettime will return the status of the call rather than the
status of the clock, which is how it is supposed to work. the return
status is -1 with an errno of 55.
>Fix:
?
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Judah Levine <jlevine@boulder.nist.gov>
Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: kern/106726: ntp functions return wrong values
Date: Fri, 15 Dec 2006 22:04:39 +1100 (EST)

 On Thu, 14 Dec 2006, Judah Levine wrote:
 
 >> Description:
 > The system calls ntp_gettime() and ntp_adjtime() return incorrect values. This problem is new to 6.1 -- the same subroutines called from the identical user program worked correctly in 5.1, the previous version that I was using.
 
 The API certainly changed.
 
 > I am prepared to try and fix the problem myself, but I think the problem is in ntp_gettime(), which I think is in libc. I have all of the CDs but I can't find the source code for libc. Can you tell me where this code is located?
 
 net_gettime(2) is now a syscall so it is in the kernel (kern_ntptime.c).
 This syscall is normal -- it just copies out the result and returns 0
 on success and -1/errno on error.  This behaviour is documented.
 
 I can't find any documentation for the old library function ntp_gettoime(3).
 It returns tv.time_state on success and TIME_ERROR on error.  This API is
 bogus:
 - there is no need to return tv.time_state on success since the whole tv
    is returned then
 - TIME_ERROR is a strange error code.  It is 5.
 - the error may be a sysctl error that is unrelated to ntp.
 I hope nothing requires this.
 
 >> How-To-Repeat:
 > A call to ntp_gettime will return the status of the call rather than the status of the clock, which is how it is supposed to work. the return status is -1 with an errno of 55.
 
 Really -1/55?  -1 indicates coplete failure, and 55 is ENOBUFS.  The
 possible errnos for the syscall version are undocumented, but I think
 they don't include ENOBUFS.  I think the only possible errors are
 ENOSYS if the syscall is missing and EFAULT if the user address is
 invalid.
 
 Old binaries using the old library version should still work, since
 the sysctl used by the old library version is still supported.  They
 work for me.  I use a not-so-old userland with certain old library
 calls including ntp_gettime(3), with kernels between RELENG_4 and
 -current, and the not-so-old ntpd works for all of these with no
 problems.
 
 Bruce
State-Changed-From-To: open->feedback 
State-Changed-By: jh 
State-Changed-When: Sun May 29 14:14:55 UTC 2011 
State-Changed-Why:  
Is this still a problem for you? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106726 
State-Changed-From-To: feedback->closed 
State-Changed-By: jh 
State-Changed-When: Tue May 31 15:29:37 UTC 2011 
State-Changed-Why:  
Feedback from submitter suggests that there is no reason to keep this 
open any longer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106726 
>Unformatted:
