Linux pid_t定義

來源:互聯網
上載者:User


Linux pid_t定義    在建立進程過程中經常會用到定義進程號的資料類型:pid_t,大家都知道是int型,
下面是我在Linux C中標頭檔中找到這個已定義流程:  www.2cto.com  1,/usr/include/sys/types.h中有如下定義 #include <bits/types.h> ...... #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif 可以看到pid_t 其實就是__pid_t類型。 2.在/usr/include/bits/types.h中可以看到這樣的定義   www.2cto.com  #include <bits/typesizes.h> #if __WORDSIZE == 32 ...... # define __STD_TYPE        __extension__ typedef #elif __WORDSIZE == 64 ...... #endif ...... __STD_TYPE __PID_T_TYPE __pid_t;    /* Type of process identifications.  */ 可以看出__pid_t 有被定義為 __extension__ typedef  __PID_T_TYPE類型的。 
 3.在檔案/usr/include/bits/typesizes.h中可以看到這樣的定義(這個檔案中沒有包含任何的標頭檔): #define __PID_T_TYPE        __S32_TYPE 可以看出__PID_T_TYPE有被定義為__S32_TYPE這種類型。 
 4.在檔案/usr/include/bits/types.h中我們終於找到了這樣的定義: #define    __S32_TYPE        int 由此我們終於找到了pid_t的真實定義:實際他就是  int  類型的。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.