Source-Changes-HG archive

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

[src/trunk]: src POSIX-2001: Add restrict keywords to gettimeofday(2) and set...



details:   https://anonhg.NetBSD.org/src/rev/b3344909a50a
branches:  trunk
changeset: 566072:b3344909a50a
user:      kleink <kleink%NetBSD.org@localhost>
date:      Tue Apr 27 01:12:44 2004 +0000

description:
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).

diffstat:

 lib/libc/sys/getitimer.2    |   6 +++---
 lib/libc/sys/gettimeofday.2 |  14 ++++++++++----
 lib/libc/sys/settimeofday.c |   4 ++--
 lib/libc/sys/utimes.2       |  10 +++++-----
 sys/kern/kern_time.c        |   8 ++++----
 sys/kern/syscalls.master    |   6 +++---
 sys/sys/time.h              |  17 ++++++++++-------
 7 files changed, 37 insertions(+), 28 deletions(-)

diffs (216 lines):

diff -r 4beab2bec5f7 -r b3344909a50a lib/libc/sys/getitimer.2
--- a/lib/libc/sys/getitimer.2  Tue Apr 27 00:51:32 2004 +0000
+++ b/lib/libc/sys/getitimer.2  Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: getitimer.2,v 1.18 2003/08/07 16:43:58 agc Exp $
+.\"    $NetBSD: getitimer.2,v 1.19 2004/04/27 01:12:44 kleink Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)getitimer.2        8.3 (Berkeley) 5/16/95
 .\"
-.Dd May 16, 1995
+.Dd April 26, 2004
 .Dt GETITIMER 2
 .Os
 .Sh NAME
@@ -46,7 +46,7 @@
 .Ft int
 .Fn getitimer "int which" "struct itimerval *value"
 .Ft int
-.Fn setitimer "int which" "const struct itimerval *value" "struct itimerval *ovalue"
+.Fn setitimer "int which" "const struct itimerval * restrict value" "struct itimerval * restrict ovalue"
 .Sh DESCRIPTION
 The system provides each process with three interval timers,
 defined in
diff -r 4beab2bec5f7 -r b3344909a50a lib/libc/sys/gettimeofday.2
--- a/lib/libc/sys/gettimeofday.2       Tue Apr 27 00:51:32 2004 +0000
+++ b/lib/libc/sys/gettimeofday.2       Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: gettimeofday.2,v 1.22 2003/08/07 16:43:59 agc Exp $
+.\"    $NetBSD: gettimeofday.2,v 1.23 2004/04/27 01:12:44 kleink Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)gettimeofday.2     8.2 (Berkeley) 5/26/95
 .\"
-.Dd May 26, 1995
+.Dd April 26.2004
 .Dt GETTIMEOFDAY 2
 .Os
 .Sh NAME
@@ -41,9 +41,9 @@
 .Sh SYNOPSIS
 .In sys/time.h
 .Ft int
-.Fn gettimeofday "struct timeval *tp" "struct timezone *tzp"
+.Fn gettimeofday "struct timeval * restrict tp" "void * restrict tzp"
 .Ft int
-.Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
+.Fn settimeofday "const struct timeval * restrict tp" "const void * restrict tzp"
 .Sh DESCRIPTION
 .Bf -symbolic
 Note: time zone information is no longer provided by this interface.
@@ -64,6 +64,12 @@
 If
 .Fa tp
 is NULL, the time will not be returned or set.
+Despite being declared
+.Fa void * ,
+the objects pointed to by
+.Fa tzp
+shall be of type
+.Fa struct timezone .
 .Pp
 The structures pointed to by
 .Fa tp
diff -r 4beab2bec5f7 -r b3344909a50a lib/libc/sys/settimeofday.c
--- a/lib/libc/sys/settimeofday.c       Tue Apr 27 00:51:32 2004 +0000
+++ b/lib/libc/sys/settimeofday.c       Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: settimeofday.c,v 1.5 2003/07/16 19:42:11 cb Exp $ */
+/*     $NetBSD: settimeofday.c,v 1.6 2004/04/27 01:12:44 kleink Exp $ */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.      
@@ -56,7 +56,7 @@
 int
 settimeofday(tv, tzp)
        const struct timeval *tv;
