Add a no-op setitimer() wrapper
authorJoachim Schmitz <jojo@schmitz-digital.de>
Sat, 8 Sep 2012 16:54:34 +0000 (18:54 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Sep 2012 03:35:19 +0000 (20:35 -0700)
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>
Makefile
git-compat-util.h
index 6b0c961d3acd6eb476c979e51f32a258e15c743d..f93bf1959ae47fabd0e927aa4876ea3b135f2623 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -157,6 +157,11 @@ all::
 # Define NO_PREAD if you have a problem with pread() system call (e.g.
 # cygwin1.dll before v1.5.22).
 #
+# Define NO_SETITIMER if you don't have setitimer()
+#
+# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
+# This also implies NO_SETITIMER
+#
 # Define NO_THREAD_SAFE_PREAD if your pread() implementation is not
 # thread-safe. (e.g. compat/pread.c or cygwin)
 #
@@ -1670,6 +1675,13 @@ endif
 ifdef OBJECT_CREATION_USES_RENAMES
        COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
 endif
+ifdef NO_STRUCT_ITIMERVAL
+       COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
+       NO_SETITIMER=YesPlease
+endif
+ifdef NO_SETITIMER
+       COMPAT_CFLAGS += -DNO_SETITIMER
+endif
 ifdef NO_PREAD
        COMPAT_CFLAGS += -DNO_PREAD
        COMPAT_OBJS += compat/pread.o
index 35b095e8ae989ae02228f814528b43d5bd026aab..3515366b129b7343d15c67bc8e4fe3c83e0b1f7d 100644 (file)
 #define probe_utf8_pathname_composition(a,b)
 #endif
 
+#ifdef NO_STRUCT_ITIMERVAL
+struct itimerval {
+       struct timeval it_interval;
+       struct timeval it_value;
+}
+#endif
+
+#ifdef NO_SETITIMER
+#define setitimer(which,value,ovalue)
+#endif
+
 #ifndef NO_LIBGEN_H
 #include <libgen.h>
 #else