types.h~
来自「俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)」· H~ 代码 · 共 300 行
H~
300 行
/* unified sys/types.h: start with sef's sysvi386 version. merge go32 version -- a few ifdefs. h8300hms, h8300xray, and sysvnecv70 disagree on the following types: typedef int gid_t; typedef int uid_t; typedef int dev_t; typedef int ino_t; typedef int mode_t; typedef int caddr_t; however, these aren't "reasonable" values, the sysvi386 ones make far more sense, and should work sufficiently well (in particular, h8300 doesn't have a stat, and the necv70 doesn't matter.) -- eichin */#ifndef _SYS_TYPES_H#include <_ansi.h>#ifndef __INTTYPES_DEFINED__#define __INTTYPES_DEFINED__typedef short int __int16_t;typedef unsigned short int __uint16_t;#if __INT_MAX__ == 32767typedef long int __int32_t;typedef unsigned long int __uint32_t;#elsetypedef int __int32_t;typedef unsigned int __uint32_t;#endif#if __LONG_MAX__ > 2147483647 || !defined(__GNUC__)typedef long int __int64_t;typedef unsigned long int __uint64_t;#else__extension__ typedef long long __int64_t;__extension__ typedef unsigned long long __uint64_t;#endif#endif /* ! __INTTYPES_DEFINED */#ifndef __need_inttypes#define _SYS_TYPES_H#include <sys/_types.h>#if defined (_WIN32) || defined (__CYGWIN__)#define __MS_types__#endif#ifdef __i386__#if defined (GO32) || defined (__MSDOS__)#define __MS_types__#endif#endif# include <stddef.h># include <machine/types.h>/* To ensure the stat struct's layout doesn't change when sizeof(int), etc. changes, we assume sizeof short and long never change and have all types used to define struct stat use them and not int where possible. Where not possible, _ST_INTxx are used. It would be preferable to not have such assumptions, but until the extra fluff is necessary, it's avoided. No 64 bit targets use stat yet. What to do about them is postponed until necessary. */#ifdef __GNUC__#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))#else#define _ST_INT32#endif# ifndef _POSIX_SOURCE# define physadr physadr_t# define quad quad_t#ifndef _BSDTYPES_DEFINED/* also defined in mingw/gmon.h and in w32api/winsock[2].h */typedef unsigned char u_char;typedef unsigned short u_short;typedef unsigned int u_int;typedef unsigned long u_long;#define _BSDTYPES_DEFINED#endiftypedef unsigned short ushort; /* System V compatibility */typedef unsigned int uint; /* System V compatibility */# endif /*!_POSIX_SOURCE */#ifndef __clock_t_definedtypedef _CLOCK_T_ clock_t;#define __clock_t_defined#endif#ifndef __time_t_definedtypedef _TIME_T_ time_t;#define __time_t_defined/* Time Value Specification Structures, P1003.1b-1993, p. 261 */struct timespec { time_t tv_sec; /* Seconds */ long tv_nsec; /* Nanoseconds */};struct itimerspec { struct timespec it_interval; /* Timer period */ struct timespec it_value; /* Timer expiration */};#endiftypedef long daddr_t;typedef char * caddr_t;#if defined(__MS_types__) || defined(__rtems__)typedef unsigned long ino_t;#else#ifdef __sparc__typedef unsigned long ino_t;#elsetypedef unsigned short ino_t;#endif#endif#ifdef __MS_types__typedef unsigned long vm_offset_t;typedef unsigned long vm_size_t;#define __BIT_TYPES_DEFINED__typedef char int8_t;typedef unsigned char u_int8_t;typedef short int16_t;typedef unsigned short u_int16_t;typedef int int32_t;typedef unsigned int u_int32_t;typedef long long int64_t;typedef unsigned long long u_int64_t;typedef int32_t register_t;#endif /* __MS_types__ *//* * All these should be machine specific - right now they are all broken. * However, for all of Cygnus' embedded targets, we want them to all be * the same. Otherwise things like sizeof (struct stat) might depend on * how the file was compiled (e.g. -mint16 vs -mint32, etc.). */#if defined(__rtems__)/* device numbers are 32-bit major and and 32-bit minor */typedef unsigned long long dev_t;#else#ifndef __CYGWIN__typedef short dev_t;#endif#endif#ifndef __CYGWIN__ /* which defines these types in it's own types.h. */typedef long off_t;typedef unsigned short uid_t;typedef unsigned short gid_t;#endiftypedef int pid_t;typedef long key_t;typedef _ssize_t ssize_t;#ifdef __MS_types__typedef char * addr_t;typedef int mode_t;#else#if defined (__sparc__) && !defined (__sparc_v9__)#ifdef __svr4__typedef unsigned long mode_t;#elsetypedef unsigned short mode_t;#endif#elsetypedef unsigned int mode_t _ST_INT32;#endif#endif /* ! __MS_types__ */typedef unsigned short nlink_t;/* We don't define fd_set and friends if we are compiling POSIX source, or if we have included (or may include as indicated by __USE_W32_SOCKETS) the W32api winsock[2].h header which defines Windows versions of them. Note that a program which includes the W32api winsock[2].h header must know what it is doing; it must not call the cygwin32 select function.*/# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) # define _SYS_TYPES_FD_SET# define NBBY 8 /* number of bits in a byte *//* * Select uses bit masks of file descriptors in longs. * These macros manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here * should be >= NOFILE (param.h). */# ifndef FD_SETSIZE# define FD_SETSIZE 64# endiftypedef long fd_mask;# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */# ifndef howmany# define howmany(x,y) (((x)+((y)-1))/(y))# endif/* We use a macro for fd_set so that including Sockets.h afterwards can work. */typedef struct _types_fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];} _types_fd_set;#define fd_set _types_fd_set# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))# define FD_ZERO(p) (__extension__ (void)({ \ size_t __i; \ char *__tmp = (char *)p; \ for (__i = 0; __i < sizeof (*(p)); ++__i) \ *__tmp++ = 0; \}))# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */#undef __MS_types__#undef _ST_INT32/* The following are actually standard POSIX 1003.1b-1993 threads, mutexes, condition variables, and keys. But since RTEMS is currently the only newlib user of these, the ifdef is just on RTEMS. */#if defined(__rtems__) || defined(GNUWINCE) || defined(__CYGWIN__)#ifndef __clockid_t_definedtypedef _CLOCKID_T_ clockid_t;#define __clockid_t_defined#endif#ifndef __timer_t_definedtypedef _TIMER_T_ timer_t;#define __timer_t_defined#endif#if defined(__CYGWIN__) || defined(__rtems__)typedef long useconds_t;#endif#include <sys/features.h>/* Cygwin will probably never have full posix compliance due to little things * like an inability to set the stackaddress. Cygwin is also using void * * pointers rather than structs to ensure maximum binary compatability with * previous releases. * This means that we don't use the types defined here, but rather in * <cygwin/types.h> */#if defined(_POSIX_THREADS) && !defined(__CYGWIN__)#include <sys/sched.h>/* * 2.5 Primitive System Data Types, P1003.1c/D10, p. 19. */typedef struct pthread_t_ *pthread_t;typedef struct pthread_attr_t_ *pthread_attr_t;typedef struct pthread_once_t_ pthread_once_t;typedef struct pthread_key_t_ *pthread_key_t;typedef struct pthread_mutex_t_ *pthread_mutex_t;typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t;typedef struct pthread_cond_t_ *pthread_cond_t;typedef struct pthread_condattr_t_ *pthread_condattr_t;typedef struct pthread_rwlock_t_ *pthread_rwlock_t;typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t;typedef struct pthread_spinlock_t_ *pthread_spinlock_t;typedef struct pthread_barrier_t_ *pthread_barrier_t;typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t;#endif /* defined(_POSIX_THREADS) */#endif /* defined(__rtems__) */#endif /* !__need_inttypes */#undef __need_inttypes#endif /* _SYS_TYPES_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?