Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Unix Advanced Environment programming Notes-2muri-basic system data types

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The content of this article is extracted from the second edition of "Unix Advanced Environment programming". If there are any errors, please indicate, thank you!

At the same time, this paper refers to the sys/types.h file of FreeBSD to further understand the basic system data types.

The sys/types.h file of the Unix system defines certain implementation-related data types called basic system data types (primitive system data type). These data types are defined in C's typedef, and most of them end in _ t. Some basic system data types are listed below.

Data type description defined in FreeBSD

Caddr_t core address is defined as char * type

The clock_t clock tick counter is defined as _ _ clock_t, and the number of ticks per second is CLOCKS_PER_SEC (in FreeBSD, this definition is in time.h)

Comp_t compressed clock ticks are defined in sys/acct.h as uint16_t

Dev_t device number (primary and secondary) is defined as _ _ dev_t, device number, or struct cdev

The set of fd_set file descriptors is defined in sys/select.h and is struct fd_set. You can refer to the select system call.

The fpos_t file location is defined in stdio.h and is of type _ _ off_t

The gid_t user group ID is defined as _ _ gid_t type

The ino_t I node number is defined as _ _ ino_t type

Mode_t file type, file creation mode defined as _ _ mode_t type

The connection counter for the nlink_t directory entry is defined as _ _ nlink_t type

Off_t file size and offset, signed as _ _ off_t type, and uoff_t (_ _ uint64_t) as unsigned

Pid_t process IP and process group ID are defined as _ _ pid_t type

The result of the subtraction of the two pointers of ptrdirr_t is defined in sys/stddef.h as type _ _ ptrdiff_t

Rlim_t resource limit is defined as _ _ rlim_t type

The type of data that sig_atomic_t can access atomically is related to the CPU schema. For i386, it is defined in i386/include/signal.h.

Sigset_t signal sets are defined in sys/select.h and sys/signal.h, both of which are _ _ sigset_t

Size_t object byte size, unsigned defined as _ _ size_t type

The ssize_t function returns the size of the number of bytes, with a signed definition of type _ _ ssize_t

The timer of time_t calendar time is defined as _ _ time_t type, which is related to CPU schema.

Uid_t numeric user ID is defined as _ _ uid_t type

Wchar_t can indicate that all different character codes are defined in stddef.h stdlib.h wchar.h as _ _ wchar_t, while _ _ wchar_t is defined in sys/_types.h as _ _ ct_rune_t, and _ _ ct_rune_t is defined as int

In FreeBSD, of the above basic system data types, _ _ XXX_t is basically related to the CPU schema, such as i386, which is defined in i386/include/_types.h, but not all _ _ XXX_t types, such as _ _ wchar_t.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report