?? types.h
字號:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/sys/types.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
01600 /* The <sys/types.h> header contains important data type definitions.
01601 * It is considered good programming practice to use these definitions,
01602 * instead of the underlying base type. By convention, all type names end
01603 * with _t.
01604 */
01605
01606 #ifndef _TYPES_H
01607 #define _TYPES_H
01608
01609 /* _ANSI is somehow used to determine whether or not the compiler is a
01610 * 16 bit compiler
01611 */
01612 #ifndef _ANSI
01613 #include <ansi.h>
01614 #endif
01615
01616 /* The type size_t holds all results of the sizeof operator. At first glance,
01617 * it seems obvious that it should be an unsigned int, but this is not always
01618 * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
01619 * integers. When one asks for the size of a 70K struct or array, the result
01620 * requires 17 bits to express, so size_t must be a long type. The type
01621 * ssize_t is the signed version of size_t.
01622 */
01623 #ifndef _SIZE_T
01624 #define _SIZE_T
01625 typedef unsigned int size_t;
01626 #endif
01627
01628 #ifndef _SSIZE_T
01629 #define _SSIZE_T
01630 typedef int ssize_t;
01631 #endif
01632
01633 #ifndef _TIME_T
01634 #define _TIME_T
01635 typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
01636 #endif
01637
01638 #ifndef _CLOCK_T
01639 #define _CLOCK_T
01640 typedef long clock_t; /* unit for system accounting */
01641 #endif
01642
01643 #ifndef _SIGSET_T
01644 #define _SIGSET_T
01645 typedef unsigned long sigset_t;
01646 #endif
01647
01648 /* Types used in disk, inode, etc. data structures. */
01649 typedef short dev_t; /* holds (major|minor) device pair */
01650 typedef char gid_t; /* group id */
01651 typedef unsigned short ino_t; /* i-node number */
01652 typedef unsigned short mode_t; /* file type and permissions bits */
01653 typedef char nlink_t; /* number of links to a file */
01654 typedef unsigned long off_t; /* offset within a file */
01655 typedef int pid_t; /* process id (must be signed) */
01656 typedef short uid_t; /* user id */
01657 typedef unsigned long zone_t; /* zone number */
01658 typedef unsigned long block_t; /* block number */
01659 typedef unsigned long bit_t; /* bit number in a bit map */
01660 typedef unsigned short zone1_t; /* zone number for V1 file systems */
01661 typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */
01662
01663 typedef unsigned char u8_t; /* 8 bit type */
01664 typedef unsigned short u16_t; /* 16 bit type */
01665 typedef unsigned long u32_t; /* 32 bit type */
01666
01667 typedef char i8_t; /* 8 bit signed type */
01668 typedef short i16_t; /* 16 bit signed type */
01669 typedef long i32_t; /* 32 bit signed type */
01670
01671 /* The following types are needed because MINIX uses K&R style function
01672 * definitions (for maximum portability). When a short, such as dev_t, is
01673 * passed to a function with a K&R definition, the compiler automatically
01674 * promotes it to an int. The prototype must contain an int as the parameter,
01675 * not a short, because an int is what an old-style function definition
01676 * expects. Thus using dev_t in a prototype would be incorrect. It would be
01677 * sufficient to just use int instead of dev_t in the prototypes, but Dev_t
01678 * is clearer.
01679 */
01680 typedef int Dev_t;
01681 typedef int Gid_t;
01682 typedef int Nlink_t;
01683 typedef int Uid_t;
01684 typedef int U8_t;
01685 typedef unsigned long U32_t;
01686 typedef int I8_t;
01687 typedef int I16_t;
01688 typedef long I32_t;
01689
01690 /* ANSI C makes writing down the promotion of unsigned types very messy. When
01691 * sizeof(short) == sizeof(int), there is no promotion, so the type stays
01692 * unsigned. When the compiler is not ANSI, there is usually no loss of
01693 * unsignedness, and there are usually no prototypes so the promoted type
01694 * doesn't matter. The use of types like Ino_t is an attempt to use ints
01695 * (which are not promoted) while providing information to the reader.
01696 */
01697
01698 #ifndef _ANSI_H
01699 #include <ansi.h>
01700 #endif
01701
01702 #if _EM_WSIZE == 2 || !defined(_ANSI)
01703 typedef unsigned int Ino_t;
01704 typedef unsigned int Zone1_t;
01705 typedef unsigned int Bitchunk_t;
01706 typedef unsigned int U16_t;
01707 typedef unsigned int Mode_t;
01708
01709 #else /* _EM_WSIZE == 4, or _EM_WSIZE undefined, or _ANSI defined */
01710 typedef int Ino_t;
01711 typedef int Zone1_t;
01712 typedef int Bitchunk_t;
01713 typedef int U16_t;
01714 typedef int Mode_t;
01715
01716 #endif /* _EM_WSIZE == 2, etc */
01717
01718 /* Signal handler type, e.g. SIG_IGN */
01719 #if defined(_ANSI)
01720 typedef void (*sighandler_t) (int);
01721 #else
01722 typedef void (*sighandler_t)();
01723 #endif
01724
01725 #endif /* _TYPES_H */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -