NetBSD Problem Report #25331

Received: (qmail 24050 invoked by uid 605); 26 Apr 2004 11:10:23 -0000
Message-Id: <20040426111017.A5B331115B@narn.netbsd.org>
Date: Mon, 26 Apr 2004 11:10:17 +0000 (UTC)
From: murray@river-styx.org
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: murray@river-styx.org
To: gnats-bugs@gnats.NetBSD.org
Subject: posix standard and simple change to sys/time.h
X-Send-Pr-Version: www-1.0

>Number:         25331
>Category:       standards
>Synopsis:       posix standard and simple change to sys/time.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kleink
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 26 11:11:00 +0000 2004
>Closed-Date:    Tue Apr 27 01:20:19 +0000 2004
>Last-Modified:  Tue Apr 27 01:20:19 +0000 2004
>Originator:     Murray Armfield
>Release:        NetBSD-current
>Organization:
>Environment:
NetBSD ra 2.0E NetBSD 2.0E (RA.MP) #0: Sun Apr 25 10:36:47 EST 2004  admin@ra:/usr/obj/sys/arch/i386/compile/RA.MP i386
>Description:
The posix standard defines the pointers used in the geettimeofday and
setitimer to be restrict pointers as found in sys/time.h.
They are currently not in NetBSD.

Also, the second argument to gettimeofday is of void* type in posix,
but struct timezone* type in NetBSD.

And, the second argument to utimes is a fixed sized array in posix,
but a pointer in NetBSD.

Not mentioning the much bigger changes w.r.t. struct timeval. That is
another pr (one day). And select function is not defined here.

Is it worth flagging in the source, functions marked as LEGACY in
posix, ie utimes
>How-To-Repeat:
Inspect posix standard.
Inspect NetBSD sys/sys/time.h
>Fix:
patch to time.h follows. Some simple additional patching required in
other areas of NetBSD source tree.

--- time.h.orig 2004-04-26 20:46:17.000000000 +1000
+++ time.h
@@ -237,11 +237,12 @@ __BEGIN_DECLS
 int    adjtime __P((const struct timeval *, struct timeval *));
 int    futimes __P((int, const struct timeval *));
 int    getitimer __P((int, struct itimerval *));
-int    gettimeofday __P((struct timeval *, struct timezone *));
+int    gettimeofday __P((struct timeval * __restrict, void * __restrict));
 int    lutimes __P((const char *, const struct timeval *));
-int    setitimer __P((int, const struct itimerval *, struct itimerval *));
+int    setitimer __P((int, const struct itimerval * __restrict,
+           struct itimerval * __restrict));
 int    settimeofday __P((const struct timeval *, const struct timezone *));
-int    utimes __P((const char *, const struct timeval *));
+int    utimes __P((const char *, const struct timeval [2]));
 __END_DECLS
 #endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
>Release-Note:
>Audit-Trail:

From: Klaus Klein <kleink@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/25331 CVS commit: src
Date: Tue, 27 Apr 2004 01:12:44 +0000 (UTC)

 Module Name:	src
 Committed By:	kleink
 Date:		Tue Apr 27 01:12:44 UTC 2004

 Modified Files:
 	src/lib/libc/sys: getitimer.2 gettimeofday.2 settimeofday.c utimes.2
 	src/sys/kern: kern_time.c syscalls.master
 	src/sys/sys: time.h

 Log Message:
 POSIX-2001: Add restrict keywords to gettimeofday(2) and setitimer(2);
 further deprecate struct timezone usage by changing `tzp' argument to
 gettimeofday() to void *; align utimes(2) declaration by changing `times`
 argument from struct timeval * to struct timeval[2].  From Murray
 Armfield in PR standards/25331.

 In due curse, reflect these changes in futimes(2), lutimes(2), and
 settimeofday(2).


 To generate a diff of this commit:
 cvs rdiff -r1.18 -r1.19 src/lib/libc/sys/getitimer.2
 cvs rdiff -r1.22 -r1.23 src/lib/libc/sys/gettimeofday.2
 cvs rdiff -r1.5 -r1.6 src/lib/libc/sys/settimeofday.c
 cvs rdiff -r1.20 -r1.21 src/lib/libc/sys/utimes.2
 cvs rdiff -r1.82 -r1.83 src/sys/kern/kern_time.c
 cvs rdiff -r1.140 -r1.141 src/sys/kern/syscalls.master
 cvs rdiff -r1.41 -r1.42 src/sys/sys/time.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed 
State-Changed-By: kleink 
State-Changed-When: Tue Apr 27 01:16:16 UTC 2004 
State-Changed-Why:  
Fixed mostly as suggested, thanks.  I've also modified a couple of 
other functions similarly for consistency. 

Please note that the select issue is known already, and that the 
struct timeval issue is being discussed in standards/23317. 


Responsible-Changed-From-To: standards-manager->kleink 
Responsible-Changed-By: kleink 
Responsible-Changed-When: Tue Apr 27 01:16:16 UTC 2004 
Responsible-Changed-Why:  
I've taken care of this. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.