From: Jonas 'Sortie' Termansen <sortie@maxsi.org>
To: git@vger.kernel.org
Cc: Jonas 'Sortie' Termansen <sortie@maxsi.org>
Subject: [PATCH 8/9] autoconf: Check for timer_settime
Date: Thu, 28 Aug 2014 03:04:21 +0200 [thread overview]
Message-ID: <1409187862-21257-9-git-send-email-sortie@maxsi.org> (raw)
In-Reply-To: <1409187862-21257-1-git-send-email-sortie@maxsi.org>
This function will be used in a following commit.
The timer_settime function is provided in librt on some systems. We
already use this library sometimes to get clock_gettime, so rework the
logic so we don't link with it twice.
This function was not previously used by git. This can cause trouble for
people on systems without timer_settime if they only rely on
config.mak.uname. They will need to set NO_TIMER_SETTIME manually.
Add proper replacement function macros for setitimer and timer_settime
that evaluates the arguments and fails with ENOSYS to simulate stub
implementations. This will be useful in a following commit.
Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
---
This patch can be improved by finding out which systems doesn't have
timer_settime and adding entries for them to config.mak.uname.
Makefile | 21 +++++++++++++++++++++
config.mak.uname | 3 +++
configure.ac | 8 ++++++++
git-compat-util.h | 8 +++++++-
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 66329e4..5609e44 100644
--- a/Makefile
+++ b/Makefile
@@ -182,16 +182,22 @@ all::
#
# Define NO_SETITIMER if you don't have setitimer()
#
+# Define NO_TIMER_SETTIME if you don't have timer_settime()
+#
# Define NO_TIMER_T if you don't have timer_t.
+# This also implies NO_SETITIMER
#
# Define NO_STRUCT_TIMESPEC if you don't have struct timespec
+# This also implies NO_SETITIMER
#
# Define NO_STRUCT_SIGEVENT if you don't have struct sigevent
+# This also implies NO_SETITIMER
#
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
# This also implies NO_SETITIMER
#
# Define NO_STRUCT_ITIMERSPEC if you don't have struct itimerspec
+# This also implies NO_TIMER_SETTIME
#
# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
# generally faster on your platform than accessing the working directory.
@@ -1348,12 +1354,15 @@ ifdef OBJECT_CREATION_USES_RENAMES
endif
ifdef NO_TIMER_T
COMPAT_CFLAGS += -DNO_TIMER_T
+ NO_TIMER_SETTIME = YesPlease
endif
ifdef NO_STRUCT_TIMESPEC
COMPAT_CFLAGS += -DNO_STRUCT_TIMESPEC
+ NO_TIMER_SETTIME = YesPlease
endif
ifdef NO_STRUCT_SIGEVENT
COMPAT_CFLAGS += -DNO_STRUCT_SIGEVENT
+ NO_TIMER_SETTIME = YesPlease
endif
ifdef NO_STRUCT_ITIMERVAL
COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
@@ -1361,10 +1370,14 @@ ifdef NO_STRUCT_ITIMERVAL
endif
ifdef NO_STRUCT_ITIMERSPEC
COMPAT_CFLAGS += -DNO_STRUCT_ITIMERSPEC
+ NO_TIMER_SETTIME = YesPlease
endif
ifdef NO_SETITIMER
COMPAT_CFLAGS += -DNO_SETITIMER
endif
+ifdef NO_TIMER_SETTIME
+ COMPAT_CFLAGS += -DNO_TIMER_SETTIME
+endif
ifdef NO_PREAD
COMPAT_CFLAGS += -DNO_PREAD
COMPAT_OBJS += compat/pread.o
@@ -1524,6 +1537,14 @@ endif
ifdef HAVE_CLOCK_GETTIME
BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
+ LINK_WITH_LIBRT = YesPlease
+endif
+
+ifndef NO_TIMER_SETTIME
+ LINK_WITH_LIBRT = YesPlease
+endif
+
+ifdef LINK_WITH_LIBRT
EXTLIBS += -lrt
endif
diff --git a/config.mak.uname b/config.mak.uname
index f0d93ef..d04deab 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -99,6 +99,7 @@ ifeq ($(uname_S),Darwin)
USE_ST_TIMESPEC = YesPlease
HAVE_DEV_TTY = YesPlease
NO_STRUCT_ITIMERSPEC = UnfortunatelyYes
+ NO_TIMER_SETTIME = UnfortunatelyYes
COMPAT_OBJS += compat/precompose_utf8.o
BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
endif
@@ -360,6 +361,7 @@ ifeq ($(uname_S),Windows)
NO_STRUCT_TIMESPEC = UnfortunatelyYes
NO_STRUCT_SIGEVENT = UnfortunatelyYes
NO_STRUCT_ITIMERSPEC = UnfortunatelyYes
+ NO_TIMER_SETTIME = UnfortunatelyYes
CC = compat/vcbuild/scripts/clink.pl
AR = compat/vcbuild/scripts/lib.pl
@@ -513,6 +515,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_STRUCT_TIMESPEC = UnfortunatelyYes
NO_STRUCT_SIGEVENT = UnfortunatelyYes
NO_STRUCT_ITIMERSPEC = UnfortunatelyYes
+ NO_TIMER_SETTIME = UnfortunatelyYes
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
diff --git a/configure.ac b/configure.ac
index 89eb48f..354bd38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -945,6 +945,14 @@ GIT_CHECK_FUNC(setitimer,
[NO_SETITIMER=YesPlease])
GIT_CONF_SUBST([NO_SETITIMER])
#
+# Define NO_TIMER_SETTIME if you don't have timer_settime
+GIT_CHECK_FUNC(timer_settime,
+[NO_TIMER_SETTIME=],
+[AC_SEARCH_LIBS(timer_settime,[rt],
+ [NO_TIMER_SETTIME=],
+ [NO_TIMER_SETTIME=YesPlease])])
+GIT_CONF_SUBST([NO_TIMER_SETTIME])
+#
# Define NO_STRCASESTR if you don't have strcasestr.
GIT_CHECK_FUNC(strcasestr,
[NO_STRCASESTR=],
diff --git a/git-compat-util.h b/git-compat-util.h
index 4ef17df..91bbf6d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -225,7 +225,13 @@ struct itimerspec {
#endif
#ifdef NO_SETITIMER
-#define setitimer(which,value,ovalue)
+#define setitimer(which,value,ovalue) ((void) (which), (void) (value), (void) (ovalue), errno = ENOSYS, -1)
+#endif
+
+#ifdef NO_TIMER_SETTIMER
+#define timer_create(clockid, sevp, timerp) ((void) (clockid), (void) (sevp), (void) (timerp), errno = ENOSYS, -1)
+#define timer_settime(timer, flags, value, ovalue) ((void) (timer), (void) (flags), (void) (value), (void) (ovalue), errno = ENOSYS, -1)
+#define timer_delete(timer) ((void) (timer), errno = ENOSYS, -1)
#endif
#ifndef NO_LIBGEN_H
--
2.1.0
next prev parent reply other threads:[~2014-08-28 1:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 1:04 [PATCH 0/9] Use timer_settime for new platforms Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 1/9] git-compat-util.h: Add missing semicolon after struct itimerval Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 2/9] autoconf: Check for timer_t Jonas 'Sortie' Termansen
2014-08-28 12:03 ` Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 3/9] autoconf: Check for struct timespec Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 4/9] autoconf: Check for struct sigevent Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 5/9] autoconf: Check for struct itimerval Jonas 'Sortie' Termansen
2014-08-28 19:38 ` Junio C Hamano
2014-08-28 1:04 ` [PATCH 6/9] autoconf: Check for struct itimerspec Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 7/9] autoconf: Check for setitimer Jonas 'Sortie' Termansen
2014-08-28 1:04 ` Jonas 'Sortie' Termansen [this message]
2014-08-29 15:23 ` [PATCH 8/9] autoconf: Check for timer_settime Keller, Jacob E
2014-08-29 16:02 ` Jonas 'Sortie' Termansen
2014-08-28 1:04 ` [PATCH 9/9] Use timer_settime for new platforms Jonas 'Sortie' Termansen
2014-08-28 19:43 ` Junio C Hamano
2014-08-29 16:11 ` Keller, Jacob E
-- strict thread matches above, loose matches on Subject: below --
2014-08-29 16:42 [PATCH 1/9] git-compat-util.h: Add missing semicolon after struct itimerval Jacob Keller
2014-08-29 16:42 ` [PATCH 8/9] autoconf: Check for timer_settime Jacob Keller
2014-08-29 17:26 ` Johannes Sixt
2014-08-29 17:40 ` Keller, Jacob E
2014-09-10 15:33 ` Karsten Blees
2014-09-10 21:08 ` Junio C Hamano
2014-09-10 21:13 ` Keller, Jacob E
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=1409187862-21257-9-git-send-email-sortie@maxsi.org \
--to=sortie@maxsi.org \
--cc=git@vger.kernel.org \
/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).