summaryrefslogtreecommitdiffstats
path: root/include/time.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-12-07 21:10:06 +0000
committermarcel <marcel@FreeBSD.org>2003-12-07 21:10:06 +0000
commit89b1ef2eaa8f8599da1b52f5e9393dda6fcbd8e8 (patch)
tree9b033e9ca59d72fe94f812d9b6d08476039b8049 /include/time.h
parente9b8241ac79bbe4abe781d5d5fde761882ac90a1 (diff)
downloadFreeBSD-src-89b1ef2eaa8f8599da1b52f5e9393dda6fcbd8e8.zip
FreeBSD-src-89b1ef2eaa8f8599da1b52f5e9393dda6fcbd8e8.tar.gz
Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency in the following two ways: 1. The first 8 arguments are always passed in registers on ia64, which by virtue of the generated code implicitly widens ints to longs and allows the use of an 32-bit integral type for 64-bit arguments. Subsequent arguments are passed onto the memory stack, which does not exhibit the same behaviour and consequently do not allow this. In practice this means that variadic functions taking pointers and given NULL (without cast) work as long as the NULL is passed in one of the first 8 arguments. A SIGSEGV is more likely the result if such would be done for stack-based arguments. This is due to the fact that the upper 4 bytes remain undefined. 2. All 64-bit platforms that FreeBSD supports, with the obvious exception of ia64, allow 32-bit integral types (specifically NULL) when 64-bit pointers are expected in variadic functions by way of how the compiler generates code. As such, code that works correctly (whether rightfully so or not) on any platform other than ia64, may fail on ia64. To more easily allow tweaking of the definition of NULL, this commit removes the 12 definitions in the various headers and puts it in a new header that can be included whenever NULL is to be made visible. This commit fixes GNOME, emacs, xemacs and a whole bunch of ports that I don't particularly care about at this time...
Diffstat (limited to 'include/time.h')
-rw-r--r--include/time.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/include/time.h b/include/time.h
index c7ba4f0..7a10790 100644
--- a/include/time.h
+++ b/include/time.h
@@ -46,6 +46,7 @@
#define _TIME_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
@@ -59,10 +60,6 @@
/* Frequency of the clock ticks reported by clock(). */
#define CLOCKS_PER_SEC 128
-#ifndef NULL
-#define NULL 0
-#endif
-
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED
OpenPOWER on IntegriCloud