Definitions of pid_t types in Linux.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.