aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/linux_like/emscripten/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/linux_like/emscripten/mod.rs')
-rw-r--r--libc/src/unix/linux_like/emscripten/mod.rs258
1 files changed, 162 insertions, 96 deletions
diff --git a/libc/src/unix/linux_like/emscripten/mod.rs b/libc/src/unix/linux_like/emscripten/mod.rs
index 67631fc..3fc47bb 100644
--- a/libc/src/unix/linux_like/emscripten/mod.rs
+++ b/libc/src/unix/linux_like/emscripten/mod.rs
@@ -5,8 +5,8 @@ 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 = u32;
-pub type off64_t = i32;
+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;
@@ -16,14 +16,14 @@ pub type msglen_t = ::c_ulong;
pub type nfds_t = ::c_ulong;
pub type nl_item = ::c_int;
pub type idtype_t = ::c_uint;
-pub type loff_t = i32;
+pub type loff_t = i64;
pub type pthread_key_t = ::c_uint;
pub type clock_t = c_long;
pub type time_t = c_long;
pub type suseconds_t = c_long;
-pub type ino_t = u32;
-pub type off_t = i32;
+pub type ino_t = u64;
+pub type off_t = i64;
pub type blkcnt_t = i32;
pub type blksize_t = c_long;
@@ -38,7 +38,9 @@ pub type nlink_t = u32;
pub enum fpos64_t {} // TODO: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
- fn clone(&self) -> fpos64_t { *self }
+ fn clone(&self) -> fpos64_t {
+ *self
+ }
}
s! {
@@ -221,6 +223,14 @@ 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]
}
@@ -1219,10 +1229,7 @@ pub const TCP_FASTOPEN: ::c_int = 23;
pub const TCP_TIMESTAMP: ::c_int = 24;
#[doc(hidden)]
-#[deprecated(
- since = "0.2.55",
- note = "Use SIGSYS instead"
-)]
+#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
pub const SIGUNUSED: ::c_int = ::SIGSYS;
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
@@ -1293,12 +1300,12 @@ pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
pub const TAB3: ::c_int = 0x00001800;
-pub const CR1: ::c_int = 0x00000200;
-pub const CR2: ::c_int = 0x00000400;
-pub const CR3: ::c_int = 0x00000600;
-pub const FF1: ::c_int = 0x00008000;
-pub const BS1: ::c_int = 0x00002000;
-pub const VT1: ::c_int = 0x00004000;
+pub const CR1: ::c_int = 0x00000200;
+pub const CR2: ::c_int = 0x00000400;
+pub const CR3: ::c_int = 0x00000600;
+pub const FF1: ::c_int = 0x00008000;
+pub const BS1: ::c_int = 0x00002000;
+pub const VT1: ::c_int = 0x00004000;
pub const VWERASE: usize = 14;
pub const VREPRINT: usize = 12;
pub const VSUSP: usize = 10;
@@ -1331,14 +1338,14 @@ pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
pub const CBAUDEX: ::tcflag_t = 0o010000;
pub const VSWTC: usize = 7;
-pub const OLCUC: ::tcflag_t = 0o000002;
-pub const NLDLY: ::tcflag_t = 0o000400;
-pub const CRDLY: ::tcflag_t = 0o003000;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
pub const TABDLY: ::tcflag_t = 0o014000;
-pub const BSDLY: ::tcflag_t = 0o020000;
-pub const FFDLY: ::tcflag_t = 0o100000;
-pub const VTDLY: ::tcflag_t = 0o040000;
-pub const XTABS: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -1719,15 +1726,16 @@ f! {
}
}
-extern {
- pub fn getrlimit64(resource: ::c_int,
- rlim: *mut rlimit64) -> ::c_int;
- pub fn setrlimit64(resource: ::c_int,
- rlim: *const rlimit64) -> ::c_int;
+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;
+ pub fn strerror_r(
+ errnum: ::c_int,
+ buf: *mut c_char,
+ buflen: ::size_t,
+ ) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -1735,108 +1743,166 @@ extern {
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
- pub fn gettimeofday(tp: *mut ::timeval,
- tz: *mut ::c_void) -> ::c_int;
+ pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn setpwent();
pub fn endpwent();
pub fn getpwent() -> *mut passwd;
- pub fn shm_open(name: *const c_char, oflag: ::c_int,
- mode: mode_t) -> ::c_int;
-
- pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
- -> ::c_int;
+ pub fn shm_open(
+ name: *const c_char,
+ oflag: ::c_int,
+ mode: mode_t,
+ ) -> ::c_int;
+
+ 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 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 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;
- pub fn preadv(fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t) -> ::ssize_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;
+ pub fn preadv(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ ) -> ::ssize_t;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
- pub fn getnameinfo(sa: *const ::sockaddr,
- salen: ::socklen_t,
- host: *mut ::c_char,
- hostlen: ::socklen_t,
- serv: *mut ::c_char,
- sevlen: ::socklen_t,
- flags: ::c_int) -> ::c_int;
+ pub fn mkostemps(
+ template: *mut ::c_char,
+ suffixlen: ::c_int,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
+ -> *mut ::c_char;
+ pub fn getnameinfo(
+ sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::socklen_t,
+ serv: *mut ::c_char,
+ sevlen: ::socklen_t,
+ flags: ::c_int,
+ ) -> ::c_int;
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
// Not available now on Android
- pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ pub fn mkfifoat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ ) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
- pub fn mremap(addr: *mut ::c_void,
- len: ::size_t,
- new_len: ::size_t,
- flags: ::c_int,
- ...) -> *mut ::c_void;
-
- pub fn glob(pattern: *const c_char,
- flags: ::c_int,
- errfunc: ::Option<extern fn(epath: *const c_char,
- errno: ::c_int) -> ::c_int>,
- pglob: *mut ::glob_t) -> ::c_int;
+ pub fn mremap(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ new_len: ::size_t,
+ flags: ::c_int,
+ ...
+ ) -> *mut ::c_void;
+
+ pub fn glob(
+ pattern: *const c_char,
+ flags: ::c_int,
+ errfunc: ::Option<
+ extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
+ >,
+ pglob: *mut ::glob_t,
+ ) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
- -> ::c_int;
+ pub fn posix_madvise(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ advice: ::c_int,
+ ) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
- -> ::c_int;
-
- pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
-
- pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
- flags: ::c_int, addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t) -> ::ssize_t;
+ pub fn madvise(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ advice: ::c_int,
+ ) -> ::c_int;
+
+ pub fn msync(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+
+ pub fn recvfrom(
+ socket: ::c_int,
+ buf: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ addr: *mut ::sockaddr,
+ addrlen: *mut ::socklen_t,
+ ) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
- pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
- flags: ::c_uint) -> ::c_int;
- pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
- flags: ::c_uint, timeout: *mut ::timespec) -> ::c_int;
+ pub fn sendmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
+ flags: ::c_uint,
+ ) -> ::c_int;
+ pub fn recvmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
+ flags: ::c_uint,
+ timeout: *mut ::timespec,
+ ) -> ::c_int;
pub fn sync();
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
- pub fn pthread_create(native: *mut ::pthread_t,
- attr: *const ::pthread_attr_t,
- f: extern fn(*mut ::c_void) -> *mut ::c_void,
- value: *mut ::c_void) -> ::c_int;
+ pub fn pthread_create(
+ native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void,
+ ) -> ::c_int;
}
cfg_if! {