summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2013-04-23 14:32:53 +0000
committerespie <espie@openbsd.org>2013-04-23 14:32:53 +0000
commit1f89b472f1907a5c725c1719663ff8099a518f8c (patch)
treee5ae3a3eb973840c84db53c1bac92a27c63633eb
parentConvert RAID6 to new ccb handling. (diff)
downloadwireguard-openbsd-1f89b472f1907a5c725c1719663ff8099a518f8c.tar.xz
wireguard-openbsd-1f89b472f1907a5c725c1719663ff8099a518f8c.zip
remove TIMESTAMP abstraction layer, prodded by theo.
while there, clean up includes. use strtoll for ar timestamps (pretty much unused in reality, more standard conforming than anything) use idea from Todd to adapt to time_t being 32 bits OR 64 bits (pedantically correct: INT_MIN would work just fine up to 1910 or so...) okay millert@, gone thru a make build.
-rw-r--r--usr.bin/make/Makefile3
-rw-r--r--usr.bin/make/arch.c24
-rw-r--r--usr.bin/make/arch.h10
-rw-r--r--usr.bin/make/compat.c3
-rw-r--r--usr.bin/make/cond.c6
-rw-r--r--usr.bin/make/dir.c20
-rw-r--r--usr.bin/make/dir.h8
-rw-r--r--usr.bin/make/dump.c10
-rw-r--r--usr.bin/make/engine.c13
-rw-r--r--usr.bin/make/generate.c6
-rw-r--r--usr.bin/make/gnode.h12
-rw-r--r--usr.bin/make/make.c5
-rw-r--r--usr.bin/make/memory.c6
-rw-r--r--usr.bin/make/suff.c8
-rw-r--r--usr.bin/make/targ.c6
-rw-r--r--usr.bin/make/targ.h6
-rw-r--r--usr.bin/make/targequiv.c10
-rw-r--r--usr.bin/make/timestamp.c7
-rw-r--r--usr.bin/make/timestamp.h16
-rw-r--r--usr.bin/make/timestamp_t.h31
-rw-r--r--usr.bin/make/var.c6
21 files changed, 89 insertions, 127 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 21c7b295545..65e5046c9c5 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.55 2012/10/02 10:29:30 espie Exp $
+# $OpenBSD: Makefile,v 1.56 2013/04/23 14:32:53 espie Exp $
PROG= make
CFLAGS+= -I${.OBJDIR} -I${.CURDIR}
@@ -6,7 +6,6 @@ HOSTCFLAGS+= -I${.OBJDIR} -I${.CURDIR}
CDIAGFLAGS=-Wall -W -Wno-char-subscripts -Wstrict-prototypes -pedantic \
-Wmissing-prototypes -Wdeclaration-after-statement
-CDEFS+=-DUSE_TIMESPEC
CDEFS+=-DHAS_BOOL_H
CDEFS+=-DHAS_PATHS_H
CDEFS+=-DHAS_EXTENDED_GETCWD
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 204193d89ae..c564c5c7eea 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arch.c,v 1.80 2012/10/02 10:29:30 espie Exp $ */
+/* $OpenBSD: arch.c,v 1.81 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
@@ -77,12 +77,12 @@
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "ohash.h"
+#include <ohash.h>
#include "config.h"
#include "defines.h"
#include "buf.h"
@@ -133,7 +133,7 @@ static struct ar_hdr *dummy;
/* Each archive member is tied to an arch_member structure,
* suitable for hashing. */
struct arch_member {
- TIMESTAMP mtime; /* Member modification date. */
+ struct timespec mtime; /* Member modification date. */
char date[AR_DATE_SIZE+1]; /* Same, before conversion to numeric
* value. */
char name[1]; /* Member name. */
@@ -151,11 +151,11 @@ static struct ohash_info arch_info = {
static struct arch_member *new_arch_member(struct ar_hdr *, const char *);
-static TIMESTAMP mtime_of_member(struct arch_member *);
+static struct timespec mtime_of_member(struct arch_member *);
static long field2long(const char *, size_t);
static Arch *read_archive(const char *, const char *);
-static TIMESTAMP ArchMTimeMember(const char *, const char *, bool);
+static struct timespec ArchMTimeMember(const char *, const char *, bool);
static FILE *ArchFindMember(const char *, const char *, struct ar_hdr *, const char *);
static void ArchTouch(const char *, const char *);
#if defined(__svr4__) || defined(__SVR4) || \
@@ -191,11 +191,11 @@ new_arch_member(struct ar_hdr *hdr, const char *name)
return n;
}
-static TIMESTAMP
+static struct timespec
mtime_of_member(struct arch_member *m)
{
if (is_out_of_date(m->mtime))
- ts_set_from_time_t((time_t) strtol(m->date, NULL, 10),
+ ts_set_from_time_t((time_t) strtoll(m->date, NULL, 10),
m->mtime);
return m->mtime;
}
@@ -520,7 +520,7 @@ read_archive(const char *archive, const char *earchive)
* Cache the whole archive contents if hash is true.
*-----------------------------------------------------------------------
*/
-static TIMESTAMP
+static struct timespec
ArchMTimeMember(
const char *archive, /* Path to the archive */
const char *member, /* Name of member. If it is a path, only the
@@ -533,7 +533,7 @@ ArchMTimeMember(
unsigned int slot; /* Place of archive in the archives hash */
const char *end = NULL;
const char *cp;
- TIMESTAMP result;
+ struct timespec result;
ts_set_out_of_date(result);
/* Because of space constraints and similar things, files are archived
@@ -865,7 +865,7 @@ Arch_Touch(GNode *gn)
ArchTouch(Var(ARCHIVE_INDEX, gn), Var(MEMBER_INDEX, gn));
}
-TIMESTAMP
+struct timespec
Arch_MTime(GNode *gn)
{
gn->mtime = ArchMTimeMember(Var(ARCHIVE_INDEX, gn),
@@ -874,7 +874,7 @@ Arch_MTime(GNode *gn)
return gn->mtime;
}
-TIMESTAMP
+struct timespec
Arch_MemMTime(GNode *gn)
{
LstNode ln;
diff --git a/usr.bin/make/arch.h b/usr.bin/make/arch.h
index 5ff5aafd804..1c205e4f471 100644
--- a/usr.bin/make/arch.h
+++ b/usr.bin/make/arch.h
@@ -1,6 +1,6 @@
#ifndef ARCH_H
#define ARCH_H
-/* $OpenBSD: arch.h,v 1.7 2012/10/02 10:29:30 espie Exp $ */
+/* $OpenBSD: arch.h,v 1.8 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -32,9 +32,7 @@
* Functions to manipulate libraries, archives and their members.
*/
-#ifndef TIMESTAMP_TYPE
-#include "timestamp_t.h"
-#endif
+#include <sys/time.h>
/* Initialization and cleanup */
extern void Arch_Init(void);
@@ -53,10 +51,10 @@ extern void Arch_Touch(GNode *);
* Find the modification time of a member of an archive *in the
* archive*, and returns it.
* The time is also stored in the member's GNode. */
-extern TIMESTAMP Arch_MTime(GNode *);
+extern struct timespec Arch_MTime(GNode *);
/* stamp = Arch_MemMTime(node);
* Find the modification time of a member of an archive and returns it.
* To use when the member only exists within the archive. */
-extern TIMESTAMP Arch_MemMTime(GNode *);
+extern struct timespec Arch_MemMTime(GNode *);
#endif
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index c01ce1e3d2c..f0f428edc9d 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat.c,v 1.78 2012/11/24 11:03:45 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.79 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -37,6 +37,7 @@
#include <limits.h>
#include <signal.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 2cd5004291e..c64b1525dd0 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cond.c,v 1.48 2012/11/24 11:04:55 espie Exp $ */
+/* $OpenBSD: cond.c,v 1.49 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@@ -37,10 +37,11 @@
#include <ctype.h>
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ohash.h>
#include "config.h"
#include "defines.h"
#include "dir.h"
@@ -57,7 +58,6 @@
#include "main.h"
#include "gnode.h"
#include "lst.h"
-#include "ohash.h"
/* The parsing of conditional expressions is based on this grammar:
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 3f0c5c45bf2..96cd4e493d0 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.61 2012/12/07 07:15:31 espie Exp $ */
+/* $OpenBSD: dir.c,v 1.62 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
@@ -66,13 +66,13 @@
#include <dirent.h>
#include <limits.h>
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ohash.h>
#include "config.h"
#include "defines.h"
-#include "ohash.h"
#include "dir.h"
#include "lst.h"
#include "memory.h"
@@ -196,7 +196,7 @@ static struct ohash_info file_info = {
* entry, and we don't look up in this cache except as a last resort.
*/
struct file_stamp {
- TIMESTAMP mtime; /* time stamp... */
+ struct timespec mtime; /* time stamp... */
char name[1]; /* ...for that file. */
};
@@ -228,7 +228,7 @@ static char *find_file_hashi(struct PathEntry *, const char *, const char *,
static struct file_stamp *find_stampi(const char *, const char *);
/* record_stamp(name, timestamp): record timestamp for name in the global
* cache. */
-static void record_stamp(const char *, TIMESTAMP);
+static void record_stamp(const char *, struct timespec);
static bool read_directory(struct PathEntry *);
/* p = DirReaddiri(name, end): read an actual directory, caching results
@@ -242,7 +242,7 @@ static void DirPrintDir(void *);
***/
static void
-record_stamp(const char *file, TIMESTAMP t)
+record_stamp(const char *file, struct timespec t)
{
unsigned int slot;
const char *end = NULL;
@@ -548,7 +548,7 @@ Dir_FindFileComplexi(const char *name, const char *ename, Lst path,
printf("checking %s...", file);
if (stat(file, &stb) == 0) {
- TIMESTAMP mtime;
+ struct timespec mtime;
ts_set_from_stat(stb, mtime);
if (DEBUG(DIR))
@@ -610,7 +610,7 @@ Dir_FindFileComplexi(const char *name, const char *ename, Lst path,
printf("got it (in mtime cache)\n");
return q;
} else if (stat(q, &stb) == 0) {
- TIMESTAMP mtime;
+ struct timespec mtime;
ts_set_from_stat(stb, mtime);
if (DEBUG(DIR))
@@ -694,14 +694,14 @@ Dir_PrintPath(Lst path)
Lst_Every(path, DirPrintDir);
}
-TIMESTAMP
+struct timespec
Dir_MTime(GNode *gn)
{
char *fullName;
struct stat stb;
struct file_stamp *entry;
unsigned int slot;
- TIMESTAMP mtime;
+ struct timespec mtime;
if (gn->type & OP_PHONY)
return gn->mtime;
diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h
index 5f519cdb2ea..3c0a42d2b86 100644
--- a/usr.bin/make/dir.h
+++ b/usr.bin/make/dir.h
@@ -1,7 +1,7 @@
#ifndef DIR_H
#define DIR_H
-/* $OpenBSD: dir.h,v 1.28 2012/12/07 07:15:31 espie Exp $ */
+/* $OpenBSD: dir.h,v 1.29 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: dir.h,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
@@ -40,9 +40,7 @@
* from: @(#)dir.h 8.1 (Berkeley) 6/6/93
*/
-#ifndef TIMESTAMP_TYPE
-#include "timestamp_t.h"
-#endif
+#include <sys/time.h>
/* dir --
* Directory searching using wildcards and/or normal names...
@@ -115,7 +113,7 @@ extern char *Dir_FindFileComplexi(const char *, const char *, Lst, bool);
* Return specific value if file can't be found, to be tested by
* is_out_of_date().
*/
-extern TIMESTAMP Dir_MTime(GNode *);
+extern struct timespec Dir_MTime(GNode *);
diff --git a/usr.bin/make/dump.c b/usr.bin/make/dump.c
index 60153cc9fe6..9819eb06630 100644
--- a/usr.bin/make/dump.c
+++ b/usr.bin/make/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.3 2012/10/09 19:45:34 espie Exp $ */
+/* $OpenBSD: dump.c,v 1.4 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
@@ -23,13 +23,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
+#include <limits.h>
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <limits.h>
-#include "ohash.h"
+#include <string.h>
+#include <ohash.h>
#include "defines.h"
#include "gnode.h"
#include "dump.h"
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c
index 66e0301582b..65dfd039d8c 100644
--- a/usr.bin/make/engine.c
+++ b/usr.bin/make/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.40 2012/12/07 15:08:03 espie Exp $ */
+/* $OpenBSD: engine.c,v 1.41 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
@@ -63,15 +63,16 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
+#include <limits.h>
#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "config.h"
#include "defines.h"
#include "dir.h"
diff --git a/usr.bin/make/generate.c b/usr.bin/make/generate.c
index d759f99aae0..c771be705a0 100644
--- a/usr.bin/make/generate.c
+++ b/usr.bin/make/generate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: generate.c,v 1.14 2012/10/09 19:45:34 espie Exp $ */
+/* $OpenBSD: generate.c,v 1.15 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -26,12 +26,12 @@
*/
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <ohash.h>
#include "stats.h"
-#include "ohash.h"
#include "cond_int.h"
#include "var_int.h"
#include "node_int.h"
diff --git a/usr.bin/make/gnode.h b/usr.bin/make/gnode.h
index a6cac892d06..7c98d2e2d5b 100644
--- a/usr.bin/make/gnode.h
+++ b/usr.bin/make/gnode.h
@@ -1,6 +1,6 @@
#ifndef GNODE_H
#define GNODE_H
-/* $OpenBSD: gnode.h,v 1.23 2012/10/09 19:45:34 espie Exp $ */
+/* $OpenBSD: gnode.h,v 1.24 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -27,9 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TIMESTAMP_TYPE
-#include "timestamp_t.h"
-#endif
+#include <sys/time.h>
#ifndef LIST_TYPE
#include "lst_t.h"
#endif
@@ -144,9 +142,9 @@ struct GNode_ {
int unmade; /* The number of unmade children */
- TIMESTAMP mtime; /* Its modification time */
- TIMESTAMP cmtime; /* The modification time of its youngest
- * child */
+ struct timespec mtime; /* Its modification time */
+ struct timespec cmtime; /* The modification time of its youngest
+ * child */
GNode *impliedsrc;
LIST cohorts; /* Other nodes for the :: operator */
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 12c406a449f..7ad86885f8e 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: make.c,v 1.65 2012/12/08 12:54:17 espie Exp $ */
+/* $OpenBSD: make.c,v 1.66 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */
/*
@@ -57,9 +57,10 @@
*/
#include <limits.h>
-#include <stdio.h>
#include <signal.h>
#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ohash.h>
diff --git a/usr.bin/make/memory.c b/usr.bin/make/memory.c
index e3090eec537..091c986a519 100644
--- a/usr.bin/make/memory.c
+++ b/usr.bin/make/memory.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memory.c,v 1.8 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: memory.c,v 1.9 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -37,12 +37,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <stddef.h>
-#include <stdint.h>
#include <ohash.h>
#include "defines.h"
#include "memory.h"
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 539a36762e0..cac518e16a7 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: suff.c,v 1.84 2012/12/22 19:02:05 espie Exp $ */
+/* $OpenBSD: suff.c,v 1.85 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */
/*
@@ -60,12 +60,12 @@
*/
#include <ctype.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
#include <string.h>
-#include <signal.h>
#include <ohash.h>
#include "config.h"
#include "defines.h"
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index d50fd849940..c942476f698 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: targ.c,v 1.69 2012/10/09 19:45:34 espie Exp $ */
+/* $OpenBSD: targ.c,v 1.70 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
/*
@@ -97,13 +97,13 @@
#include <limits.h>
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ohash.h>
#include "config.h"
#include "defines.h"
-#include "ohash.h"
#include "stats.h"
#include "suff.h"
#include "var.h"
diff --git a/usr.bin/make/targ.h b/usr.bin/make/targ.h
index 0048f65afa3..78517e3bd1b 100644
--- a/usr.bin/make/targ.h
+++ b/usr.bin/make/targ.h
@@ -1,6 +1,6 @@
#ifndef TARG_H
#define TARG_H
-/* $OpenBSD: targ.h,v 1.12 2012/12/06 14:33:37 espie Exp $ */
+/* $OpenBSD: targ.h,v 1.13 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -27,9 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TIMESTAMP_TYPE
-#include "timestamp_t.h"
-#endif
+#include <sys/time.h>
/*
* The TARG_ constants are used when calling the Targ_FindNode functions.
* They simply tell the function what to do if the desired node is not found.
diff --git a/usr.bin/make/targequiv.c b/usr.bin/make/targequiv.c
index d8d1ee11fb0..a38b4dd4892 100644
--- a/usr.bin/make/targequiv.c
+++ b/usr.bin/make/targequiv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: targequiv.c,v 1.3 2012/10/02 10:29:31 espie Exp $ */
+/* $OpenBSD: targequiv.c,v 1.4 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2007-2008 Marc Espie.
*
@@ -30,16 +30,16 @@
* make.
*/
-#include <stdlib.h>
-#include <stdint.h>
+#include <sys/param.h>
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
-#include <sys/param.h>
+#include <stdlib.h>
#include <string.h>
+#include <ohash.h>
#include "config.h"
#include "defines.h"
#include "memory.h"
-#include "ohash.h"
#include "gnode.h"
#include "lst.h"
#include "suff.h"
diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c
index 116d175b9c8..e00723a6fc8 100644
--- a/usr.bin/make/timestamp.c
+++ b/usr.bin/make/timestamp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timestamp.c,v 1.8 2013/04/22 07:21:52 espie Exp $ */
+/* $OpenBSD: timestamp.c,v 1.9 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -24,12 +24,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/time.h>
#include "config.h"
#include "defines.h"
#include "timestamp.h"
-TIMESTAMP now; /* The time at the start of this whole process */
+struct timespec now; /* The time at the start of this whole process */
int
set_times(const char *f)
@@ -38,7 +39,7 @@ set_times(const char *f)
}
char *
-time_to_string(TIMESTAMP time)
+time_to_string(struct timespec time)
{
struct tm *parts;
static char buf[128];
diff --git a/usr.bin/make/timestamp.h b/usr.bin/make/timestamp.h
index 5033b8b5bc8..e883aa46fe9 100644
--- a/usr.bin/make/timestamp.h
+++ b/usr.bin/make/timestamp.h
@@ -1,7 +1,7 @@
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
-/* $OpenBSD: timestamp.h,v 1.8 2013/04/22 07:21:52 espie Exp $ */
+/* $OpenBSD: timestamp.h,v 1.9 2013/04/23 14:32:53 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -31,7 +31,6 @@
/* This module handles time stamps on files in a relatively high-level way.
* Most of the interface is achieved through inlineable code.
*
- * TIMESTAMP: opaque data type to store a date.
* ts_set_out_of_date(t): set up t so that it is out-of-date.
* b = is_out_of_date(t): check whether t is out-of-date.
* ts_set_from_stat(s, t): grab date out of stat(2) buffer.
@@ -48,11 +47,10 @@
#define Init_Timestamp() ts_set_from_now(now)
-#ifndef TIMESTAMP_TYPE
-#include "timestamp_t.h"
-#endif
-#define ts_set_out_of_date(t) (t).tv_sec = INT_MIN, (t).tv_nsec = 0
-#define is_out_of_date(t) ((t).tv_sec == INT_MIN && (t).tv_nsec == 0)
+#define TMIN (sizeof(time_t) == sizeof(int32_t) ? INT32_MIN : INT64_MIN)
+#define ts_set_out_of_date(t) (t).tv_sec = TMIN, (t).tv_nsec = 0
+#define is_out_of_date(t) ((t).tv_sec == TMIN && (t).tv_nsec == 0)
+
#define ts_set_from_stat(s, t) \
do { \
(t).tv_sec = (s).st_mtime; \
@@ -73,9 +71,9 @@ do { \
extern int set_times(const char *);
-extern TIMESTAMP now; /* The time at the start of this whole
+extern struct timespec now; /* The time at the start of this whole
* process */
-extern char *time_to_string(TIMESTAMP t);
+extern char *time_to_string(struct timespec t);
#endif
diff --git a/usr.bin/make/timestamp_t.h b/usr.bin/make/timestamp_t.h
deleted file mode 100644
index 819600b19eb..00000000000
--- a/usr.bin/make/timestamp_t.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: timestamp_t.h,v 1.4 2013/04/22 07:21:52 espie Exp $ */
-
-/*
- * Copyright (c) 2001 Marc Espie.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
- * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/time.h>
-typedef struct timespec TIMESTAMP;
-
-#define TIMESTAMP_TYPE
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 6ff685a0827..6d3317f74de 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.93 2013/02/15 18:34:25 espie Exp $ */
+/* $OpenBSD: var.c,v 1.94 2013/04/23 14:32:53 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -63,16 +63,16 @@
#include <assert.h>
#include <stddef.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ohash.h>
#include "config.h"
#include "defines.h"
#include "buf.h"
#include "stats.h"
-#include "ohash.h"
#include "pathnames.h"
#include "varmodifiers.h"
#include "var.h"