Description: The header file (. h) involved, the directory is based on the/usr/include/directory by default.
1. In "/sys/types.h", there are the following:
1 #include <bits/types.h>2#ifndef __pid_t_defined3 typedef __pid_t pid_t; 4 101 # define __pid_t_defined 5 102 #endif
Obviously, pid_t is just a __pid_t alias. Or, the pid_t type is actually the __pid_t type.
2. In "Bits/types.h", there are the following:
1 /*We want __extension__ before typedef ' s that use nonstandard base types2 118 such as ' Long ' in C89 mode. */3 119# define __std_type __extension__ typedef4 - #elif__wordsize = = 645 ...6#include <bits/typesizes.h>/*defines __*_t_type macros. */7__std_type __pid_t_type __pid_t;/*Type of process identifications.8 */
From the comments in the first and second lines, we can ignore the __extension__ analysis. So __std_type represents a typedef. So in the seventh line of code, you know:
The __pid_t type is actually the __pid_t_type type.
3. In "Bits/typesizes.h", there are the following:
1 /* See <bits/types.h> for the meaning of these macros. This is the file exists so2 , <bits/types.h> need not vary across different GNU platforms. */34... 5 #define __pid_t_type __s32_type
Thus we know that __pid_t_type is the __s32_type type. And this file does not refer to any other header files.
4. In the "bits/types.h" file, we see the following:
1 #define __s32_type int
As a result, __s32_type is the int type, which means that pid_t is actually an int type.
Citation: http://doudouclever.blog.163.com/blog/static/17511231020112248130302/
Definitions of pid_t types in Linux.