summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-03-28 13:16:08 +0000
committered <ed@FreeBSD.org>2010-03-28 13:16:08 +0000
commit543b5e901b744468356547ee61975d9d44fa8f32 (patch)
tree5c6d55680c37f3cbfd9460fbab60d39b1ecb8ae7
parent4f08ecd7ed8b39a0e0cd094967835fa85d105793 (diff)
downloadFreeBSD-src-543b5e901b744468356547ee61975d9d44fa8f32.zip
FreeBSD-src-543b5e901b744468356547ee61975d9d44fa8f32.tar.gz
Change all our own code to use st_*tim instead of st_*timespec.
Also remove some local patches to diff(1) which are now unneeded.
-rw-r--r--bin/cp/utils.c4
-rw-r--r--bin/ls/cmp.c64
-rw-r--r--bin/rcp/rcp.c8
-rw-r--r--bin/test/test.c6
-rw-r--r--gnu/usr.bin/diff/context.c.diff2
-rw-r--r--gnu/usr.bin/diff/diff.c.diff18
-rw-r--r--usr.bin/compress/compress.c4
-rw-r--r--usr.bin/gzip/gzip.c4
-rw-r--r--usr.bin/kdump/kdump.c32
-rw-r--r--usr.bin/mail/util.c2
-rw-r--r--usr.bin/touch/touch.c12
-rw-r--r--usr.sbin/mtree/compare.c6
-rw-r--r--usr.sbin/mtree/create.c4
13 files changed, 74 insertions, 92 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index b075eac..d729bd5 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -323,8 +323,8 @@ setfile(struct stat *fs, int fd)
fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX |
S_IRWXU | S_IRWXG | S_IRWXO;
- TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
- TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atim);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtim);
if (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv)) {
warn("%sutimes: %s", islink ? "l" : "", to.p_path);
rval = 1;
diff --git a/bin/ls/cmp.c b/bin/ls/cmp.c
index badd108..84fb038 100644
--- a/bin/ls/cmp.c
+++ b/bin/ls/cmp.c
@@ -66,17 +66,17 @@ int
modcmp(const FTSENT *a, const FTSENT *b)
{
- if (b->fts_statp->st_mtimespec.tv_sec >
- a->fts_statp->st_mtimespec.tv_sec)
+ if (b->fts_statp->st_mtim.tv_sec >
+ a->fts_statp->st_mtim.tv_sec)
return (1);
- if (b->fts_statp->st_mtimespec.tv_sec <
- a->fts_statp->st_mtimespec.tv_sec)
+ if (b->fts_statp->st_mtim.tv_sec <
+ a->fts_statp->st_mtim.tv_sec)
return (-1);
- if (b->fts_statp->st_mtimespec.tv_nsec >
- a->fts_statp->st_mtimespec.tv_nsec)
+ if (b->fts_statp->st_mtim.tv_nsec >
+ a->fts_statp->st_mtim.tv_nsec)
return (1);
- if (b->fts_statp->st_mtimespec.tv_nsec <
- a->fts_statp->st_mtimespec.tv_nsec)
+ if (b->fts_statp->st_mtim.tv_nsec <
+ a->fts_statp->st_mtim.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
}
@@ -92,17 +92,17 @@ int
acccmp(const FTSENT *a, const FTSENT *b)
{
- if (b->fts_statp->st_atimespec.tv_sec >
- a->fts_statp->st_atimespec.tv_sec)
+ if (b->fts_statp->st_atim.tv_sec >
+ a->fts_statp->st_atim.tv_sec)
return (1);
- if (b->fts_statp->st_atimespec.tv_sec <
- a->fts_statp->st_atimespec.tv_sec)
+ if (b->fts_statp->st_atim.tv_sec <
+ a->fts_statp->st_atim.tv_sec)
return (-1);
- if (b->fts_statp->st_atimespec.tv_nsec >
- a->fts_statp->st_atimespec.tv_nsec)
+ if (b->fts_statp->st_atim.tv_nsec >
+ a->fts_statp->st_atim.tv_nsec)
return (1);
- if (b->fts_statp->st_atimespec.tv_nsec <
- a->fts_statp->st_atimespec.tv_nsec)
+ if (b->fts_statp->st_atim.tv_nsec <
+ a->fts_statp->st_atim.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
}
@@ -118,17 +118,17 @@ int
birthcmp(const FTSENT *a, const FTSENT *b)
{
- if (b->fts_statp->st_birthtimespec.tv_sec >
- a->fts_statp->st_birthtimespec.tv_sec)
+ if (b->fts_statp->st_birthtim.tv_sec >
+ a->fts_statp->st_birthtim.tv_sec)
return (1);
- if (b->fts_statp->st_birthtimespec.tv_sec <
- a->fts_statp->st_birthtimespec.tv_sec)
+ if (b->fts_statp->st_birthtim.tv_sec <
+ a->fts_statp->st_birthtim.tv_sec)
return (-1);
- if (b->fts_statp->st_birthtimespec.tv_nsec >
- a->fts_statp->st_birthtimespec.tv_nsec)
+ if (b->fts_statp->st_birthtim.tv_nsec >
+ a->fts_statp->st_birthtim.tv_nsec)
return (1);
- if (b->fts_statp->st_birthtimespec.tv_nsec <
- a->fts_statp->st_birthtimespec.tv_nsec)
+ if (b->fts_statp->st_birthtim.tv_nsec <
+ a->fts_statp->st_birthtim.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
}
@@ -144,17 +144,17 @@ int
statcmp(const FTSENT *a, const FTSENT *b)
{
- if (b->fts_statp->st_ctimespec.tv_sec >
- a->fts_statp->st_ctimespec.tv_sec)
+ if (b->fts_statp->st_ctim.tv_sec >
+ a->fts_statp->st_ctim.tv_sec)
return (1);
- if (b->fts_statp->st_ctimespec.tv_sec <
- a->fts_statp->st_ctimespec.tv_sec)
+ if (b->fts_statp->st_ctim.tv_sec <
+ a->fts_statp->st_ctim.tv_sec)
return (-1);
- if (b->fts_statp->st_ctimespec.tv_nsec >
- a->fts_statp->st_ctimespec.tv_nsec)
+ if (b->fts_statp->st_ctim.tv_nsec >
+ a->fts_statp->st_ctim.tv_nsec)
return (1);
- if (b->fts_statp->st_ctimespec.tv_nsec <
- a->fts_statp->st_ctimespec.tv_nsec)
+ if (b->fts_statp->st_ctim.tv_nsec <
+ a->fts_statp->st_ctim.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
}
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index 0a9b7ba..2c27b63 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -390,8 +390,8 @@ syserr: run_err("%s: %s", name, strerror(errno));
* versions expecting microseconds.
*/
(void)snprintf(buf, sizeof(buf), "T%ld 0 %ld 0\n",
- (long)stb.st_mtimespec.tv_sec,
- (long)stb.st_atimespec.tv_sec);
+ (long)stb.st_mtim.tv_sec,
+ (long)stb.st_atim.tv_sec);
(void)write(rem, buf, strlen(buf));
if (response() < 0)
goto next;
@@ -454,8 +454,8 @@ rsource(char *name, struct stat *statp)
last++;
if (pflag) {
(void)snprintf(path, sizeof(path), "T%ld 0 %ld 0\n",
- (long)statp->st_mtimespec.tv_sec,
- (long)statp->st_atimespec.tv_sec);
+ (long)statp->st_mtim.tv_sec,
+ (long)statp->st_atim.tv_sec);
(void)write(rem, path, strlen(path));
if (response() < 0) {
closedir(dirp);
diff --git a/bin/test/test.c b/bin/test/test.c
index d7d1eec..e2062d1 100644
--- a/bin/test/test.c
+++ b/bin/test/test.c
@@ -572,12 +572,12 @@ newerf (const char *f1, const char *f2)
if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
return 0;
- if (b1.st_mtimespec.tv_sec > b2.st_mtimespec.tv_sec)
+ if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec)
return 1;
- if (b1.st_mtimespec.tv_sec < b2.st_mtimespec.tv_sec)
+ if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec)
return 0;
- return (b1.st_mtimespec.tv_nsec > b2.st_mtimespec.tv_nsec);
+ return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec);
}
static int
diff --git a/gnu/usr.bin/diff/context.c.diff b/gnu/usr.bin/diff/context.c.diff
index ee1ab21..06cfb12 100644
--- a/gnu/usr.bin/diff/context.c.diff
+++ b/gnu/usr.bin/diff/context.c.diff
@@ -15,7 +15,7 @@ $FreeBSD$
INT_STRLEN_BOUND (time_t) + 11)];
struct tm const *tm = localtime (&inf->stat.st_mtime);
- int nsec = TIMESPEC_NS (inf->stat.st_mtim);
-+ long nsec = TIMESPEC_NS (inf->stat.st_mtimespec);
++ long nsec = TIMESPEC_NS (inf->stat.st_mtim);
if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, 0, nsec)))
{
- long int sec = inf->stat.st_mtime;
diff --git a/gnu/usr.bin/diff/diff.c.diff b/gnu/usr.bin/diff/diff.c.diff
index 884a9c4..28b90ab 100644
--- a/gnu/usr.bin/diff/diff.c.diff
+++ b/gnu/usr.bin/diff/diff.c.diff
@@ -49,21 +49,3 @@ $FreeBSD$
output_style = style;
}
}
-@@ -997,7 +1001,7 @@
- #ifdef ST_MTIM_NSEC
-
- # if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
-- if (clock_gettime (CLOCK_REALTIME, &st->st_mtim) == 0)
-+ if (clock_gettime (CLOCK_REALTIME, &st->st_mtimespec) == 0)
- return;
- # endif
-
-@@ -1007,7 +1011,7 @@
- if (gettimeofday (&timeval, 0) == 0)
- {
- st->st_mtime = timeval.tv_sec;
-- st->st_mtim.ST_MTIM_NSEC = timeval.tv_usec * 1000;
-+ st->st_mtimespec.ST_MTIM_NSEC = timeval.tv_usec * 1000;
- return;
- }
- }
diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c
index 584f283..6f674c2 100644
--- a/usr.bin/compress/compress.c
+++ b/usr.bin/compress/compress.c
@@ -368,8 +368,8 @@ setfile(const char *name, struct stat *fs)
fs->st_mode &= S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
- TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
- TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atim);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtim);
if (utimes(name, tv))
cwarn("utimes: %s", name);
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
index e9371d2..e8e75aa 100644
--- a/usr.bin/gzip/gzip.c
+++ b/usr.bin/gzip/gzip.c
@@ -1088,8 +1088,8 @@ copymodes(int fd, const struct stat *sbp, const char *file)
if (fchmod(fd, sb.st_mode) < 0)
maybe_warn("couldn't fchmod: %s", file);
- TIMESPEC_TO_TIMEVAL(&times[0], &sb.st_atimespec);
- TIMESPEC_TO_TIMEVAL(&times[1], &sb.st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&times[0], &sb.st_atim);
+ TIMESPEC_TO_TIMEVAL(&times[1], &sb.st_mtim);
if (futimes(fd, times) < 0)
maybe_warn("couldn't utimes: %s", file);
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 9c86fff..ec32ee7 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1270,50 +1270,50 @@ ktrstat(struct stat *statp)
printf("rdev=%ju, ", (uintmax_t)statp->st_rdev);
printf("atime=");
if (resolv == 0)
- printf("%jd", (intmax_t)statp->st_atimespec.tv_sec);
+ printf("%jd", (intmax_t)statp->st_atim.tv_sec);
else {
- tm = localtime(&statp->st_atimespec.tv_sec);
+ tm = localtime(&statp->st_atim.tv_sec);
(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
printf("\"%s\"", timestr);
}
- if (statp->st_atimespec.tv_nsec != 0)
- printf(".%09ld, ", statp->st_atimespec.tv_nsec);
+ if (statp->st_atim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_atim.tv_nsec);
else
printf(", ");
printf("stime=");
if (resolv == 0)
- printf("%jd", (intmax_t)statp->st_mtimespec.tv_sec);
+ printf("%jd", (intmax_t)statp->st_mtim.tv_sec);
else {
- tm = localtime(&statp->st_mtimespec.tv_sec);
+ tm = localtime(&statp->st_mtim.tv_sec);
(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
printf("\"%s\"", timestr);
}
- if (statp->st_mtimespec.tv_nsec != 0)
- printf(".%09ld, ", statp->st_mtimespec.tv_nsec);
+ if (statp->st_mtim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_mtim.tv_nsec);
else
printf(", ");
printf("ctime=");
if (resolv == 0)
- printf("%jd", (intmax_t)statp->st_ctimespec.tv_sec);
+ printf("%jd", (intmax_t)statp->st_ctim.tv_sec);
else {
- tm = localtime(&statp->st_ctimespec.tv_sec);
+ tm = localtime(&statp->st_ctim.tv_sec);
(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
printf("\"%s\"", timestr);
}
- if (statp->st_ctimespec.tv_nsec != 0)
- printf(".%09ld, ", statp->st_ctimespec.tv_nsec);
+ if (statp->st_ctim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_ctim.tv_nsec);
else
printf(", ");
printf("birthtime=");
if (resolv == 0)
- printf("%jd", (intmax_t)statp->st_birthtimespec.tv_sec);
+ printf("%jd", (intmax_t)statp->st_birthtim.tv_sec);
else {
- tm = localtime(&statp->st_birthtimespec.tv_sec);
+ tm = localtime(&statp->st_birthtim.tv_sec);
(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
printf("\"%s\"", timestr);
}
- if (statp->st_birthtimespec.tv_nsec != 0)
- printf(".%09ld, ", statp->st_birthtimespec.tv_nsec);
+ if (statp->st_birthtim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_birthtim.tv_nsec);
else
printf(", ");
printf("size=%jd, blksize=%ju, blocks=%jd, flags=0x%x",
diff --git a/usr.bin/mail/util.c b/usr.bin/mail/util.c
index e764aac..df2d840 100644
--- a/usr.bin/mail/util.c
+++ b/usr.bin/mail/util.c
@@ -349,7 +349,7 @@ alter(name)
return;
(void)gettimeofday(&tv[0], (struct timezone *)NULL);
tv[0].tv_sec++;
- TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtim);
(void)utimes(name, tv);
}
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
index 5ceb175..2148939 100644
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -187,9 +187,9 @@ main(int argc, char *argv[])
}
if (!aflag)
- TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atim);
if (!mflag)
- TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtim);
/*
* We're adjusting the times based on the file times, not a
@@ -197,11 +197,11 @@ main(int argc, char *argv[])
*/
if (Aflag) {
if (aflag) {
- TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atim);
tv[0].tv_sec += Aflag;
}
if (mflag) {
- TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtim);
tv[1].tv_sec += Aflag;
}
}
@@ -368,8 +368,8 @@ stime_file(char *fname, struct timeval *tvp)
if (stat(fname, &sb))
err(1, "%s", fname);
- TIMESPEC_TO_TIMEVAL(tvp, &sb.st_atimespec);
- TIMESPEC_TO_TIMEVAL(tvp + 1, &sb.st_mtimespec);
+ TIMESPEC_TO_TIMEVAL(tvp, &sb.st_atim);
+ TIMESPEC_TO_TIMEVAL(tvp + 1, &sb.st_mtim);
}
int
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index 44556d6..fdd3767 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -181,13 +181,13 @@ typeerr: LABEL;
* Catches nano-second differences, but doesn't display them.
*/
if ((s->flags & F_TIME) &&
- ((s->st_mtimespec.tv_sec != p->fts_statp->st_mtimespec.tv_sec) ||
- (s->st_mtimespec.tv_nsec != p->fts_statp->st_mtimespec.tv_nsec))) {
+ ((s->st_mtimespec.tv_sec != p->fts_statp->st_mtim.tv_sec) ||
+ (s->st_mtimespec.tv_nsec != p->fts_statp->st_mtim.tv_nsec))) {
LABEL;
(void)printf("%smodification time expected %.24s ",
tab, ctime(&s->st_mtimespec.tv_sec));
(void)printf("found %.24s",
- ctime(&p->fts_statp->st_mtimespec.tv_sec));
+ ctime(&p->fts_statp->st_mtim.tv_sec));
if (uflag) {
tv[0].tv_sec = s->st_mtimespec.tv_sec;
tv[0].tv_usec = s->st_mtimespec.tv_nsec / 1000;
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c
index eee5037..da72fc6 100644
--- a/usr.sbin/mtree/create.c
+++ b/usr.sbin/mtree/create.c
@@ -213,8 +213,8 @@ statf(int indent, FTSENT *p)
(intmax_t)p->fts_statp->st_size);
if (keys & F_TIME)
output(indent, &offset, "time=%ld.%09ld",
- (long)p->fts_statp->st_mtimespec.tv_sec,
- p->fts_statp->st_mtimespec.tv_nsec);
+ (long)p->fts_statp->st_mtim.tv_sec,
+ p->fts_statp->st_mtim.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))
OpenPOWER on IntegriCloud