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