[haiku-bugs] Re: [Haiku] #3353: resource.h broken (not implemented yet?)

  • From: "Timothy_Gu" <trac@xxxxxxxxxxxx>
  • Date: Sun, 11 Jan 2015 22:58:20 -0000

#3353: resource.h broken (not implemented yet?)
-------------------------+---------------------------
   Reporter:  scottmc    |      Owner:  axeld
       Type:  bug        |     Status:  new
   Priority:  normal     |  Milestone:  R1
  Component:  - General  |    Version:  R1/pre-alpha1
 Resolution:             |   Keywords:
 Blocked By:             |   Blocking:
Has a Patch:  0          |   Platform:  All
-------------------------+---------------------------

Comment (by Timothy_Gu):

 My program used to test `getrusage()`:

 {{{
 #!c
 #include <errno.h>
 #include <stdio.h>
 #include <sys/resource.h>

 // From https://github.com/python/cpython/blob/2.7/Modules/resource.c#L20
 #define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001)

 int
 main()
 {
     struct rusage ru = {0};
     int ret;
     ret = getrusage(RUSAGE_SELF, &ru);
     printf("%d %d %f %f\n", ret, errno, doubletime(ru.ru_utime),
 doubletime(ru.ru_stime));
     return ret;
 }
 }}}

 It prints something like this:

 {{{
 0 0 0.1034 0.1620
 }}}

 The first two 0's indicate that there is no error (`ret` and `errno`
 resp.).

--
Ticket URL: <https://dev.haiku-os.org/ticket/3353#comment:5>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: