The type definition of the process number pid_t

Source: Internet
Author: User

when you create a process, you often use the type definition of the process number: pid_t. We all know that this type definition is actually an int type. But how is this definition defined in the header file in C under Linux? Today, the process of finding this definition has been posted:

1. First, the following definitions are in/usr/include/sys/types.h

#include
......

#ifndef __pid_t_defined
typedef __pid_t PID_T;
# define __pid_t_defined
#endif
You can see that pid_t is actually the __pid_t type.


2. This definition can be seen in the/usr/include/bits/types.h

#include

#if __wordsize = = 32
......
# define __std_type __extension__ typedef
#elif __wordsize = = 64
......
#endif
......
__std_type __pid_t_type __pid_t;  /* Type of process identifications. */

It can be seen that __pid_t has a type defined as __extension__ typedef __pid_t_type.

3. You can see this definition in the file/usr/include/bits/typesizes.h (this file does not contain any header files):

#define __pid_t_type __s32_type

It can be seen that __pid_t_type has a type that is defined as __s32_type.

4. In the document/USR/INCLUDE/BITS/TYPES.H we finally found the definition:

#define __S32_TYPE INT

So we finally found the true definition of pid_t: The actual he is the int type.

This article is from the "canvas shoes can walk the cat step" blog, please be sure to keep this source http://9409270.blog.51cto.com/9399270/1870011

The type definition of the process number pid_t

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.