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