Skip to content

Commit 7f9e848

Browse files
Jojo-Schmitzgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fab4b04 commit 7f9e848

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ all::
157157
# Define NO_PREAD if you have a problem with pread() system call (e.g.
158158
# cygwin1.dll before v1.5.22).
159159
#
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+
#
160165
# Define NO_THREAD_SAFE_PREAD if your pread() implementation is not
161166
# thread-safe. (e.g. compat/pread.c or cygwin)
162167
#
@@ -1670,6 +1675,13 @@ endif
16701675
ifdef OBJECT_CREATION_USES_RENAMES
16711676
COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
16721677
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
16731685
ifdef NO_PREAD
16741686
COMPAT_CFLAGS += -DNO_PREAD
16751687
COMPAT_OBJS += compat/pread.o

git-compat-util.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@
162162
#define probe_utf8_pathname_composition(a,b)
163163
#endif
164164

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+
165176
#ifndef NO_LIBGEN_H
166177
#include <libgen.h>
167178
#else

0 commit comments

Comments
 (0)