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

  • From: "Timothy_Gu" <trac@xxxxxxxxxxxx>
  • Date: Sun, 11 Jan 2015 22:07:48 -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):

 Apparently only part of POSIX spec for [gs]et_rlimit is implemented, and
 when it encounters an unimplemented property it just returns EINVAL.

 See
 
https://github.com/haiku/haiku/blob/449f7f5a7b9d381c1eeab3ddfbdba0db0ce05c22/src/system/kernel/thread.cpp#L1310-L1327

 I'm not sure what the right thing to do is here. Should I make it return
 ENOSYS instead? But that would break a lot of apps relying on POSIX. Or I
 could make it return 0 as the values.

 List of unimplemented properties:

 * `RLIMIT_CPU`: maximum amount of CPU time, in seconds, used by a process
 * `RLIMIT_DATA`: maximum size of a process' data segment, in bytes
 * `RLIMIT_FSIZE`: maximum size of a file, in bytes, that may be created by
 a process
 * `RLIMIT_STACK` (implemented in `get_rlimit()` but not in `set`): maximum
 size of the initial thread's stack, in bytes
 * `RLIMIT_AS`: maximum size of a process' total available memory, in bytes

 I will investigate the `getrusage()` failure soon.

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

Other related posts: