Rename struct timespec fields to conform to POSIX.1b

This commit is contained in:
jtc 1996-02-01 00:04:52 +00:00
parent 63d5234cbf
commit dd05bd5124
9 changed files with 58 additions and 58 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: advnops.c,v 1.22 1995/08/18 15:14:38 chopps Exp $ */
/* $NetBSD: advnops.c,v 1.23 1996/02/01 00:13:47 jtc Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -86,10 +86,10 @@ adosfs_getattr(sp)
vap->va_uid = ap->uid;
vap->va_gid = ap->gid;
vap->va_fsid = sp->a_vp->v_mount->mnt_stat.f_fsid.val[0];
vap->va_atime.ts_sec = vap->va_mtime.ts_sec = vap->va_ctime.ts_sec =
vap->va_atime.tv_sec = vap->va_mtime.tv_sec = vap->va_ctime.tv_sec =
ap->mtime.days * 24 * 60 * 60 + ap->mtime.mins * 60 +
ap->mtime.ticks / 50 + (8 * 365 + 2) * 24 * 60 * 60;
vap->va_atime.ts_nsec = vap->va_mtime.ts_nsec = vap->va_ctime.ts_nsec = 0;
vap->va_atime.tv_nsec = vap->va_mtime.tv_nsec = vap->va_ctime.tv_nsec = 0;
vap->va_gen = 0;
vap->va_flags = 0;
vap->va_rdev = NODEV;

View File

@ -1,4 +1,4 @@
/* $NetBSD: stat.h,v 1.17 1995/06/15 23:08:08 cgd Exp $ */
/* $NetBSD: stat.h,v 1.18 1996/02/01 00:10:34 jtc Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -94,12 +94,12 @@ struct stat {
int64_t st_qspare[2];
};
#ifndef _POSIX_SOURCE
#define st_atime st_atimespec.ts_sec
#define st_atimensec st_atimespec.ts_nsec
#define st_mtime st_mtimespec.ts_sec
#define st_mtimensec st_mtimespec.ts_nsec
#define st_ctime st_ctimespec.ts_sec
#define st_ctimensec st_ctimespec.ts_nsec
#define st_atime st_atimespec.tv_sec
#define st_atimensec st_atimespec.tv_nsec
#define st_mtime st_mtimespec.tv_sec
#define st_mtimensec st_mtimespec.tv_nsec
#define st_ctime st_ctimespec.tv_sec
#define st_ctimensec st_ctimespec.tv_nsec
#endif
#define S_ISUID 0004000 /* set user id on execution */

View File

