Re: pid_t data type



On Mar 18, 12:09 pm, "jason.cipri...@xxxxxxxxx"
<jason.cipri...@xxxxxxxxx> wrote:

"The implementation shall support one or more programming environments
in which the widths of blksize_t, pid_t, size_t, ssize_t, suseconds_t,
and useconds_t are no greater than the width of type long."

If you take that to mean that *all* supported "programming
environments" have pid_t with width no greater than the width of type
long, then it *is* save to store pid_t's in a long. Is there something
that indicates that it's not?

That's definitely not what it says. It says such an environment must
be supported, not that it must be the only one supported or that it
must be the default. Storing a pid_t in a long may limit which
environments you can use.

If that's the case the only two issues with using long instead of
pid_t are:

1) If that standard changes some day, and

2) Using pid_t clearly indicates that the variable, function
parameter, etc., is meant to hold a process ID, and not some arbitrary
integer with another meaning. Saves on documentation.

What about cases where you need a pointer to something that holds a
pid, like posix_spawn? What about cases where you need to pass a PID
through a function with a '...' definition?

DS
.



Relevant Pages

  • Re: Can I Get The PID Of The Program That Launched My Program?
    ... the PID of the console. ... When I start program B from program A with backticks, it gives me the PID of program A. ... environments. ...
    (comp.lang.perl.misc)
  • Re: strongForth 1.1 with floating-point word set
    ... In order to allow ports to other environments, ... License. ... I tried the link in "For further documentation, ...
    (comp.lang.forth)
  • Re: Kevent POSIX timers support.
    ... to put it in the ukevent provided to userspace - it can be placed in ... sigev_value is a union and the largest element is a pointer. ... Now we'll have to have a compat layer for 32-bit/64-bit environments ... designing these data structures. ...
    (Linux-Kernel)
  • Re: Pointer Pointing Itself
    ... On Mon, 6 Nov 2006, Steve O'Hara-Smith wrote: ... there are environments in which any pointer can validly ... referred to the declaration ...
    (comp.programming)
  • Re: freestanding enviroment !
    ... startup can be other than 'main' how it is specified? ... Each implementation used for such environments will provide this information ... in its documentation. ... Richard Heathfield ...
    (comp.lang.c)