Skip to content

Commit 38d07d4

Browse files
committed
libc: wrap padding fields with Padding newtype.
1 parent cd7f8a6 commit 38d07d4

File tree

80 files changed

+707
-707
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

+707
-707
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
@@ -121,46 +121,46 @@ s! {
121121
pub ru_stime: timeval,
122122
pub ru_maxrss: c_long,
123123
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
124-
__pad1: u32,
124+
__pad1: Padding<u32>,
125125
pub ru_ixrss: c_long,
126126
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
127-
__pad2: u32,
127+
__pad2: Padding<u32>,
128128
pub ru_idrss: c_long,
129129
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
130-
__pad3: u32,
130+
__pad3: Padding<u32>,
131131
pub ru_isrss: c_long,
132132
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
133-
__pad4: u32,
133+
__pad4: Padding<u32>,
134134
pub ru_minflt: c_long,
135135
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
136-
__pad5: u32,
136+
__pad5: Padding<u32>,
137137
pub ru_majflt: c_long,
138138
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
139-
__pad6: u32,
139+
__pad6: Padding<u32>,
140140
pub ru_nswap: c_long,
141141
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
142-
__pad7: u32,
142+
__pad7: Padding<u32>,
143143
pub ru_inblock: c_long,
144144
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
145-
__pad8: u32,
145+
__pad8: Padding<u32>,
146146
pub ru_oublock: c_long,
147147
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
148-
__pad9: u32,
148+
__pad9: Padding<u32>,
149149
pub ru_msgsnd: c_long,
150150
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
151-
__pad10: u32,
151+
__pad10: Padding<u32>,
152152
pub ru_msgrcv: c_long,
153153
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
154-
__pad11: u32,
154+
__pad11: Padding<u32>,
155155
pub ru_nsignals: c_long,
156156
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
157-
__pad12: u32,
157+
__pad12: Padding<u32>,
158158
pub ru_nvcsw: c_long,
159159
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
160-
__pad13: u32,
160+
__pad13: Padding<u32>,
161161
pub ru_nivcsw: c_long,
162162
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
163-
__pad14: u32,
163+
__pad14: Padding<u32>,
164164
}
165165

