1From 96b303caf70a7635953c36e5bfb9ad6e75cb7637 Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Fri, 14 Feb 2020 14:12:59 -0800 4Subject: [PATCH] clock: Do not define own timespec 5 6timespec is provided by libc and its best left to libc 7os_gettime takes a db_timespec and passed its address to clock_gettime 8which assumes that db_timespec and timespec are same but actually 9its 12-bytes here and libc has 16-bytes 10 11This can cause problems especially with 64bit time_t 12 13Upstream-Status: Inappropriate [as far as open source community is concerned, upstream is dead] 14Signed-off-by: Khem Raj <raj.khem@gmail.com> 15--- 16 src/dbinc/clock.h | 17 +---------------- 17 1 file changed, 1 insertion(+), 16 deletions(-) 18 19--- a/src/dbinc/clock.h 20+++ b/src/dbinc/clock.h 21@@ -44,22 +44,8 @@ 22 extern "C" { 23 #endif 24 25-/* 26- * This declaration is POSIX-compatible. Because there are lots of different 27- * time.h include file patterns out there, it's easier to declare our own name 28- * in all cases than to try and discover if a system has a struct timespec. 29- * For the same reason, and because we'd have to #include <sys/time.h> in db.h, 30- * we don't export any timespec structures in the DB API, even in places where 31- * it would make sense, like the replication statistics information. 32- */ 33-typedef struct { 34- time_t tv_sec; /* seconds */ 35-#ifdef HAVE_MIXED_SIZE_ADDRESSING 36- int32_t tv_nsec; 37-#else 38- long tv_nsec; /* nanoseconds */ 39-#endif 40-} db_timespec; 41+#include <time.h> 42+#define db_timespec struct timespec 43 44 /* Operations on timespecs */ 45 #undef timespecclear 46