Skip to content

Commit 7f33bcb

Browse files
committed
Auto merge of #1561 - elichai:2019-10-flock64, r=gnzlbg
Add flock64 to linux_like platforms Hi, I'm not sure about what to make of the ifdef in glibc `__USE_LARGEFILE64` that covers it. but I copied the impl from glibc's headers. everything is the same except for sparc which has a reserved short int. and in musl it's just `#define flock64 flock`
2 parents 48e4bb9 + 490e073 commit 7f33bcb

File tree

13 files changed

+96
-0
lines changed

13 files changed

+96
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,9 @@ fn test_linux(target: &str) {
22342234

22352235
t if t.ends_with("_t") => t.to_string(),
22362236

2237+
// In MUSL `flock64` is a typedef to `flock`.
2238+
"flock64" if musl => format!("struct {}", ty),
2239+
22372240
// put `struct` in front of all structs:.
22382241
t if is_struct => format!("struct {}", t),
22392242

src/unix/linux_like/android/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub type ino_t = ::c_ulong;
2222
pub type __CPU_BITTYPE = ::c_ulong;
2323
pub type idtype_t = ::c_int;
2424
pub type loff_t = ::c_longlong;
25+
pub type __kernel_loff_t = ::c_longlong;
26+
pub type __kernel_pid_t = ::c_int;
2527

2628
s! {
2729
pub struct stack_t {
@@ -78,6 +80,14 @@ s! {
7880
pub l_pid: ::pid_t,
7981
}
8082

83+
pub struct flock64 {
84+
pub l_type: ::c_short,
85+
pub l_whence: ::c_short,
86+
pub l_start: ::__kernel_loff_t,
87+
pub l_len: ::__kernel_loff_t,
88+
pub l_pid: ::__kernel_pid_t,
89+
}
90+
8191
pub struct cpu_set_t {
8292
#[cfg(target_pointer_width = "64")]
8393
__bits: [__CPU_BITTYPE; 16],

src/unix/linux_like/emscripten/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ s! {
223223
pub l_pid: ::pid_t,
224224
}
225225

226+
pub struct flock64 {
227+
pub l_type: ::c_short,
228+
pub l_whence: ::c_short,
229+
pub l_start: ::off64_t,
230+
pub l_len: ::off64_t,
231+
pub l_pid: ::pid_t,
232+
}
233+
226234
pub struct pthread_attr_t {
227235
__size: [u32; 11]
228236
}

src/unix/linux_like/linux/gnu/b32/arm/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ s! {
3333
pub l_pid: ::pid_t,
3434
}
3535

36+
pub struct flock64 {
37+
pub l_type: ::c_short,
38+
pub l_whence: ::c_short,
39+
pub l_start: ::off64_t,
40+
pub l_len: ::off64_t,
41+
pub l_pid: ::pid_t,
42+
}
43+
3644
pub struct ipc_perm {
3745
pub __key: ::key_t,
3846
pub uid: ::uid_t,

src/unix/linux_like/linux/gnu/b32/powerpc.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ s! {
3333
pub l_pid: ::pid_t,
3434
}
3535

36+
pub struct flock64 {
37+
pub l_type: ::c_short,
38+
pub l_whence: ::c_short,
39+
pub l_start: ::off64_t,
40+
pub l_len: ::off64_t,
41+
pub l_pid: ::pid_t,
42+
}
43+
3644
pub struct ipc_perm {
3745
__key: ::key_t,
3846
pub uid: ::uid_t,

src/unix/linux_like/linux/gnu/b32/x86/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ s! {
3434
pub l_pid: ::pid_t,
3535
}
3636

37+
pub struct flock64 {
38+
pub l_type: ::c_short,
39+
pub l_whence: ::c_short,
40+
pub l_start: ::off64_t,
41+
pub l_len: ::off64_t,
42+
pub l_pid: ::pid_t,
43+
}
44+
3745
pub struct _libc_fpreg {
3846
pub significand: [u16; 4],
3947
pub exponent: u16,

src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ s! {
4545
pub l_pid: ::pid_t,
4646
}
4747

48+
pub struct flock64 {
49+
pub l_type: ::c_short,
50+
pub l_whence: ::c_short,
51+
pub l_start: ::off64_t,
52+
pub l_len: ::off64_t,
53+
pub l_pid: ::pid_t,
54+
}
55+
4856
pub struct stat {
4957
pub st_dev: ::dev_t,
5058
pub st_ino: ::ino_t,

src/unix/linux_like/linux/gnu/b64/mips64/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ s! {
5757
pub l_pid: ::pid_t,
5858
}
5959

60+
pub struct flock64 {
61+
pub l_type: ::c_short,
62+
pub l_whence: ::c_short,
63+
pub l_start: ::off64_t,
64+
pub l_len: ::off64_t,
65+
pub l_pid: ::pid_t,
66+
}
67+
6068
pub struct stat64 {
6169
pub st_dev: ::c_ulong,
6270
st_pad1: [::c_long; 2],

src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ s! {
4545
pub l_pid: ::pid_t,
4646
}
4747

48+
pub struct flock64 {
49+
pub l_type: ::c_short,
50+
pub l_whence: ::c_short,
51+
pub l_start: ::off64_t,
52+
pub l_len: ::off64_t,
53+
pub l_pid: ::pid_t,
54+
}
55+
4856
pub struct stat {
4957
pub st_dev: ::dev_t,
5058
pub st_ino: ::ino_t,

src/unix/linux_like/linux/gnu/b64/s390x.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ s! {
4444
pub l_pid: ::pid_t,
4545
}
4646

47+
pub struct flock64 {
48+
pub l_type: ::c_short,
49+
pub l_whence: ::c_short,
50+
pub l_start: ::off64_t,
51+
pub l_len: ::off64_t,
52+
pub l_pid: ::pid_t,
53+
}
54+
4755
pub struct siginfo_t {
4856
pub si_signo: ::c_int,
4957
pub si_errno: ::c_int,

0 commit comments

Comments
 (0)