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

Re: Porting git to HP NonStop

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 22, 2012, 20:49 UTC
Message-ID
<7v628a7iu5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<004401cd80a3$4b0cff60$e126fe20$@schmitz-digital.de>
"Joachim Schmitz" <jojo@schmitz-digital.de> writes:
Show 12 quoted lines
> Hi folks
>
> There another API missing on HP NonStop and that is setitimer(), used in progress.c and build/log.c
> I do have a homebrewed implementation, on top of alarm(), it goes like this:
>
> #include "../git-compat-util.h"
> #undef getitimer
> #undef setitimer
>
>
> int
> git_getitimer(int which, struct itimerval *value)
See Documentation/CodingGuidelines for style nits.
Show 52 quoted lines
> {
>         int ret = 0;
>
>         switch (which) {
>                 case ITIMER_REAL:
>                         value->it_value.tv_usec = 0;
>                         value->it_value.tv_sec = alarm(0);
>                         ret = 0; /* if alarm() fails we get a SIGLIMIT */
>                         break;
>                 case ITIMER_VIRTUAL: /* FALLTHRU */
>                 case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
>                 default: errno = EINVAL; ret = -1;
>         }
>         return ret;
> }
>
> int
> git_setitimer(int which, const struct itimerval *value,
>                         struct itimerval *ovalue)
> {
>         int ret = 0;
>
>         if (!value
>                 || value->it_value.tv_usec < 0
>                 || value->it_value.tv_usec > 1000000
>                 || value->it_value.tv_sec < 0) {
>                 errno = EINVAL;
>                 return -1;
>         }
>
>         else if (ovalue)
>                 if (!git_getitimer(which, ovalue))
>                         return -1; /* errno set in git_getitimer() */
>
>         else
>         switch (which) {
>                 case ITIMER_REAL:
>                         alarm(value->it_value.tv_sec +
>                                 (value->it_value.tv_usec > 0) ? 1 : 0);
>                         ret = 0; /* if alarm() fails we get a SIGLIMIT */
>                         break;
>                 case ITIMER_VIRTUAL: /* FALLTHRU */
>                 case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
>                 default: errno = EINVAL; ret = -1;
>         }
>
>         return ret;
> }
>
>
> Worth being added to compat/, e.g. as setitimer.c, or, as itimer.c
> (as a by-product, it has getitimer() too)?

If it helps your port, compat/itimer.c sounds like a good place. Doesn't it need a new header file to introduce structures and constants, too?

Previous: Joachim SchmitzNext: Joachim Schmitz
Message 30 of 39 in “RE: Porting git to HP NonStop”
  1. Joachim SchmitzAug 10, 2012
  2. Shawn PearceAug 10, 2012
  3. Joachim SchmitzAug 10, 2012
  4. Shawn PearceAug 10, 2012
  5. Joachim SchmitzAug 19, 2012
  6. Junio C HamanoAug 19, 2012
  7. Joachim SchmitzAug 20, 2012
  8. Junio C HamanoAug 20, 2012
  9. Joachim SchmitzAug 20, 2012
  10. Junio C HamanoAug 20, 2012
  11. Joachim SchmitzAug 22, 2012
  12. Brandon CaseyAug 22, 2012
  13. Brandon CaseyAug 22, 2012
  14. Joachim SchmitzAug 22, 2012
  15. Brandon CaseyAug 22, 2012
  16. Joachim SchmitzAug 22, 2012
  17. Junio C HamanoAug 22, 2012
  18. Joachim SchmitzAug 22, 2012
  19. Junio C HamanoAug 22, 2012
  20. Joachim SchmitzAug 22, 2012
  21. Johannes SixtAug 22, 2012
  22. Joachim SchmitzAug 22, 2012
  23. Johannes SixtAug 22, 2012
  24. Joachim SchmitzAug 22, 2012
  25. Brandon CaseyAug 22, 2012
  26. Brandon CaseyAug 22, 2012
  27. Junio C HamanoAug 22, 2012
  28. Brandon CaseyAug 22, 2012
  29. Joachim SchmitzAug 22, 2012
  30. Junio C HamanoAug 22, 2012
  31. Joachim SchmitzAug 22, 2012
  32. Junio C HamanoAug 22, 2012
  33. Joachim SchmitzAug 22, 2012
  34. Junio C HamanoAug 22, 2012
  35. Junio C HamanoAug 22, 2012
  36. Joachim SchmitzAug 10, 2012
  37. Johannes SixtAug 11, 2012
  38. Joachim SchmitzAug 14, 2012
  39. Junio C HamanoAug 14, 2012

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.