Add a no-op setitimer() wrapper
The current code uses setitimer() only for reducing perceived latency. On platforms that lack setitimer() (e.g. HP NonStop), allow builders to say "make NO_SETITIMER=YesPlease" to use a no-op substitute, as doing so would not affect correctness. HP NonStop does provide struct itimerval, but other platforms may not, so this is taken care of in this commit too, by setting NO_STRUCT_ITIMERVAL. Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Joachim Schmitz committed
Sep 8, 2012 at 18:54 UTC
7f9e848cf82311792ccfb286e64846fe6f3d5476
2 files changed
+23
Makefile
+12
@@ -157,6 +157,11 @@ all::
157
# Define NO_PREAD if you have a problem with pread() system call (e.g.
158
# cygwin1.dll before v1.5.22).
159
#
160
+# Define NO_SETITIMER if you don't have setitimer()
161
+#
162
+# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
163
+# This also implies NO_SETITIMER
164
+#
165
# Define NO_THREAD_SAFE_PREAD if your pread() implementation is not
166
# thread-safe. (e.g. compat/pread.c or cygwin)
167
#
@@ -1670,6 +1675,13 @@ endif
1675
ifdef OBJECT_CREATION_USES_RENAMES
1676
COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
1677
endif
1678
+ifdef NO_STRUCT_ITIMERVAL
1679
+ COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
1680
+ NO_SETITIMER=YesPlease
1681
+endif
1682
+ifdef NO_SETITIMER
1683
+ COMPAT_CFLAGS += -DNO_SETITIMER
1684
+endif
1685
ifdef NO_PREAD
1686
COMPAT_CFLAGS += -DNO_PREAD
1687
COMPAT_OBJS += compat/pread.o
git-compat-util.h
+11
@@ -162,6 +162,17 @@
162
#define probe_utf8_pathname_composition(a,b)
163
#endif
164
165
+#ifdef NO_STRUCT_ITIMERVAL
166
+struct itimerval {
167
+ struct timeval it_interval;
168
+ struct timeval it_value;
169
+}
170
+#endif
171
+
172
+#ifdef NO_SETITIMER
173
+#define setitimer(which,value,ovalue)
174
+#endif
175
+
176
#ifndef NO_LIBGEN_H
177
#include <libgen.h>
178
#else