1 #pragma once 2 3 #include <stdint.h> 4 #include <stdbool.h> 5 6 typedef unsigned char u_char; 7 typedef unsigned short u_short; 8 typedef unsigned int u_int; 9 typedef unsigned long u_long; 10 11 typedef uint32_t uid_t; 12 typedef uint32_t gid_t; 13 typedef long long ssize_t; 14 15 typedef int __pid_t; 16 #define pid_t int64_t 17 typedef __SIZE_TYPE__ size_t; 18 19 typedef char *caddr_t; 20 21 typedef int id_t; 22 23 typedef uint64_t ino_t; 24 typedef int64_t off_t; 25 26 typedef uint32_t blkcnt_t; 27 typedef uint32_t blksize_t; 28 typedef uint32_t dev_t; 29 typedef uint16_t mode_t; 30 typedef uint32_t nlink_t; 31 32 typedef int64_t time_t; 33 typedef uint32_t useconds_t; 34 typedef int32_t suseconds_t; 35 typedef uint32_t clock_t; 36 37 typedef uint64_t fsblkcnt_t; 38 typedef uint64_t fsfilcnt_t; 39 40 typedef uint64_t sector_t; 41 42 #define __socklen_t_defined 43 #define __socklen_t uint32_t 44 typedef __socklen_t socklen_t; 45 46 #define pgoff_t unsigned long 47 48 struct utimbuf 49 { 50 time_t actime; 51 time_t modtime; 52 }; 53 54 typedef int pthread_t; 55 typedef int pthread_key_t; 56 typedef uint32_t pthread_once_t; 57 58 typedef struct __pthread_mutex_t 59 { 60 uint32_t lock; 61 pthread_t owner; 62 int level; 63 int type; 64 } pthread_mutex_t; 65 66 typedef void *pthread_attr_t; 67 typedef struct __pthread_mutexattr_t 68 { 69 int type; 70 } pthread_mutexattr_t; 71 72 typedef struct __pthread_cond_t 73 { 74 pthread_mutex_t *mutex; 75 uint32_t value; 76 int clockid; // clockid_t 77 } pthread_cond_t; 78 79 typedef uint64_t pthread_rwlock_t; 80 typedef void *pthread_rwlockattr_t; 81 typedef struct __pthread_spinlock_t 82 { 83 int m_lock; 84 } pthread_spinlock_t; 85 typedef struct __pthread_condattr_t 86 { 87 int clockid; // clockid_t 88 } pthread_condattr_t; 89 90 typedef uint64_t gfp_t; 91 92 // 定义8字节对齐变量属性 93 #ifndef __aligned_u64 94 #define __aligned_u64 uint64_t __attribute__((aligned(8))) 95 #endif 96 97 #define aligned_u64 __aligned_u64