|
4 | 4 | //! Headers available via the |
5 | 5 | //! Hexagon SDK: https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK |
6 | 6 |
|
| 7 | +use crate::prelude::*; |
| 8 | + |
| 9 | +// Basic C types for QRT |
| 10 | +pub type intptr_t = isize; |
| 11 | +pub type uintptr_t = usize; |
| 12 | +pub type ptrdiff_t = isize; |
| 13 | +pub type size_t = uintptr_t; |
| 14 | +pub type ssize_t = intptr_t; |
| 15 | + |
| 16 | +// Process and system types |
| 17 | +pub type pid_t = c_int; |
| 18 | +pub type uid_t = c_uint; |
| 19 | +pub type gid_t = c_uint; |
| 20 | + |
| 21 | +// Time types |
| 22 | +pub type time_t = c_longlong; |
| 23 | +pub type suseconds_t = c_long; |
| 24 | +pub type useconds_t = c_ulong; |
| 25 | +pub type clockid_t = c_int; |
| 26 | +pub type timer_t = *mut c_void; |
| 27 | + |
| 28 | +// File system types |
| 29 | +pub type dev_t = c_ulong; |
| 30 | +pub type ino_t = c_ulong; |
| 31 | +pub type mode_t = c_uint; |
| 32 | +pub type nlink_t = c_uint; |
| 33 | +pub type off_t = c_long; |
| 34 | +pub type blkcnt_t = c_long; |
| 35 | +pub type blksize_t = c_long; |
| 36 | + |
| 37 | +// Thread types based on QuRT pthread implementation |
| 38 | +pub type pthread_t = c_uint; |
| 39 | +pub type pthread_key_t = c_int; |
| 40 | +pub type pthread_once_t = c_int; |
| 41 | +pub type pthread_mutex_t = c_uint; |
| 42 | +pub type pthread_mutexattr_t = c_uint; |
| 43 | +pub type pthread_cond_t = c_uint; |
| 44 | +pub type pthread_condattr_t = c_uint; |
| 45 | +pub type pthread_attr_t = c_uint; |
| 46 | +pub type pthread_rwlock_t = c_uint; |
| 47 | +pub type pthread_rwlockattr_t = c_uint; |
| 48 | +pub type pthread_spinlock_t = c_uint; |
| 49 | +pub type pthread_barrier_t = c_uint; |
| 50 | +pub type pthread_barrierattr_t = c_uint; |
| 51 | + |
| 52 | +// Network types |
| 53 | +pub type socklen_t = c_uint; |
| 54 | +pub type sa_family_t = c_ushort; |
| 55 | +pub type in_addr_t = c_uint; |
| 56 | +pub type in_port_t = c_ushort; |
| 57 | + |
| 58 | +// File descriptor types |
| 59 | +pub type fd_set = c_ulong; |
| 60 | + |
| 61 | +// Standard C library types |
| 62 | +extern_ty! { |
| 63 | + pub enum FILE {} |
| 64 | +} |
| 65 | +pub type fpos_t = c_long; |
| 66 | +pub type clock_t = c_long; |
| 67 | + |
| 68 | +// POSIX semaphore types |
| 69 | +pub type sem_t = c_uint; |
| 70 | + |
| 71 | +// Message queue types |
| 72 | +pub type mqd_t = c_int; |
| 73 | + |
| 74 | +// Additional file system types |
| 75 | +pub type nfds_t = c_ulong; |
| 76 | + |
| 77 | +// Signal types |
| 78 | +pub type sigset_t = c_ulong; |
| 79 | + |
| 80 | +// Variadic argument list type |
| 81 | +pub type va_list = *mut c_char; |
| 82 | + |
| 83 | +// Additional missing types |
| 84 | +pub type c_schar = i8; |
| 85 | + |
| 86 | +// Division result types |
| 87 | +s! { |
| 88 | + pub struct div_t { |
| 89 | + pub quot: c_int, |
| 90 | + pub rem: c_int, |
| 91 | + } |
| 92 | + |
| 93 | + pub struct ldiv_t { |
| 94 | + pub quot: c_long, |
| 95 | + pub rem: c_long, |
| 96 | + } |
| 97 | + |
| 98 | + pub struct lldiv_t { |
| 99 | + pub quot: c_longlong, |
| 100 | + pub rem: c_longlong, |
| 101 | + } |
| 102 | + |
| 103 | + pub struct stat { |
| 104 | + pub st_dev: dev_t, |
| 105 | + pub st_ino: ino_t, |
| 106 | + pub st_mode: mode_t, |
| 107 | + pub st_nlink: nlink_t, |
| 108 | + pub st_uid: uid_t, |
| 109 | + pub st_gid: gid_t, |
| 110 | + pub st_rdev: dev_t, |
| 111 | + pub st_size: off_t, |
| 112 | + pub st_blksize: blksize_t, |
| 113 | + pub st_blocks: blkcnt_t, |
| 114 | + pub st_atime: time_t, |
| 115 | + pub st_mtime: time_t, |
| 116 | + pub st_ctime: time_t, |
| 117 | + } |
| 118 | + |
| 119 | + pub struct tm { |
| 120 | + pub tm_sec: c_int, |
| 121 | + pub tm_min: c_int, |
| 122 | + pub tm_hour: c_int, |
| 123 | + pub tm_mday: c_int, |
| 124 | + pub tm_mon: c_int, |
| 125 | + pub tm_year: c_int, |
| 126 | + pub tm_wday: c_int, |
| 127 | + pub tm_yday: c_int, |
| 128 | + pub tm_isdst: c_int, |
| 129 | + } |
| 130 | + |
| 131 | + pub struct timespec { |
| 132 | + pub tv_sec: time_t, |
| 133 | + pub tv_nsec: c_long, |
| 134 | + } |
| 135 | + |
| 136 | + pub struct timeval { |
| 137 | + pub tv_sec: time_t, |
| 138 | + pub tv_usec: suseconds_t, |
| 139 | + } |
| 140 | + |
| 141 | + pub struct itimerspec { |
| 142 | + pub it_interval: timespec, |
| 143 | + pub it_value: timespec, |
| 144 | + } |
| 145 | + |
| 146 | + pub struct sigevent { |
| 147 | + pub sigev_notify: c_int, |
| 148 | + pub sigev_signo: c_int, |
| 149 | + pub sigev_value: c_int, |
| 150 | + } |
| 151 | +} |
| 152 | + |
7 | 153 | pub(crate) mod errno; |
8 | 154 | pub(crate) mod fcntl; |
9 | 155 | pub(crate) mod limits; |
|
0 commit comments