166166
pub struct in_addr {
@@ -427,11 +427,11 @@ s! {
427427
pub gl_offs: size_t,
428428
pub gl_flags: c_int,
429429

430-
__unused1: *mut c_void,
431-
__unused2: *mut c_void,
432-
__unused3: *mut c_void,
433-
__unused4: *mut c_void,
434-
__unused5: *mut c_void,
430+
__unused1: Padding<*mut c_void>,
431+
__unused2: Padding<*mut c_void>,
432+
__unused3: Padding<*mut c_void>,
433+
__unused4: Padding<*mut c_void>,
434+
__unused5: Padding<*mut c_void>,
435435
}
436436

437437
pub struct ifaddrs {
@@ -516,7 +516,7 @@ s! {
516516
pub ssi_stime: u64,
517517
pub ssi_addr: u64,
518518
pub ssi_addr_lsb: u16,
519-
_pad2: u16,
519+
_pad2: Padding<u16>,
520520
pub ssi_syscall: i32,
521521
pub ssi_call_addr: u64,
522522
pub ssi_arch: u32,
@@ -773,8 +773,8 @@ s! {
773773
pub shm_cpid: crate::pid_t,
774774
pub shm_lpid: crate::pid_t,
775775
pub shm_nattch: c_ulong,
776-
__pad1: c_ulong,
777-
__pad2: c_ulong,
776+
__pad1: Padding<c_ulong>,
777+
__pad2: Padding<c_ulong>,
778778
}
779779

780780
pub struct msqid_ds {
@@ -787,8 +787,8 @@ s! {
787787
pub msg_qbytes: crate::msglen_t,
788788
pub msg_lspid: crate::pid_t,
789789
pub msg_lrpid: crate::pid_t,
790-
__pad1: c_ulong,
791-
__pad2: c_ulong,
790+
__pad1: Padding<c_ulong>,
791+
__pad2: Padding<c_ulong>,
792792
}
793793

794794
pub struct statfs {
@@ -811,10 +811,10 @@ s! {
811811
pub msg_namelen: crate::socklen_t,
812812
pub msg_iov: *mut crate::iovec,
813813
pub msg_iovlen: c_int,
814-
__pad1: c_int,
814+
__pad1: Padding<c_int>,
815815
pub msg_control: *mut c_void,
816816
pub msg_controllen: crate::socklen_t,
817-
__pad2: crate::socklen_t,
817+
__pad2: Padding<crate::socklen_t>,
818818
pub msg_flags: c_int,
819819
}
820820

@@ -900,7 +900,7 @@ s! {
900900

901901
pub struct sockaddr_storage {
902902
pub ss_family: sa_family_t,
903-
__ss_pad2: [u8; 128 - 2 - 8],
903+
__ss_pad2: Padding<[u8; 128 - 2 - 8]>,
904904
__ss_align: size_t,
905905
}
906906

@@ -957,7 +957,7 @@ s! {
957957

958958
pub struct sockaddr_nl {
959959
pub nl_family: crate::sa_family_t,
960-
nl_pad: c_ushort,
960+
nl_pad: Padding<c_ushort>,
961961
pub nl_pid: u32,
962962
pub nl_groups: u32,
963963
}

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
pub struct ucontext_t {

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
@@ -41,7 +41,7 @@ s! {
4141
pub can_id: canid_t,
4242
// FIXME(1.0): this field was renamed to `len` in Linux 5.11
4343
pub can_dlc: u8,
44-
__pad: u8,
44+
__pad: Padding<u8>,
4545
__res0: u8,
4646
pub len8_dlc: u8,
4747
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
@@ -251,9 +251,9 @@ s! {
251251
pub struct sockaddr_storage {
252252
pub __ss_len: c_uchar,
253253
pub ss_family: sa_family_t,
254-
__ss_pad1: [c_char; 6],
254+
__ss_pad1: Padding<[c_char; 6]>,
255255
__ss_align: crate::int64_t,
256-
__ss_pad2: [c_char; 1265],
256+
__ss_pad2: Padding<[c_char; 1265]>,
257257
}
258258

259259
pub struct sockaddr_un {

src/unix/bsd/apple/mod.rs

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

262262
pub struct glob_t {
263263
pub gl_pathc: size_t,
264-
__unused1: c_int,
264+
__unused1: Padding<c_int>,
265265
pub gl_offs: size_t,
266-
__unused2: c_int,
266+
__unused2: Padding<c_int>,
267267
pub gl_pathv: *mut *mut c_char,
268268

269-
__unused3: *mut c_void,
269+
__unused3: Padding<*mut c_void>,
270270

271-
__unused4: *mut c_void,
272-
__unused5: *mut c_void,
273-
__unused6: *mut c_void,
274-
__unused7: *mut c_void,
275-
__unused8: *mut c_void,
271+
__unused4: Padding<*mut c_void>,
272+
__unused5: Padding<*mut c_void>,
273+
__unused6: Padding<*mut c_void>,
274+
__unused7: Padding<*mut c_void>,
275+
__unused8: Padding<*mut c_void>,
276276
}
277277

278278
pub struct addrinfo {
@@ -336,7 +336,7 @@ s! {
336336
pub si_addr: *mut c_void,
337337
//Requires it to be union for tests
338338
//pub si_value: crate::sigval,
339-
_pad: [usize; 9],
339+
_pad: Padding<[usize; 9]>,
340340
}
341341

342342
pub struct sigaction {
@@ -1085,7 +1085,7 @@ s! {
10851085
pub tcpi_state: u8,
10861086
pub tcpi_snd_wscale: u8,
10871087
pub tcpi_rcv_wscale: u8,
1088-
__pad1: u8,
1088+
__pad1: Padding<u8>,
10891089
pub tcpi_options: u32,
10901090
pub tcpi_flags: u32,
10911091
pub tcpi_rto: u32,
@@ -1113,7 +1113,7 @@ s! {
11131113
pub tcpi_tfo_send_blackhole: u32,
11141114
pub tcpi_tfo_recv_blackhole: u32,
11151115
pub tcpi_tfo_onebyte_proxy: u32,
1116-
__pad2: u32,
1116+
__pad2: Padding<u32>,
11171117
pub tcpi_txpackets: u64,
11181118
pub tcpi_txbytes: u64,
11191119
pub tcpi_txretransmitbytes: u64,
@@ -1349,9 +1349,9 @@ s! {
13491349
pub struct sockaddr_storage {
13501350
pub ss_len: u8,
13511351
pub ss_family: crate::sa_family_t,
1352-
__ss_pad1: [u8; 6],
1352+
__ss_pad1: Padding<[u8; 6]>,
13531353
__ss_align: i64,
1354-
__ss_pad2: [u8; 112],
1354+
__ss_pad2: Padding<[u8; 112]>,
13551355
}
13561356

13571357
pub struct utmpx {
@@ -1369,7 +1369,7 @@ s! {
13691369
pub sigev_notify: c_int,
13701370
pub sigev_signo: c_int,
13711371
pub sigev_value: crate::sigval,
1372-
__unused1: *mut c_void, //actually a function pointer
1372+
__unused1: Padding<*mut c_void>, //actually a function pointer
13731373
pub sigev_notify_attributes: *mut crate::pthread_attr_t,
13741374
}
13751375
pub struct processor_cpu_load_info {

0 commit comments

Comments
 (0)