All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonas 'Sortie' Termansen <sortie@maxsi.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 9/9] Use timer_settime for new platforms
Date: Thu, 28 Aug 2014 12:43:03 -0700	[thread overview]
Message-ID: <xmqq61hc9z94.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1409187862-21257-10-git-send-email-sortie@maxsi.org> (Jonas Termansen's message of "Thu, 28 Aug 2014 03:04:22 +0200")

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

> setitimer() is an obsolescent XSI interface and may be removed in a
> future standard. Applications should use the core POSIX timer_settime()
> instead.
>
> This patch cleans up the progress reporting and changes it to try using
> timer_settime, or if that fails, setitimer. If either function is not
> provided by the system, then git-compat-util.h provides replacements
> that always fail with ENOSYS.
>
> It's important that code doesn't simply check if timer_settime is
> available as it can give false positives. Some systems like contemporary
> OpenBSD provides the function, but it unconditionally fails with ENOSYS
> at runtime.
>
> This approach allows the code using timer_settime() and setitimer() to
> be simple and readable. My first attempt used #ifdef around each use of
> timer_settime(), this quickly turned a into unmaintainable maze of
> preprocessor conditionals.
>
> Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
> ---
>  builtin/log.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
>  progress.c    | 34 +++++++++++++++++++++++++++-------
>  2 files changed, 67 insertions(+), 14 deletions(-)

Yuck.  I didn't look at the change very carefully, but are the two
interface so vastly different that you cannot emulate one in terms
of the other, and use a single API at the callsites, isolating the
knowledge of which kind of API is used to interact with the system
timer in one place (perhaps in compat/itimer.c)?

Having to sprinkle "if (is_using_timer_settime)" around means we
need to support two APIs at each and every callsite that wants timer
interrupt actions.

  reply	other threads:[~2014-08-28 19:43 UTC|newest]

Thread overview: 20+ 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 ` [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
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 [this message]
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 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

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=xmqq61hc9z94.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sortie@maxsi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.