You are not supposed to get access to PID_MAX.  It is for the kernel only.
It is not standardized.

You need to handle whatever shows up in pid_t.

>       OpenBSD 6.4-current (GENERIC.MP) #374: Sun Oct 21 00:04:11 MDT 2018
>           [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
> I wanted PID_MAX in top/top.c but including the header as documented in
> various manual pages as per `man -k in=sys/proc' failed as minimally
> reproduced below.
> 
> In base there's only^Walmost one user of this marco:
> 
>       /usr/src/usr.sbin/lpd/lp.c
>       39:#define XXX_PID_MAX 99999
>       639:          pid = strtonum(line, 2, XXX_PID_MAX, &errstr);
> 
> Can anyone with more insight in this area comment on that? What is
> wrong here?
> 
>       $ cc -xc -
>       #include <sys/types.h>
>       #include <sys/proc.h>
>       int main() { return 0; }
> 
>       In file included from <stdin>:2:
>       /usr/include/sys/proc.h:362:21: error: field has incomplete type 
> 'struct sigaltstack'
>               struct  sigaltstack p_sigstk;   /* sp & on stack state variable 
> */
>                                   ^
>       /usr/include/sys/proc.h:362:9: note: forward declaration of 'struct 
> sigaltstack'
>               struct  sigaltstack p_sigstk;   /* sp & on stack state variable 
> */
>                       ^
>       /usr/include/sys/proc.h:374:15: error: field has incomplete type 'union 
> sigval'
>               union sigval p_sigval;  /* For core dump/debugger XXX */
>                            ^
>       /usr/include/sys/proc.h:94:7: note: forward declaration of 'union 
> sigval'
>       union sigval;
>             ^
>       2 errors generated.
> 

Reply via email to