The pid of a process is defined as pid_t pid; whereas, pid_t is an opaque data type. If the process's id number can be represented by an int, why should not we declare it as an int family rather then hiding its data type from its users?
That's not really an opaque type, but an alias to an integer type. For example, in my system, I find the following in different header files:
typedef __pid_t pid_t;
...
# define __STD_TYPE typedef
__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */
...
#define __PID_T_TYPE __S32_TYPE
...
#define __S32_TYPE int
Hence, you're right in that pid_t
is just an int
. However, I'd say there are a couple of reasons to do this:
long int
), you just need to change the typedef
, recompile and everything should work fine. In fact, I believe this already happens for different architectures.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With