The kernel uses the following basic data types:
INT: the Standard C language Integer type.
U32: 32-bit integer type
Pid_t: PID type of a specific kernel object
The data types in C Language occupy different spaces in different CPU architectures. In the x86 series structure, the number of bytes occupied by the data type is shown in the following table:
| Arch |
Char |
Short |
Int |
Long |
PTR |
Long long |
U8 |
2010.cn |
U32 |
U64 |
| I686 |
1 |
2 |
4 |
4 |
4 |
8 |
1 |
2 |
4 |
8 |
In Linux, the address in the kernel is of the unsigned long type, and the pointer size is the same as that of the long type.
All data types provided by the kernel are declared in the header file <ASM/types. h>, and this file is included in <Linux/types. h>.
Linux uses a prefix type to expose variables to user space, such as _ u32.
Many data types in the kernel are declared by typedef for ease of transplantation.