Skip to content

Commit 10693b4

Browse files
committed
uclibc: fix x86_64-unknown-l4re-uclibc build
1 parent b85a557 commit 10693b4

File tree

3 files changed

+58
-12
lines changed

3 files changed

+58
-12
lines changed

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

+54-12
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ pub type ino_t = ::c_ulong;
1212
pub type nlink_t = ::c_uint;
1313
pub type off_t = ::c_long;
1414
pub type rlim_t = c_ulong;
15-
pub type rlim64_t = u64;
1615
// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
1716
pub type stat64 = stat;
1817
pub type suseconds_t = ::c_long;
1918
pub type time_t = ::c_int;
2019
pub type wchar_t = ::c_int;
2120

21+
pub type fsblkcnt64_t = u64;
22+
pub type fsfilcnt64_t = u64;
23+
pub type __u64 = ::c_ulong;
24+
2225
s! {
2326
pub struct ipc_perm {
2427
pub __key: ::key_t,
@@ -167,6 +170,37 @@ s! {
167170
f_spare: [fsword_t; 5],
168171
}
169172

173+
pub struct statfs64 {
174+
pub f_type: ::c_int,
175+
pub f_bsize: ::c_int,
176+
pub f_blocks: ::fsblkcnt64_t,
177+
pub f_bfree: ::fsblkcnt64_t,
178+
pub f_bavail: ::fsblkcnt64_t,
179+
pub f_files: ::fsfilcnt64_t,
180+
pub f_ffree: ::fsfilcnt64_t,
181+
pub f_fsid: ::fsid_t,
182+
pub f_namelen: ::c_int,
183+
pub f_frsize: ::c_int,
184+
pub f_flags: ::c_int,
185+
pub f_spare: [::c_int; 4],
186+
}
187+
188+
pub struct statvfs64 {
189+
pub f_bsize: ::c_ulong,
190+
pub f_frsize: ::c_ulong,
191+
pub f_blocks: u64,
192+
pub f_bfree: u64,
193+
pub f_bavail: u64,
194+
pub f_files: u64,
195+
pub f_ffree: u64,
196+
pub f_favail: u64,
197+
pub f_fsid: ::c_ulong,
198+
__f_unused: ::c_int,
199+
pub f_flag: ::c_ulong,
200+
pub f_namemax: ::c_ulong,
201+
__f_spare: [::c_int; 6],
202+
}
203+
170204
pub struct msghdr { // FIXME
171205
pub msg_name: *mut ::c_void,
172206
pub msg_namelen: ::socklen_t,
@@ -229,6 +263,21 @@ s! {
229263
pub struct fsid_t { // FIXME
230264
__val: [::c_int; 2],
231265
}
266+
267+
// FIXME this is actually a union
268+
pub struct sem_t {
269+
#[cfg(target_pointer_width = "32")]
270+
__size: [::c_char; 16],
271+
#[cfg(target_pointer_width = "64")]
272+
__size: [::c_char; 32],
273+
__align: [::c_long; 0],
274+
}
275+
276+
pub struct cmsghdr {
277+
pub cmsg_len: ::size_t,
278+
pub cmsg_level: ::c_int,
279+
pub cmsg_type: ::c_int,
280+
}
232281
}
233282

234283
s_no_extra_traits! {
@@ -252,6 +301,8 @@ pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
252301
pub const ENOSYS: ::c_int = 38; // Function not implemented
253302
pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
254303
pub const ETIMEDOUT: ::c_int = 110; // connection timed out
304+
pub const EOPNOTSUPP: ::c_int = 0x5f;
305+
pub const ENODATA: ::c_int = 0x3d;
255306
pub const O_APPEND: ::c_int = 02000;
256307
pub const O_ACCMODE: ::c_int = 0003;
257308
pub const O_CLOEXEC: ::c_int = 0x80000;
@@ -272,10 +323,12 @@ pub const SOL_SOCKET: ::c_int = 1;
272323
pub const SO_RCVTIMEO: ::c_int = 20;
273324
pub const SO_REUSEADDR: ::c_int = 2;
274325
pub const SO_SNDTIMEO: ::c_int = 21;
326+
pub const SO_TIMESTAMP: ::c_int = 0x1d;
275327
pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
276328
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
277329
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
278330
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
331+
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
279332

280333
cfg_if! {
281334
if #[cfg(target_os = "l4re")] {
@@ -286,14 +339,3 @@ cfg_if! {
286339
pub use other::*;
287340
}
288341
}
289-
290-
cfg_if! {
291-
if #[cfg(libc_align)] {
292-
#[macro_use]
293-
mod align;
294-
} else {
295-
#[macro_use]
296-
mod no_align;
297-
}
298-
}
299-
expand_align!();

src/unix/linux_like/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,9 @@ cfg_if! {
17151715
} else if #[cfg(target_os = "linux")] {
17161716
mod linux;
17171717
pub use self::linux::*;
1718+
} else if #[cfg(target_os = "l4re")] {
1719+
mod linux;
1720+
pub use self::linux::*;
17181721
} else if #[cfg(target_os = "android")] {
17191722
mod android;
17201723
pub use self::android::*;

src/unix/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,7 @@ cfg_if! {
16141614
mod newlib;
16151615
pub use self::newlib::*;
16161616
} else if #[cfg(any(target_os = "linux",
1617+
target_os = "l4re",
16171618
target_os = "android",
16181619
target_os = "emscripten"))] {
16191620
mod linux_like;

0 commit comments

Comments
 (0)