@ -1,4 +1,4 @@
/* $NetBSD: time.h,v 1.16 1995/06/15 23:08:11 cgd Exp $ */
/* $NetBSD: time.h,v 1.17 1996/02/01 00:10:36 jtc Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -50,20 +50,20 @@ struct timeval {
};
/*
* Structure defined by POSIX.4 to be like a timeval.
* Structure defined by POSIX.1b to be like a timeval.
*/
struct timespec {
time_t ts_sec; /* seconds */
long ts_nsec; /* and nanoseconds */
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->ts_sec = (tv)->tv_sec; \
(ts)->ts_nsec = (tv)->tv_usec * 1000; \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->ts_sec; \
(tv)->tv_usec = (ts)->ts_nsec / 1000; \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
struct timezone {

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.7 1995/06/15 23:22:46 cgd Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.8 1996/02/01 00:07:51 jtc Exp $ */
/*
* Copyright (c) 1986, 1989, 1991, 1993
@ -428,12 +428,12 @@ lfs_getattr(ap)
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)ip->i_rdev;
vap->va_size = ip->i_din.di_size;
vap->va_atime.ts_sec = ip->i_atime;
vap->va_atime.ts_nsec = ip->i_atimensec;
vap->va_mtime.ts_sec = ip->i_mtime;
vap->va_mtime.ts_nsec = ip->i_mtimensec;
vap->va_ctime.ts_sec = ip->i_ctime;
vap->va_ctime.ts_nsec = ip->i_ctimensec;
vap->va_atime.tv_sec = ip->i_atime;
vap->va_atime.tv_nsec = ip->i_atimensec;
vap->va_mtime.tv_sec = ip->i_mtime;
vap->va_mtime.tv_nsec = ip->i_mtimensec;
vap->va_ctime.tv_sec = ip->i_ctime;
vap->va_ctime.tv_nsec = ip->i_ctimensec;
vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
/* this doesn't belong here */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.11 1995/10/09 11:19:32 mycroft Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.12 1996/02/01 00:09:07 jtc Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -264,12 +264,12 @@ ufs_getattr(ap)
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)ip->i_rdev;
vap->va_size = ip->i_din.di_size;
vap->va_atime.ts_sec = ip->i_atime;
vap->va_atime.ts_nsec = ip->i_atimensec;
vap->va_mtime.ts_sec = ip->i_mtime;
vap->va_mtime.ts_nsec = ip->i_mtimensec;
vap->va_ctime.ts_sec = ip->i_ctime;
vap->va_ctime.ts_nsec = ip->i_ctimensec;
vap->va_atime.tv_sec = ip->i_atime;
vap->va_atime.tv_nsec = ip->i_atimensec;
vap->va_mtime.tv_sec = ip->i_mtime;
vap->va_mtime.tv_nsec = ip->i_mtimensec;
vap->va_ctime.tv_sec = ip->i_ctime;
vap->va_ctime.tv_nsec = ip->i_ctimensec;
vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
/* this doesn't belong here */
@ -348,20 +348,20 @@ ufs_setattr(ap)
return (error);
}
ip = VTOI(vp);
if (vap->va_atime.ts_sec != VNOVAL || vap->va_mtime.ts_sec != VNOVAL) {
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
if (cred->cr_uid != ip->i_uid &&
(error = suser(cred, &p->p_acflag)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(vp, VWRITE, cred, p))))
return (error);
if (vap->va_atime.ts_sec != VNOVAL)
if (vap->va_atime.tv_sec != VNOVAL)
ip->i_flag |= IN_ACCESS;
if (vap->va_mtime.ts_sec != VNOVAL)
if (vap->va_mtime.tv_sec != VNOVAL)
ip->i_flag |= IN_CHANGE | IN_UPDATE;
atimeval.tv_sec = vap->va_atime.ts_sec;
atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
mtimeval.tv_sec = vap->va_mtime.ts_sec;
mtimeval.tv_usec = vap->va_mtime.ts_nsec / 1000;
atimeval.tv_sec = vap->va_atime.tv_sec;
atimeval.tv_usec = vap->va_atime.tv_nsec / 1000;
mtimeval.tv_sec = vap->va_mtime.tv_sec;
mtimeval.tv_usec = vap->va_mtime.tv_nsec / 1000;
if (error = VOP_UPDATE(vp, &atimeval, &mtimeval, 1))
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: archive.c,v 1.7 1995/03/26 03:27:46 glass Exp $ */
/* $NetBSD: archive.c,v 1.8 1996/02/01 00:06:05 jtc Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)archive.c 8.3 (Berkeley) 4/2/94";
#else
static char rcsid[] = "$NetBSD: archive.c,v 1.7 1995/03/26 03:27:46 glass Exp $";
static char rcsid[] = "$NetBSD: archive.c,v 1.8 1996/02/01 00:06:05 jtc Exp $";
#endif
#endif /* not lint */
@ -231,17 +231,17 @@ put_arobj(cfp, sb)
name, OLDARMAXNAME, name);
(void)fflush(stderr);
}
(void)sprintf(hb, HDR3, name, sb->st_mtimespec.ts_sec,
(void)sprintf(hb, HDR3, name, sb->st_mtimespec.tv_sec,
sb->st_uid, sb->st_gid, sb->st_mode, sb->st_size,
ARFMAG);
lname = 0;
} else if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
(void)sprintf(hb, HDR1, AR_EFMT1, lname,
sb->st_mtimespec.ts_sec, sb->st_uid, sb->st_gid,
sb->st_mtimespec.tv_sec, sb->st_uid, sb->st_gid,
sb->st_mode, sb->st_size + lname, ARFMAG);
else {
lname = 0;
(void)sprintf(hb, HDR2, name, sb->st_mtimespec.ts_sec,
(void)sprintf(hb, HDR2, name, sb->st_mtimespec.tv_sec,
sb->st_uid, sb->st_gid, sb->st_mode, sb->st_size,
ARFMAG);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: compare.c,v 1.9 1995/10/22 20:12:07 pk Exp $ */
/* $NetBSD: compare.c,v 1.10 1996/02/01 00:04:52 jtc Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
static char rcsid[] = "$NetBSD: compare.c,v 1.9 1995/10/22 20:12:07 pk Exp $";
static char rcsid[] = "$NetBSD: compare.c,v 1.10 1996/02/01 00:04:52 jtc Exp $";
#endif
#endif /* not lint */
@ -176,13 +176,13 @@ typeerr: LABEL;
* Catches nano-second differences, but doesn't display them.
*/
if (s->flags & F_TIME &&
(s->st_mtimespec.ts_sec != p->fts_statp->st_mtimespec.ts_sec ||
s->st_mtimespec.ts_nsec != p->fts_statp->st_mtimespec.ts_nsec)) {
(s->st_mtimespec.tv_sec != p->fts_statp->st_mtimespec.tv_sec ||
s->st_mtimespec.tv_nsec != p->fts_statp->st_mtimespec.tv_nsec)) {
LABEL;
(void)printf("%smodification time (%.24s, ",
tab, ctime(&s->st_mtimespec.ts_sec));
tab, ctime(&s->st_mtimespec.tv_sec));
(void)printf("%.24s)\n",
ctime(&p->fts_statp->st_mtimespec.ts_sec));
ctime(&p->fts_statp->st_mtimespec.tv_sec));
tab = "\t";
}
if (s->flags & F_CKSUM)

