git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 9/9] Use timer_settime for new platforms

From
Keller, Jacob E <jacob.e.keller@intel.com>
Date
Aug 29, 2014, 18:09 UTC
Message-ID
<1409335794.18778.23.camel@jekeller-desk1.amr.corp.intel.com>
In-Reply-To
<xmqqd2bj6uol.fsf@gitster.dls.corp.google.com>
On Fri, 2014-08-29 at 11:02 -0700, Junio C Hamano wrote:
Show 38 quoted lines
> Jacob Keller <jacob.e.keller@intel.com> writes:
> 
> > From: Jonas 'Sortie' Termansen <sortie@maxsi.org>
> >
> > setitimer() is an obsolescent XSI interface and may be removed in a
> > future standard. Applications should use the core POSIX timer_settime()
> > instead.
> >
> > 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.
> 
> Doesn't this paragraph need tweaking?  I think you lost (which is a
> good thing) "notice that timer_settime() call failed with ENOSYS and
> switch to setitimer()", no?
> 
> > Clean up the progress reporting and change it to use timer_settime,
> > which will fall back to setitimer automatically if timer_settime is not
> > supported. (see git-compat-util.h for how it does this). If both
> > functions are not present, then git-compat-util.h provides replacements
> > which will always fail with ENOSYS.
> 
> While this paragraph may be true if patch 8b and 9 are taken
> together, isn't what it describes mostly what 8b did, not 9?
> 
> Here by 8b I mean the change to git-compat-util.h in 8; the patch
> might want to be split into two, 8a for the autoconf part whose log
> message may begin with "This function was not previously used by
> git." and 8b that adds an emulation of timer_settime() API in terms
> of setitimer() API, or the other way around.
> 
> What 9 did is only "we used to use the setitmer() API to implement
> the progress reporting; now we use timer_settime() API" (yes, it is
> thanks to the abstraction given by 8, but the "callers has to only
> know about one API, not worrying about the other API" is a merit
> attributable to 8b, not this one).
> 

You are correct. I can re-base these patches and split them apart a bit better.

Regards, Jake

Show 16 quoted lines
> > The approach used here enables us to use a single API (timer_settime)
> > without having to worry about checking for #ifdefs or if blocks which
> > make it an unreadable nightmare. The major downside is for systems
> > without timer_settime support, they may fall back on a wrapped
> > implementation which could have subtle differences. This should be a
> > minor issue as almost all modern systems provide timer_settime support.
> 
> As this paragraph.
> 
> > Note that this change means that git should never use setitimer on its
> > own now, as the fallback implementation of timer_settime assumes that it
> > is the sole user of ITIMER_REAL, and timer_delete will reset the
> > ITIMER_REAL.
> 
> And this one.
> 
Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 23 in “git-compat-util.h: Add missing semicolon after struct itimerval”
  1. 1/9 git-compat-util.h: Add missing semicolon after struct itimervalJacob Keller, Aug 29, 2014
  2. 2/9 autoconf: Check for struct itimervalJacob Keller, Aug 29, 2014
  3. 3/9 autoconf: Check for setitimerJacob Keller, Aug 29, 2014
  4. 4/9 autoconf: Check for timer_tJacob Keller, Aug 29, 2014
  5. Jonas 'Sortie' TermansenAug 29, 2014
  6. 5/9 autoconf: Check for struct timespecJacob Keller, Aug 29, 2014
  7. 6/9 autoconf: Check for struct sigeventJacob Keller, Aug 29, 2014
  8. 7/9 autoconf: Check for struct itimerspecJacob Keller, Aug 29, 2014
  9. 8/9 autoconf: Check for timer_settimeJacob Keller, Aug 29, 2014
  10. Johannes SixtAug 29, 2014
  11. Keller, Jacob EAug 29, 2014
  12. Karsten BleesSep 10, 2014
  13. Junio C HamanoSep 10, 2014
  14. Keller, Jacob ESep 10, 2014
  15. 9/9 Use timer_settime for new platformsJacob Keller, Aug 29, 2014
  16. Junio C HamanoAug 29, 2014
  17. Keller, Jacob EAug 29, 2014
  18. Junio C HamanoAug 29, 2014
  19. Keller, Jacob EAug 29, 2014
  20. Jonas 'Sortie' TermansenAug 29, 2014
  21. Junio C HamanoAug 29, 2014
  22. Jonas 'Sortie' TermansenAug 29, 2014
  23. Keller, Jacob ESep 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.