git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: "'Junio C Hamano'" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: RE: [PATCH v4] Support for setitimer() on platforms lacking it
Date: Sat, 8 Sep 2012 18:54:34 +0200	[thread overview]
Message-ID: <001e01cd8de2$a07f3930$e17dab90$@schmitz-digital.de> (raw)

HP NonStop (currently) doesn't have setitimer().
As setitimer() is only used in cases of perceived latency and it doesn't affect
correctness, it gets disabled entirely if NO_SETITIMER is set.
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>
---
 Makefile          | 12 ++++++++++++
 git-compat-util.h | 11 +++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index ac49320..7be555b 100644
--- 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)
 #
@@ -1647,6 +1652,13 @@
 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
diff --git a/git-compat-util.h b/git-compat-util.h
index 18089f0..4628d7a 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -162,6 +162,17 @@
 #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
+
 #ifdef MKDIR_WO_TRAILING_SLASH
 #define mkdir(a,b) compat_mkdir_wo_trailing_slash((a),(b))
 extern int compat_mkdir_wo_trailing_slash(const char*, mode_t);
-- 
1.7.12

             reply	other threads:[~2012-09-08 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08 16:54 Joachim Schmitz [this message]
2012-09-09  4:47 ` [PATCH v4] Support for setitimer() on platforms lacking it Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001e01cd8de2$a07f3930$e17dab90$@schmitz-digital.de' \
    --to=jojo@schmitz-digital.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).