Skip to content

Commit b1e6991

Browse files
committed
libc: wrap padding fields with Padding newtype.
1 parent bbafd45 commit b1e6991

File tree

80 files changed

+725
-725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+725
-725
lines changed

src/fuchsia/aarch64.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ s! {
1515
pub st_uid: crate::uid_t,
1616
pub st_gid: crate::gid_t,
1717
pub st_rdev: crate::dev_t,
18-
__pad0: c_ulong,
18+
__pad0: Padding<c_ulong>,
1919
pub st_size: off_t,
2020
pub st_blksize: crate::blksize_t,
21-
__pad1: c_int,
21+
__pad1: Padding<c_int>,
2222
pub st_blocks: crate::blkcnt_t,
2323
pub st_atime: crate::time_t,
2424
pub st_atime_nsec: c_long,
2525
pub st_mtime: crate::time_t,
2626
pub st_mtime_nsec: c_long,
2727
pub st_ctime: crate::time_t,
2828
pub st_ctime_nsec: c_long,
29-
__unused: [c_uint; 2],
29+
__unused: Padding<[c_uint; 2]>,
3030
}
3131

3232
pub struct stat64 {
@@ -37,18 +37,18 @@ s! {
3737
pub st_uid: crate::uid_t,
3838
pub st_gid: crate::gid_t,
3939
pub st_rdev: crate::dev_t,
40-
__pad0: c_ulong,
40+
__pad0: Padding<c_ulong>,
4141
pub st_size: off_t,
4242
pub st_blksize: crate::blksize_t,
43-
__pad1: c_int,
43+
__pad1: Padding<c_int>,
4444
pub st_blocks: crate::blkcnt_t,
4545
pub st_atime: crate::time_t,
4646
pub st_atime_nsec: c_long,
4747
pub st_mtime: crate::time_t,
4848
pub st_mtime_nsec: c_long,
4949
pub st_ctime: crate::time_t,
5050
pub st_ctime_nsec: c_long,
51-
__unused: [c_uint; 2],
51+
__unused: Padding<[c_uint; 2]>,
5252
}
5353

5454
pub struct ipc_perm {
@@ -59,8 +59,8 @@ s! {
5959
pub cgid: crate::gid_t,
6060
pub mode: crate::mode_t,
6161
pub __seq: c_ushort,
62-
__unused1: c_ulong,
63-
__unused2: c_ulong,
62+
__unused1: Padding<c_ulong>,
63+
__unused2: Padding<c_ulong>,
6464
}
6565
}
6666

src/fuchsia/mod.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -143,46 +143,46 @@ s! {
143143
pub ru_stime: timeval,
144144
pub ru_maxrss: c_long,
145145
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
146-
__pad1: u32,
146+
__pad1: Padding<u32>,
147147
pub ru_ixrss: c_long,
148148
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
149-
__pad2: u32,
149+
__pad2: Padding<u32>,
150150
pub ru_idrss: c_long,
151151
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
152-
__pad3: u32,
152+
__pad3: Padding<u32>,
153153
pub ru_isrss: c_long,
154154
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
155-
__pad4: u32,
155+
__pad4: Padding<u32>,
156156
pub ru_minflt: c_long,
157157
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
158-
__pad5: u32,
158+
__pad5: Padding<u32>,
159159
pub ru_majflt: c_long,
160160
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
161-
__pad6: u32,
161+
__pad6: Padding<u32>,
162162
pub ru_nswap: c_long,
163163
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
164-
__pad7: u32,
164+
__pad7: Padding<u32>,
165165
pub ru_inblock: c_long,
166166
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
167-
__pad8: u32,
167+
__pad8: Padding<u32>,
168168
pub ru_oublock: c_long,
169169
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
170-
__pad9: u32,
170+
__pad9: Padding<u32>,
171171
pub ru_msgsnd: c_long,
172172
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
173-
__pad10: u32,
173+
__pad10: Padding<u32>,
174174
pub ru_msgrcv: c_long,
175175
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
176-
__pad11: u32,
176+
__pad11: Padding<u32>,
177177
pub ru_nsignals: c_long,
178178
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
179-
__pad12: u32,
179+
__pad12: Padding<u32>,
180180
pub ru_nvcsw: c_long,
181181
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
182-
__pad13: u32,
182+
__pad13: Padding<u32>,
183183
pub ru_nivcsw: c_long,
184184
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
185-
__pad14: u32,
185+
__pad14: Padding<u32>,
186186
}
187187

188188
pub struct in_addr {
@@ -449,11 +449,11 @@ s! {
449449
pub gl_offs: size_t,
450450
pub gl_flags: c_int,
451451

452-
__unused1: *mut c_void,
453-
__unused2: *mut c_void,
454-
__unused3: *mut c_void,
455-
__unused4: *mut c_void,
456-
__unused5: *mut c_void,
452+
__unused1: Padding<*mut c_void>,
453+
__unused2: Padding<*mut c_void>,
454+
__unused3: Padding<*mut c_void>,
455+
__unused4: Padding<*mut c_void>,
456+
__unused5: Padding<*mut c_void>,
457457
}
458458

459459
pub struct ifaddrs {
@@ -538,7 +538,7 @@ s! {
538538
pub ssi_stime: u64,
539539
pub ssi_addr: u64,
540540
pub ssi_addr_lsb: u16,
541-
_pad2: u16,
541+
_pad2: Padding<u16>,
542542
pub ssi_syscall: i32,
543543
pub ssi_call_addr: u64,
544544
pub ssi_arch: u32,
@@ -795,8 +795,8 @@ s! {
795795
pub shm_cpid: crate::pid_t,
796796
pub shm_lpid: crate::pid_t,
797797
pub shm_nattch: c_ulong,
798-
__pad1: c_ulong,
799-
__pad2: c_ulong,
798+
__pad1: Padding<c_ulong>,
799+
__pad2: Padding<c_ulong>,
800800
}
801801

802802
pub struct msqid_ds {
@@ -809,8 +809,8 @@ s! {
809809
pub msg_qbytes: crate::msglen_t,
810810
pub msg_lspid: crate::pid_t,
811811
pub msg_lrpid: crate::pid_t,
812-
__pad1: c_ulong,
813-
__pad2: c_ulong,
812+
__pad1: Padding<c_ulong>,
813+
__pad2: Padding<c_ulong>,
814814
}
815815

816816
pub struct statfs {
@@ -833,10 +833,10 @@ s! {
833833
pub msg_namelen: crate::socklen_t,
834834
pub msg_iov: *mut crate::iovec,
835835
pub msg_iovlen: c_int,
836-
__pad1: c_int,
836+
__pad1: Padding<c_int>,
837837
pub msg_control: *mut c_void,
838838
pub msg_controllen: crate::socklen_t,
839-
__pad2: crate::socklen_t,
839+
__pad2: Padding<crate::socklen_t>,
840840
pub msg_flags: c_int,
841841
}
842842

@@ -924,7 +924,7 @@ s_no_extra_traits! {
924924

925925
pub struct sockaddr_storage {
926926
pub ss_family: sa_family_t,
927-
__ss_pad2: [u8; 128 - 2 - 8],
927+
__ss_pad2: Padding<[u8; 128 - 2 - 8]>,
928928
__ss_align: size_t,
929929
}
930930

@@ -981,7 +981,7 @@ s_no_extra_traits! {
981981

982982
pub struct sockaddr_nl {
983983
pub nl_family: crate::sa_family_t,
984-
nl_pad: c_ushort,
984+
nl_pad: Padding<c_ushort>,
985985
pub nl_pid: u32,
986986
pub nl_groups: u32,
987987
}

src/fuchsia/riscv64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ s! {
1717
pub st_mode: crate::mode_t,
1818
pub st_uid: crate::uid_t,
1919
pub st_gid: crate::gid_t,
20-
__pad0: c_int,
20+
__pad0: Padding<c_int>,
2121
pub st_rdev: crate::dev_t,
2222
pub st_size: off_t,
2323
pub st_blksize: crate::blksize_t,
@@ -28,7 +28,7 @@ s! {
2828
pub st_mtime_nsec: c_long,
2929
pub st_ctime: crate::time_t,
3030
pub st_ctime_nsec: c_long,
31-
__unused: [c_long; 3],
31+
__unused: Padding<[c_long; 3]>,
3232
}
3333

3434
// Not actually used, IPC calls just return ENOSYS
@@ -40,7 +40,7 @@ s! {
4040
pub cgid: crate::gid_t,
4141
pub mode: crate::mode_t,
4242
pub __seq: c_ushort,
43-
__unused1: c_ulong,
44-
__unused2: c_ulong,
43+
__unused1: Padding<c_ulong>,
44+
__unused2: Padding<c_ulong>,
4545
}
4646
}

src/fuchsia/x86_64.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ s! {
1414
pub st_mode: crate::mode_t,
1515
pub st_uid: crate::uid_t,
1616
pub st_gid: crate::gid_t,
17-
__pad0: c_int,
17+
__pad0: Padding<c_int>,
1818
pub st_rdev: crate::dev_t,
1919
pub st_size: off_t,
2020
pub st_blksize: crate::blksize_t,
@@ -25,7 +25,7 @@ s! {
2525
pub st_mtime_nsec: c_long,
2626
pub st_ctime: crate::time_t,
2727
pub st_ctime_nsec: c_long,
28-
__unused: [c_long; 3],
28+
__unused: Padding<[c_long; 3]>,
2929
}
3030

3131
pub struct stat64 {
@@ -35,7 +35,7 @@ s! {
3535
pub st_mode: crate::mode_t,
3636
pub st_uid: crate::uid_t,
3737
pub st_gid: crate::gid_t,
38-
__pad0: c_int,
38+
__pad0: Padding<c_int>,
3939
pub st_rdev: crate::dev_t,
4040
pub st_size: off_t,
4141
pub st_blksize: crate::blksize_t,
@@ -46,7 +46,7 @@ s! {
4646
pub st_mtime_nsec: c_long,
4747
pub st_ctime: crate::time_t,
4848
pub st_ctime_nsec: c_long,
49-
__reserved: [c_long; 3],
49+
__reserved: Padding<[c_long; 3]>,
5050
}
5151

5252
pub struct mcontext_t {
@@ -61,8 +61,8 @@ s! {
6161
pub cgid: crate::gid_t,
6262
pub mode: crate::mode_t,
6363
pub __seq: c_int,
64-
__unused1: c_long,
65-
__unused2: c_long,
64+
__unused1: Padding<c_long>,
65+
__unused2: Padding<c_long>,
6666
}
6767
}
6868

src/hermit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ s! {
8787
pub struct sockaddr_storage {
8888
pub ss_len: u8,
8989
pub ss_family: sa_family_t,
90-
__ss_pad1: [u8; 6],
90+
__ss_pad1: Padding<[u8; 6]>,
9191
__ss_align: i64,
92-
__ss_pad2: [u8; 112],
92+
__ss_pad2: Padding<[u8; 112]>,
9393
}
9494

9595
pub struct stat {

src/new/linux_uapi/linux/can.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ s! {
4646
pub can_id: canid_t,
4747
// FIXME(1.0): this field was renamed to `len` in Linux 5.11
4848
pub can_dlc: u8,
49-
__pad: u8,
49+
__pad: Padding<u8>,
5050
__res0: u8,
5151
pub len8_dlc: u8,
5252
pub data: [u8; CAN_MAX_DLEN],

src/unix/aix/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ s! {
247247
pub struct sockaddr_storage {
248248
pub __ss_len: c_uchar,
249249
pub ss_family: sa_family_t,
250-
__ss_pad1: [c_char; 6],
250+
__ss_pad1: Padding<[c_char; 6]>,
251251
__ss_align: crate::int64_t,
252-
__ss_pad2: [c_char; 1265],
252+
__ss_pad2: Padding<[c_char; 1265]>,
253253
}
254254

255255
pub struct sockaddr_un {

src/unix/bsd/apple/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,18 @@ s! {
263263

264264
pub struct glob_t {
265265
pub gl_pathc: size_t,
266-
__unused1: c_int,
266+
__unused1: Padding<c_int>,
267267
pub gl_offs: size_t,
268-
__unused2: c_int,
268+
__unused2: Padding<c_int>,
269269
pub gl_pathv: *mut *mut c_char,
270270

271-
__unused3: *mut c_void,
271+
__unused3: Padding<*mut c_void>,
272272

273-
__unused4: *mut c_void,
274-
__unused5: *mut c_void,
275-
__unused6: *mut c_void,
276-
__unused7: *mut c_void,
277-
__unused8: *mut c_void,
273+
__unused4: Padding<*mut c_void>,
274+
__unused5: Padding<*mut c_void>,
275+
__unused6: Padding<*mut c_void>,
276+
__unused7: Padding<*mut c_void>,
277+
__unused8: Padding<*mut c_void>,
278278
}
279279

280280
pub struct addrinfo {
@@ -338,7 +338,7 @@ s! {
338338
pub si_addr: *mut c_void,
339339
//Requires it to be union for tests
340340
//pub si_value: crate::sigval,
341-
_pad: [usize; 9],
341+
_pad: Padding<[usize; 9]>,
342342
}
343343

344344
pub struct sigaction {
@@ -1087,7 +1087,7 @@ s! {
10871087
pub tcpi_state: u8,
10881088
pub tcpi_snd_wscale: u8,
10891089
pub tcpi_rcv_wscale: u8,
1090-
__pad1: u8,
1090+
__pad1: Padding<u8>,
10911091
pub tcpi_options: u32,
10921092
pub tcpi_flags: u32,
10931093
pub tcpi_rto: u32,
@@ -1115,7 +1115,7 @@ s! {
11151115
pub tcpi_tfo_send_blackhole: u32,
11161116
pub tcpi_tfo_recv_blackhole: u32,
11171117
pub tcpi_tfo_onebyte_proxy: u32,
1118-
__pad2: u32,
1118+
__pad2: Padding<u32>,
11191119
pub tcpi_txpackets: u64,
11201120
pub tcpi_txbytes: u64,
11211121
pub tcpi_txretransmitbytes: u64,
@@ -1359,9 +1359,9 @@ s_no_extra_traits! {
13591359
pub struct sockaddr_storage {
13601360
pub ss_len: u8,
13611361
pub ss_family: crate::sa_family_t,
1362-
__ss_pad1: [u8; 6],
1362+
__ss_pad1: Padding<[u8; 6]>,
13631363
__ss_align: i64,
1364-
__ss_pad2: [u8; 112],
1364+
__ss_pad2: Padding<[u8; 112]>,
13651365
}
13661366

13671367
pub struct utmpx {
@@ -1379,7 +1379,7 @@ s_no_extra_traits! {
13791379
pub sigev_notify: c_int,
13801380
pub sigev_signo: c_int,
13811381
pub sigev_value: crate::sigval,
1382-
__unused1: *mut c_void, //actually a function pointer
1382+
__unused1: Padding<*mut c_void>, //actually a function pointer
13831383
pub sigev_notify_attributes: *mut crate::pthread_attr_t,
13841384
}
13851385

0 commit comments

Comments
 (0)