-       const struct timezone *tzp;
+       const void *tzp;
 {
        struct sys_settimeofday_args args;
        int error;
diff -r 4beab2bec5f7 -r b3344909a50a lib/libc/sys/utimes.2
--- a/lib/libc/sys/utimes.2     Tue Apr 27 00:51:32 2004 +0000
+++ b/lib/libc/sys/utimes.2     Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: utimes.2,v 1.20 2003/08/07 16:44:11 agc Exp $
+.\"    $NetBSD: utimes.2,v 1.21 2004/04/27 01:12:44 kleink Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)utimes.2   8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd April 26, 2004
 .Dt UTIMES 2
 .Os
 .Sh NAME
@@ -42,11 +42,11 @@
 .Sh SYNOPSIS
 .In sys/time.h
 .Ft int
-.Fn utimes "const char *path" "const struct timeval *times"
+.Fn utimes "const char *path" "const struct timeval times[2]"
 .Ft int
-.Fn lutimes "const char *path" "const struct timeval *times"
+.Fn lutimes "const char *path" "const struct timeval times[2]"
 .Ft int
-.Fn futimes "int fd" "const struct timeval *times"
+.Fn futimes "int fd" "const struct timeval times[2]"
 .Sh DESCRIPTION
 The access and modification times of the file named by
 .Fa path
diff -r 4beab2bec5f7 -r b3344909a50a sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Tue Apr 27 00:51:32 2004 +0000
+++ b/sys/kern/kern_time.c      Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.82 2004/03/14 01:08:47 cl Exp $        */
+/*     $NetBSD: kern_time.c,v 1.83 2004/04/27 01:12:44 kleink Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.82 2004/03/14 01:08:47 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.83 2004/04/27 01:12:44 kleink Exp $");
 
 #include "fs_nfs.h"
 #include "opt_nfs.h"
@@ -327,7 +327,7 @@
 {
        struct sys_gettimeofday_args /* {
                syscallarg(struct timeval *) tp;
-               syscallarg(struct timezone *) tzp;
+               syscallarg(void *) tzp;         /* struct timezone * */
        } */ *uap = v;
        struct timeval atv;
        int error = 0;
@@ -357,7 +357,7 @@
 {
        struct sys_settimeofday_args /* {
                syscallarg(const struct timeval *) tv;
-               syscallarg(const struct timezone *) tzp;
+               syscallarg(const void *) tzp;   /* const struct timezone * */
        } */ *uap = v;
        struct proc *p = l->l_proc;
        int error;
diff -r 4beab2bec5f7 -r b3344909a50a sys/kern/syscalls.master
--- a/sys/kern/syscalls.master  Tue Apr 27 00:51:32 2004 +0000
+++ b/sys/kern/syscalls.master  Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.140 2004/04/25 22:18:08 kleink Exp $
+       $NetBSD: syscalls.master,v 1.141 2004/04/27 01:12:44 kleink Exp $
 
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
 
@@ -250,7 +250,7 @@
                            osendmsg
 115    OBSOL           vtrace
 116    STD             { int sys_gettimeofday(struct timeval *tp, \
-                           struct timezone *tzp); }
+                           void *tzp); }
 117    STD             { int sys_getrusage(int who, struct rusage *rusage); }
 118    STD             { int sys_getsockopt(int s, int level, int name, \
                            void *val, unsigned int *avalsize); }
@@ -260,7 +260,7 @@
 121    STD             { ssize_t sys_writev(int fd, \
                            const struct iovec *iovp, int iovcnt); }
 122    STD             { int sys_settimeofday(const struct timeval *tv, \
-                           const struct timezone *tzp); }
+                           const void *tzp); }
 123    STD             { int sys_fchown(int fd, uid_t uid, gid_t gid); }
 124    STD             { int sys_fchmod(int fd, mode_t mode); }
 125    COMPAT_43       { int sys_recvfrom(int s, caddr_t buf, size_t len, \
diff -r 4beab2bec5f7 -r b3344909a50a sys/sys/time.h
--- a/sys/sys/time.h    Tue Apr 27 00:51:32 2004 +0000
+++ b/sys/sys/time.h    Tue Apr 27 01:12:44 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: time.h,v 1.41 2003/09/06 22:01:21 christos Exp $       */
+/*     $NetBSD: time.h,v 1.42 2004/04/27 01:12:44 kleink Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -235,13 +235,16 @@
 
 __BEGIN_DECLS
 int    adjtime __P((const struct timeval *, struct timeval *));
-int    futimes __P((int, const struct timeval *));
+int    futimes __P((int, const struct timeval [2]));
 int    getitimer __P((int, struct itimerval *));
-int    gettimeofday __P((struct timeval *, struct timezone *));
-int    lutimes __P((const char *, const struct timeval *));
-int    setitimer __P((int, const struct itimerval *, struct itimerval *));
-int    settimeofday __P((const struct timeval *, const struct timezone *));
-int    utimes __P((const char *, const struct timeval *));
+int    gettimeofday __P((struct timeval * __restrict,
+           void * __restrict));
+int    lutimes __P((const char *, const struct timeval [2]));
+int    setitimer __P((int, const struct itimerval * __restrict,
+           struct itimerval * __restrict));
+int    settimeofday __P((const struct timeval * __restrict,
+           const void * __restrict));
+int    utimes __P((const char *, const struct timeval [2]));
 __END_DECLS
 #endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
 



Home | Main Index | Thread Index | Old Index