aboutsummaryrefslogtreecommitdiff
path: root/src/unix/linux_like/emscripten/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/linux_like/emscripten/mod.rs')
-rw-r--r--src/unix/linux_like/emscripten/mod.rs150
1 files changed, 23 insertions, 127 deletions
diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs
index 5b947b63..1c9e4e6f 100644
--- a/src/unix/linux_like/emscripten/mod.rs
+++ b/src/unix/linux_like/emscripten/mod.rs
@@ -5,10 +5,6 @@ pub type dev_t = u32;
pub type socklen_t = u32;
pub type pthread_t = c_ulong;
pub type mode_t = u32;
-pub type ino64_t = u64;
-pub type off64_t = i64;
-pub type blkcnt64_t = i32;
-pub type rlim64_t = u64;
pub type shmatt_t = ::c_ulong;
pub type mqd_t = ::c_int;
pub type msgqnum_t = ::c_ulong;
@@ -29,11 +25,23 @@ pub type blkcnt_t = i32;
pub type blksize_t = c_long;
pub type fsblkcnt_t = u32;
pub type fsfilcnt_t = u32;
-pub type rlim_t = ::c_ulonglong;
+pub type rlim_t = u64;
pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;
+pub type ino64_t = ::ino_t;
+pub type off64_t = ::off_t;
+pub type blkcnt64_t = ::blkcnt_t;
+pub type rlim64_t = ::rlim_t;
+
+pub type rlimit64 = ::rlimit;
+pub type flock64 = ::flock;
+pub type stat64 = ::stat;
+pub type statfs64 = ::statfs;
+pub type statvfs64 = ::statvfs;
+pub type dirent64 = ::dirent;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
@@ -44,11 +52,6 @@ impl ::Clone for fpos64_t {
}
s! {
- pub struct rlimit64 {
- pub rlim_cur: rlim64_t,
- pub rlim_max: rlim64_t,
- }
-
pub struct glob_t {
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut c_char,
@@ -223,14 +226,6 @@ s! {
pub l_pid: ::pid_t,
}
- pub struct flock64 {
- pub l_type: ::c_short,
- pub l_whence: ::c_short,
- pub l_start: ::off64_t,
- pub l_len: ::off64_t,
- pub l_pid: ::pid_t,
- }
-
pub struct pthread_attr_t {
__size: [u32; 11]
}
@@ -260,35 +255,16 @@ s! {
}
pub struct stat {
pub st_dev: ::dev_t,
+ #[cfg(not(emscripten_new_stat_abi))]
__st_dev_padding: ::c_int,
+ #[cfg(not(emscripten_new_stat_abi))]
__st_ino_truncated: ::c_long,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
- __st_rdev_padding: ::c_int,
- pub st_size: ::off_t,
- pub st_blksize: ::blksize_t,
- pub st_blocks: ::blkcnt_t,
- pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_long,
- pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_long,
- pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_long,
- pub st_ino: ::ino_t,
- }
-
- pub struct stat64 {
- pub st_dev: ::dev_t,
- __st_dev_padding: ::c_int,
- __st_ino_truncated: ::c_long,
- pub st_mode: ::mode_t,
- pub st_nlink: ::nlink_t,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub st_rdev: ::dev_t,
+ #[cfg(not(emscripten_new_stat_abi))]
__st_rdev_padding: ::c_int,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
@@ -364,37 +340,6 @@ s! {
_align: [usize; 0],
}
- pub struct statfs64 {
- pub f_type: ::c_ulong,
- pub f_bsize: ::c_ulong,
- pub f_blocks: ::fsblkcnt_t,
- pub f_bfree: ::fsblkcnt_t,
- pub f_bavail: ::fsblkcnt_t,
- pub f_files: ::fsfilcnt_t,
- pub f_ffree: ::fsfilcnt_t,
- pub f_fsid: ::fsid_t,
- pub f_namelen: ::c_ulong,
- pub f_frsize: ::c_ulong,
- pub f_flags: ::c_ulong,
- pub f_spare: [::c_ulong; 4],
- }
-
- pub struct statvfs64 {
- pub f_bsize: ::c_ulong,
- pub f_frsize: ::c_ulong,
- pub f_blocks: u32,
- pub f_bfree: u32,
- pub f_bavail: u32,
- pub f_files: u32,
- pub f_ffree: u32,
- pub f_favail: u32,
- pub f_fsid: ::c_ulong,
- __f_unused: ::c_int,
- pub f_flag: ::c_ulong,
- pub f_namemax: ::c_ulong,
- __f_spare: [::c_int; 6],
- }
-
pub struct arpd_request {
pub req: ::c_ushort,
pub ip: u32,
@@ -414,14 +359,6 @@ s_no_extra_traits! {
pub d_name: [::c_char; 256],
}
- pub struct dirent64 {
- pub d_ino: ::ino64_t,
- pub d_off: ::off64_t,
- pub d_reclen: ::c_ushort,
- pub d_type: ::c_uchar,
- pub d_name: [::c_char; 256],
- }
-
pub struct sysinfo {
pub uptime: ::c_ulong,
pub loads: [::c_ulong; 3],
@@ -485,41 +422,6 @@ cfg_if! {
}
}
- impl PartialEq for dirent64 {
- fn eq(&self, other: &dirent64) -> bool {
- self.d_ino == other.d_ino
- && self.d_off == other.d_off
- && self.d_reclen == other.d_reclen
- && self.d_type == other.d_type
- && self
- .d_name
- .iter()
- .zip(other.d_name.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for dirent64 {}
- impl ::fmt::Debug for dirent64 {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("dirent64")
- .field("d_ino", &self.d_ino)
- .field("d_off", &self.d_off)
- .field("d_reclen", &self.d_reclen)
- .field("d_type", &self.d_type)
- // FIXME: .field("d_name", &self.d_name)
- .finish()
- }
- }
- impl ::hash::Hash for dirent64 {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.d_ino.hash(state);
- self.d_off.hash(state);
- self.d_reclen.hash(state);
- self.d_type.hash(state);
- self.d_name.hash(state);
- }
- }
-
impl PartialEq for sysinfo {
fn eq(&self, other: &sysinfo) -> bool {
self.uptime == other.uptime
@@ -1328,7 +1230,10 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
pub const RLIM_INFINITY: ::rlim_t = !0;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = 15;
+#[allow(deprecated)]
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
@@ -1757,8 +1662,6 @@ safe_f! {
}
extern "C" {
- pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
- pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
@@ -1779,17 +1682,6 @@ extern "C" {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn __errno_location() -> *mut ::c_int;
- pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
- pub fn freopen64(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut ::FILE,
- ) -> *mut ::FILE;
- pub fn tmpfile64() -> *mut ::FILE;
- pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
- pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
- pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
- pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
-> ::ssize_t;
@@ -1886,6 +1778,10 @@ extern "C" {
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
}
+// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
+mod lfs64;
+pub use self::lfs64::*;
+
cfg_if! {
if #[cfg(libc_align)] {
#[macro_use]