|
| 1 | +macro_rules! expand_align { |
| 2 | + () => { |
| 3 | + s! { |
| 4 | + #[cfg_attr(any(target_pointer_width = "32", |
| 5 | + target_arch = "x86_64", |
| 6 | + target_arch = "powerpc64", |
| 7 | + target_arch = "mips64", |
| 8 | + target_arch = "mips64r6", |
| 9 | + target_arch = "s390x", |
| 10 | + target_arch = "sparc64", |
| 11 | + target_arch = "aarch64", |
| 12 | + target_arch = "riscv64", |
| 13 | + target_arch = "riscv32", |
| 14 | + target_arch = "loongarch64"), |
| 15 | + repr(align(4)))] |
| 16 | + #[cfg_attr(not(any(target_pointer_width = "32", |
| 17 | + target_arch = "x86_64", |
| 18 | + target_arch = "powerpc64", |
| 19 | + target_arch = "mips64", |
| 20 | + target_arch = "mips64r6", |
| 21 | + target_arch = "s390x", |
| 22 | + target_arch = "sparc64", |
| 23 | + target_arch = "aarch64", |
| 24 | + target_arch = "riscv64", |
| 25 | + target_arch = "riscv32", |
| 26 | + target_arch = "loongarch64")), |
| 27 | + repr(align(8)))] |
| 28 | + pub struct pthread_mutexattr_t { |
| 29 | + #[doc(hidden)] |
| 30 | + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], |
| 31 | + } |
| 32 | + |
| 33 | + #[cfg_attr(any(target_env = "musl", target_env = "ohos", target_pointer_width = "32"), |
| 34 | + repr(align(4)))] |
| 35 | + #[cfg_attr(all(not(target_env = "musl"), |
| 36 | + not(target_env = "ohos"), |
| 37 | + target_pointer_width = "64"), |
| 38 | + repr(align(8)))] |
| 39 | + pub struct pthread_rwlockattr_t { |
| 40 | + #[doc(hidden)] |
| 41 | + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], |
| 42 | + } |
| 43 | + |
| 44 | + #[repr(align(4))] |
| 45 | + pub struct pthread_condattr_t { |
| 46 | + #[doc(hidden)] |
| 47 | + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], |
| 48 | + } |
| 49 | + |
| 50 | + #[repr(align(4))] |
| 51 | + pub struct pthread_barrierattr_t { |
| 52 | + #[doc(hidden)] |
| 53 | + size: [u8; ::__SIZEOF_PTHREAD_BARRIERATTR_T], |
| 54 | + } |
| 55 | + |
| 56 | + #[repr(align(8))] |
| 57 | + pub struct fanotify_event_metadata { |
| 58 | + pub event_len: __u32, |
| 59 | + pub vers: __u8, |
| 60 | + pub reserved: __u8, |
| 61 | + pub metadata_len: __u16, |
| 62 | + pub mask: __u64, |
| 63 | + pub fd: ::c_int, |
| 64 | + pub pid: ::c_int, |
| 65 | + } |
| 66 | + |
| 67 | + #[repr(align(8))] |
| 68 | + pub struct tpacket_rollover_stats { |
| 69 | + pub tp_all: ::__u64, |
| 70 | + pub tp_huge: ::__u64, |
| 71 | + pub tp_failed: ::__u64, |
| 72 | + } |
| 73 | + |
| 74 | + #[repr(align(8))] |
| 75 | + pub struct tpacket_hdr_v1 { |
| 76 | + pub block_status: ::__u32, |
| 77 | + pub num_pkts: ::__u32, |
| 78 | + pub offset_to_first_pkt: ::__u32, |
| 79 | + pub blk_len: ::__u32, |
| 80 | + pub seq_num: ::__u64, |
| 81 | + pub ts_first_pkt: ::tpacket_bd_ts, |
| 82 | + pub ts_last_pkt: ::tpacket_bd_ts, |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + s_no_extra_traits! { |
| 87 | + #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), |
| 88 | + target_pointer_width = "32"), |
| 89 | + repr(align(4)))] |
| 90 | + #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), |
| 91 | + target_pointer_width = "64"), |
| 92 | + repr(align(8)))] |
| 93 | + #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), |
| 94 | + target_arch = "x86"), |
| 95 | + repr(align(4)))] |
| 96 | + #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), |
| 97 | + not(target_arch = "x86")), |
| 98 | + repr(align(8)))] |
| 99 | + pub struct pthread_cond_t { |
| 100 | + #[doc(hidden)] |
| 101 | + size: [u8; ::__SIZEOF_PTHREAD_COND_T], |
| 102 | + } |
| 103 | + |
| 104 | + #[cfg_attr(all(target_pointer_width = "32", |
| 105 | + any(target_arch = "mips", |
| 106 | + target_arch = "mips32r6", |
| 107 | + target_arch = "arm", |
| 108 | + target_arch = "hexagon", |
| 109 | + target_arch = "m68k", |
| 110 | + target_arch = "csky", |
| 111 | + target_arch = "powerpc", |
| 112 | + target_arch = "sparc", |
| 113 | + target_arch = "x86_64", |
| 114 | + target_arch = "x86")), |
| 115 | + repr(align(4)))] |
| 116 | + #[cfg_attr(any(target_pointer_width = "64", |
| 117 | + not(any(target_arch = "mips", |
| 118 | + target_arch = "mips32r6", |
| 119 | + target_arch = "arm", |
| 120 | + target_arch = "hexagon", |
| 121 | + target_arch = "m68k", |
| 122 | + target_arch = "csky", |
| 123 | + target_arch = "powerpc", |
| 124 | + target_arch = "sparc", |
| 125 | + target_arch = "x86_64", |
| 126 | + target_arch = "x86"))), |
| 127 | + repr(align(8)))] |
| 128 | + pub struct pthread_mutex_t { |
| 129 | + #[doc(hidden)] |
| 130 | + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], |
| 131 | + } |
| 132 | + |
| 133 | + #[cfg_attr(all(target_pointer_width = "32", |
| 134 | + any(target_arch = "mips", |
| 135 | + target_arch = "mips32r6", |
| 136 | + target_arch = "arm", |
| 137 | + target_arch = "hexagon", |
| 138 | + target_arch = "m68k", |
| 139 | + target_arch = "csky", |
| 140 | + target_arch = "powerpc", |
| 141 | + target_arch = "sparc", |
| 142 | + target_arch = "x86_64", |
| 143 | + target_arch = "x86")), |
| 144 | + repr(align(4)))] |
| 145 | + #[cfg_attr(any(target_pointer_width = "64", |
| 146 | + not(any(target_arch = "mips", |
| 147 | + target_arch = "mips32r6", |
| 148 | + target_arch = "arm", |
| 149 | + target_arch = "hexagon", |
| 150 | + target_arch = "m68k", |
| 151 | + target_arch = "powerpc", |
| 152 | + target_arch = "sparc", |
| 153 | + target_arch = "x86_64", |
| 154 | + target_arch = "x86"))), |
| 155 | + repr(align(8)))] |
| 156 | + pub struct pthread_rwlock_t { |
| 157 | + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], |
| 158 | + } |
| 159 | + |
| 160 | + #[cfg_attr(all(target_pointer_width = "32", |
| 161 | + any(target_arch = "mips", |
| 162 | + target_arch = "mips32r6", |
| 163 | + target_arch = "arm", |
| 164 | + target_arch = "hexagon", |
| 165 | + target_arch = "m68k", |
| 166 | + target_arch = "csky", |
| 167 | + target_arch = "powerpc", |
| 168 | + target_arch = "sparc", |
| 169 | + target_arch = "x86_64", |
| 170 | + target_arch = "x86")), |
| 171 | + repr(align(4)))] |
| 172 | + #[cfg_attr(any(target_pointer_width = "64", |
| 173 | + not(any(target_arch = "mips", |
| 174 | + target_arch = "mips32r6", |
| 175 | + target_arch = "arm", |
| 176 | + target_arch = "hexagon", |
| 177 | + target_arch = "m68k", |
| 178 | + target_arch = "csky", |
| 179 | + target_arch = "powerpc", |
| 180 | + target_arch = "sparc", |
| 181 | + target_arch = "x86_64", |
| 182 | + target_arch = "x86"))), |
| 183 | + repr(align(8)))] |
| 184 | + pub struct pthread_barrier_t { |
| 185 | + size: [u8; ::__SIZEOF_PTHREAD_BARRIER_T], |
| 186 | + } |
| 187 | + |
| 188 | + // linux/can.h |
| 189 | + #[repr(align(8))] |
| 190 | + #[allow(missing_debug_implementations)] |
| 191 | + pub struct can_frame { |
| 192 | + pub can_id: canid_t, |
| 193 | + pub can_dlc: u8, |
| 194 | + __pad: u8, |
| 195 | + __res0: u8, |
| 196 | + __res1: u8, |
| 197 | + pub data: [u8; CAN_MAX_DLEN], |
| 198 | + } |
| 199 | + |
| 200 | + #[repr(align(8))] |
| 201 | + #[allow(missing_debug_implementations)] |
| 202 | + pub struct canfd_frame { |
| 203 | + pub can_id: canid_t, |
| 204 | + pub len: u8, |
| 205 | + pub flags: u8, |
| 206 | + __res0: u8, |
| 207 | + __res1: u8, |
| 208 | + pub data: [u8; CANFD_MAX_DLEN], |
| 209 | + } |
| 210 | + |
| 211 | + #[repr(align(8))] |
| 212 | + #[allow(missing_debug_implementations)] |
| 213 | + pub struct canxl_frame { |
| 214 | + pub prio: canid_t, |
| 215 | + pub flags: u8, |
| 216 | + pub sdt: u8, |
| 217 | + pub len: u16, |
| 218 | + pub af: u32, |
| 219 | + pub data: [u8; CANXL_MAX_DLEN], |
| 220 | + } |
| 221 | + } |
| 222 | + }; |
| 223 | +} |
0 commit comments