Change pid_t base type

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Wed Aug 1 20:20:00 GMT 2018


On 2018-08-01 08:22, Joel Sherrill wrote:
> On Wed, Aug 1, 2018, 9:04 AM Henri Chataing wrote:
>> I am currently porting newlib to our platform provencore, which uses
>> 64bit wide process identifiers. Everything went well except for that
>> last point, as pid_t seems to be hardcoded as int.
>> I feel that it should be possible to modify the type pid_t to use any
>> arbitrary signed integer.
>>
>> Can you tell me if there is a reason for not allowing larger pids ?
>>
>> The attachement contains some modifications I performed in order to be
>> able to override __pid_t in sys/_types.h.
>> The patch applies on top of
>> master:ab640f4cd5605b6675538b196641c46c36c75c64 in the newlib-cygwin
>> github mirror.

> http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/types.h.html
> Says pid_t can be no larger than long if I am reading that correctly.
> Is POSIX a concern? Or is long 64-bits on all your targets?

Your platform can use 64 bit process identifiers, but those need not, and
probably should not, be exposed to userspace, but kept private in the process or
task struct. Use hashes of those as pids within system defined limits except for
pids 0 (idle) and 1 (init).

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada



More information about the Newlib mailing list