[PATCH 0/9] Use timer_settime for new platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]