Skip to content

Commit cb19b6e

Browse files
committed
linux(uclibc): fix cross-architecture flock def
Replace existing definitions. They were not correct under MIPS. This target needed some special casing.
1 parent 3515b1f commit cb19b6e

5 files changed

Lines changed: 36 additions & 18 deletions

File tree

src/unix/linux_like/linux/uclibc/arm/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ pub type nlink_t = c_uint;
99
pub type blksize_t = c_long;
1010

1111
s! {
12+
pub struct flock {
13+
pub l_type: c_short,
14+
pub l_whence: c_short,
15+
pub l_start: crate::off_t,
16+
pub l_len: crate::off_t,
17+
pub l_pid: crate::pid_t,
18+
}
19+
1220
pub struct cmsghdr {
1321
pub cmsg_len: size_t,
1422
pub cmsg_level: c_int,
@@ -95,14 +103,6 @@ s! {
95103
pub st_ino: crate::ino64_t,
96104
}
97105

98-
pub struct flock {
99-
pub l_type: c_short,
100-
pub l_whence: c_short,
101-
pub l_start: off_t,
102-
pub l_len: off_t,
103-
pub l_pid: crate::pid_t,
104-
}
105-
106106
pub struct sysinfo {
107107
pub uptime: c_long,
108108
pub loads: [c_ulong; 3],

src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,6 @@ s! {
183183
pub c_cc: [crate::cc_t; crate::NCCS],
184184
}
185185

186-
pub struct flock {
187-
pub l_type: c_short,
188-
pub l_whence: c_short,
189-
pub l_start: crate::off_t,
190-
pub l_len: crate::off_t,
191-
pub l_sysid: c_long,
192-
pub l_pid: crate::pid_t,
193-
pad: Padding<[c_long; 4]>,
194-
}
195-
196186
pub struct sysinfo {
197187
pub uptime: c_long,
198188
pub loads: [c_ulong; 3],

src/unix/linux_like/linux/uclibc/mips/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ s! {
3434
pub f_flags: c_long,
3535
f_spare: Padding<[c_long; 5]>,
3636
}
37+
38+
pub struct flock {
39+
pub l_type: c_short,
40+
pub l_whence: c_short,
41+
pub l_start: crate::off_t,
42+
pub l_len: crate::off_t,
43+
#[cfg(not(all(uclibc_file_offset_bits64, target_arch = "mips64")))]
44+
pub l_sysid: c_long,
45+
pub l_pid: crate::pid_t,
46+
#[cfg(not(all(uclibc_file_offset_bits64, target_arch = "mips64")))]
47+
pad: [c_long; 4],
48+
}
3749
}
3850

3951
pub const SFD_CLOEXEC: c_int = 0x080000;

src/unix/linux_like/linux/uclibc/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ cfg_if! {
5252
}
5353

5454
s! {
55+
pub struct flock64 {
56+
pub l_type: c_short,
57+
pub l_whence: c_short,
58+
pub l_start: crate::off64_t,
59+
pub l_len: crate::off64_t,
60+
pub l_pid: crate::pid_t,
61+
}
62+
5563
pub struct statvfs {
5664
// Different than GNU!
5765
pub f_bsize: c_ulong,

src/unix/linux_like/linux/uclibc/x86_64/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ pub type pthread_t = c_ulong;
1414
pub type stat64 = stat;
1515

1616
s! {
17+
pub struct flock {
18+
pub l_type: c_short,
19+
pub l_whence: c_short,
20+
pub l_start: crate::off_t,
21+
pub l_len: crate::off_t,
22+
pub l_pid: crate::pid_t,
23+
}
24+
1725
pub struct ipc_perm {
1826
pub __key: crate::key_t,
1927
pub uid: crate::uid_t,

0 commit comments

Comments
 (0)