• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 = "s390x",
9                            target_arch = "sparc64",
10                            target_arch = "aarch64",
11                            target_arch = "riscv64",
12                            target_arch = "riscv32",
13                            target_arch = "loongarch64"),
14                        repr(align(4)))]
15             #[cfg_attr(not(any(target_pointer_width = "32",
16                                target_arch = "x86_64",
17                                target_arch = "powerpc64",
18                                target_arch = "mips64",
19                                target_arch = "s390x",
20                                target_arch = "sparc64",
21                                target_arch = "aarch64",
22                                target_arch = "riscv64",
23                                target_arch = "riscv32",
24                                target_arch = "loongarch64")),
25                        repr(align(8)))]
26             pub struct pthread_mutexattr_t {
27                 #[doc(hidden)]
28                 size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
29             }
30 
31             #[cfg_attr(any(target_env = "musl", target_env = "ohos", target_pointer_width = "32"),
32                        repr(align(4)))]
33             #[cfg_attr(all(not(target_env = "musl"),
34                            not(target_env = "ohos"),
35                            target_pointer_width = "64"),
36                        repr(align(8)))]
37             pub struct pthread_rwlockattr_t {
38                 #[doc(hidden)]
39                 size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T],
40             }
41 
42             #[repr(align(4))]
43             pub struct pthread_condattr_t {
44                 #[doc(hidden)]
45                 size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
46             }
47 
48             #[repr(align(8))]
49             pub struct fanotify_event_metadata {
50                 pub event_len: __u32,
51                 pub vers: __u8,
52                 pub reserved: __u8,
53                 pub metadata_len: __u16,
54                 pub mask: __u64,
55                 pub fd: ::c_int,
56                 pub pid: ::c_int,
57             }
58         }
59 
60         s_no_extra_traits! {
61             #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"),
62                            target_pointer_width = "32"),
63                        repr(align(4)))]
64             #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"),
65                            target_pointer_width = "64"),
66                        repr(align(8)))]
67             #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")),
68                            target_arch = "x86"),
69                        repr(align(4)))]
70             #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")),
71                            not(target_arch = "x86")),
72                        repr(align(8)))]
73             pub struct pthread_cond_t {
74                 #[doc(hidden)]
75                 size: [u8; ::__SIZEOF_PTHREAD_COND_T],
76             }
77 
78             #[cfg_attr(all(target_pointer_width = "32",
79                            any(target_arch = "mips",
80                                target_arch = "arm",
81                                target_arch = "hexagon",
82                                target_arch = "m68k",
83                                target_arch = "powerpc",
84                                target_arch = "sparc",
85                                target_arch = "x86_64",
86                                target_arch = "x86")),
87                        repr(align(4)))]
88             #[cfg_attr(any(target_pointer_width = "64",
89                            not(any(target_arch = "mips",
90                                    target_arch = "arm",
91                                    target_arch = "hexagon",
92                                    target_arch = "m68k",
93                                    target_arch = "powerpc",
94                                    target_arch = "sparc",
95                                    target_arch = "x86_64",
96                                    target_arch = "x86"))),
97                        repr(align(8)))]
98             pub struct pthread_mutex_t {
99                 #[doc(hidden)]
100                 size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
101             }
102 
103             #[cfg_attr(all(target_pointer_width = "32",
104                            any(target_arch = "mips",
105                                target_arch = "arm",
106                                target_arch = "hexagon",
107                                target_arch = "m68k",
108                                target_arch = "powerpc",
109                                target_arch = "sparc",
110                                target_arch = "x86_64",
111                                target_arch = "x86")),
112                        repr(align(4)))]
113             #[cfg_attr(any(target_pointer_width = "64",
114                            not(any(target_arch = "mips",
115                                    target_arch = "arm",
116                                    target_arch = "hexagon",
117                                    target_arch = "m68k",
118                                    target_arch = "powerpc",
119                                    target_arch = "sparc",
120                                    target_arch = "x86_64",
121                                    target_arch = "x86"))),
122                        repr(align(8)))]
123             pub struct pthread_rwlock_t {
124                 size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
125             }
126 
127             // linux/can.h
128             #[repr(align(8))]
129             #[allow(missing_debug_implementations)]
130             pub struct can_frame {
131                 pub can_id: canid_t,
132                 pub can_dlc: u8,
133                 __pad: u8,
134                 __res0: u8,
135                 __res1: u8,
136                 pub data: [u8; CAN_MAX_DLEN],
137             }
138 
139             #[repr(align(8))]
140             #[allow(missing_debug_implementations)]
141             pub struct canfd_frame {
142                 pub can_id: canid_t,
143                 pub len: u8,
144                 pub flags: u8,
145                 __res0: u8,
146                 __res1: u8,
147                 pub data: [u8; CANFD_MAX_DLEN],
148             }
149         }
150     };
151 }
152