View File

@ -1,4 +1,4 @@
/* $NetBSD: create.c,v 1.9 1995/03/07 21:12:06 cgd Exp $ */
/* $NetBSD: create.c,v 1.10 1996/02/01 00:04:55 jtc Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
#else
static char rcsid[] = "$NetBSD: create.c,v 1.9 1995/03/07 21:12:06 cgd Exp $";
static char rcsid[] = "$NetBSD: create.c,v 1.10 1996/02/01 00:04:55 jtc Exp $";
#endif
#endif /* not lint */
@ -158,8 +158,8 @@ statf(p)
output(&indent, "size=%qd", p->fts_statp->st_size);
if (keys & F_TIME)
output(&indent, "time=%ld.%ld",
p->fts_statp->st_mtimespec.ts_sec,
p->fts_statp->st_mtimespec.ts_nsec);
p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
crc(fd, &val, &len))

View File

@ -1,4 +1,4 @@
/* $NetBSD: spec.c,v 1.6 1995/03/07 21:12:12 cgd Exp $ */
/* $NetBSD: spec.c,v 1.7 1996/02/01 00:04:57 jtc Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93";
#else
static char rcsid[] = "$NetBSD: spec.c,v 1.6 1995/03/07 21:12:12 cgd Exp $";
static char rcsid[] = "$NetBSD: spec.c,v 1.7 1996/02/01 00:04:57 jtc Exp $";
#endif
#endif /* not lint */
@ -220,11 +220,11 @@ set(t, ip)
err("%s", strerror(errno));
break;
case F_TIME:
ip->st_mtimespec.ts_sec = strtoul(val, &ep, 10);
ip->st_mtimespec.tv_sec = strtoul(val, &ep, 10);
if (*ep != '.')
err("invalid time %s", val);
val = ep + 1;
ip->st_mtimespec.ts_nsec = strtoul(val, &ep, 10);
ip->st_mtimespec.tv_nsec = strtoul(val, &ep, 10);
if (*ep)
err("invalid time %s", val);
break;