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