git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] git-compat-util.h: Add missing semicolon after struct itimerval
@ 2014-08-29 16:42 Jacob Keller
  2014-08-29 16:42 ` [PATCH 2/9] autoconf: Check for " Jacob Keller
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Jacob Keller @ 2014-08-29 16:42 UTC (permalink / raw)
  To: git; +Cc: Jonas 'Sortie' Termansen

From: Jonas 'Sortie' Termansen <sortie@maxsi.org>

This hasn't been a problem in practice as almost all systems have the
setitimer() API (or it is provided by git in the case of mingw). This code
wasn't used in any default circumstances, as the build system never sets
NO_STRUCT_ITIMERVAL - this breakage only occured if the user asked for it.

We repair this case so we can rely on it in the following commits.

Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index f587749b7cf6..f7fae2060771 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -191,7 +191,7 @@ extern int compat_mkdir_wo_trailing_slash(const char*, mode_t);
 struct itimerval {
 	struct timeval it_interval;
 	struct timeval it_value;
-}
+};
 #endif
 
 #ifdef NO_SETITIMER
-- 
2.0.1.475.g9b8d714

^ permalink raw reply related	[flat|nested] 26+ messages in thread
* [PATCH 0/9] Use timer_settime for new platforms
@ 2014-08-28  1:04 Jonas 'Sortie' Termansen
  2014-08-28  1:04 ` [PATCH 8/9] autoconf: Check for timer_settime Jonas 'Sortie' Termansen
  0 siblings, 1 reply; 26+ messages in thread
From: Jonas 'Sortie' Termansen @ 2014-08-28  1:04 UTC (permalink / raw)
  To: git

Hi,

I have ported git to my homemade custom operating system. It implements the
modern core POSIX interface and by design doesn't implement older
obsolescent interfaces that has standardized superior replacements. This
causes some problems here and there, this patch series fixes one of them.

Git uses the setitimer() function to deliver a steady supply of signals,
which cause nice progress bars to show when operations take a long time.
However, this function is part of the XSI option (i.e. not core POSIX) and
has been marked as obsolescent in the latest standard revision (it will
likely be removed in the next revision). Application developers are instead
encouraged to use the timer_settime functions instead as they are more
powerful and are part of core POSIX (added in POSIX 2001).

This patch series transitions git to use the timer_settime function instead
of the setitimer function. The function is widely, but not universally
available on the platforms git current supports, so I need to be careful not
to introduce regressions.

I handle compatibility by checking if setitimer and timer_settime are
available (as well as the structures and types they need). git-compat-util.h
provides stubs for anything that is missing. The real code can then simply
try to use timer_create, and if it fails (such as with ENOSYS on platforms
that has the function, but no real implementation) it falls back on the
older setitimer function.

My first attempt at compatibility was simply adding #ifdef around all the
timer_settime calls, but this proved to be an unmaintainable maze of
preprocessor conditionals. Instead I adopted the approach already used when
setitimer is missing: Just using a preprocessor function macro that expands
calls to nothing, allowing code to pretend it's always there.

To properly pretend timer_settime is available when it's not, I had to stub
the timer_t, struct timespec, struct itimerspec, and struct sigevent types
if they were missing.

I have attempted to properly add make variables for each compatibility case
as well as proper configure tests. Autoconf is not my strong suit, but the
tests appears to be working.

This patch series breaks the build for people using just config.mak.uname
(and not the configure script) on platforms that doesn't have the used types
and functions (timer_t, timespec, itimerspec, sigevent, timer_settime) as
config.mak.uname doesn't yet have NO_FOO cases for those systems. That's
just because I don't have that all of those systems available. It does look
like Cygwin, FreeBSD, Linux, NetBSD, Minix, and OpenBSD have the API at
least. I believe I added the required NO_FOO variables for Darwin, MinGW and
Windows. If you have other systems available, you can help me by telling me
if they need some NO_FOO love in config.mak.uname as well. :-)

Jonas 'Sortie' Termansen

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-09-10 21:13 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 2/9] autoconf: Check for " Jacob Keller
2014-08-29 16:42 ` [PATCH 3/9] autoconf: Check for setitimer Jacob Keller
2014-08-29 16:42 ` [PATCH 4/9] autoconf: Check for timer_t Jacob Keller
2014-08-29 18:20   ` Jonas 'Sortie' Termansen
2014-08-29 16:42 ` [PATCH 5/9] autoconf: Check for struct timespec Jacob Keller
2014-08-29 16:42 ` [PATCH 6/9] autoconf: Check for struct sigevent Jacob Keller
2014-08-29 16:42 ` [PATCH 7/9] autoconf: Check for struct itimerspec 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
2014-08-29 16:42 ` [PATCH 9/9] Use timer_settime for new platforms Jacob Keller
2014-08-29 18:02   ` Junio C Hamano
2014-08-29 18:09     ` Keller, Jacob E
2014-08-29 18:12   ` Junio C Hamano
2014-08-29 16:48 ` [PATCH 1/9] git-compat-util.h: Add missing semicolon after struct itimerval Keller, Jacob E
2014-08-29 18:54   ` Jonas 'Sortie' Termansen
2014-08-29 19:07     ` Junio C Hamano
2014-08-29 19:43       ` Jonas 'Sortie' Termansen
2014-09-03  0:17         ` Keller, Jacob E
  -- strict thread matches above, loose matches on Subject: below --
2014-08-28  1:04 [PATCH 0/9] Use timer_settime for new platforms Jonas 'Sortie' Termansen
2014-08-28  1:04 ` [PATCH 8/9] autoconf: Check for timer_settime Jonas 'Sortie' Termansen
2014-08-29 15:23   ` Keller, Jacob E
2014-08-29 16:02     ` Jonas 'Sortie' Termansen

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).