summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Soller <jeremy@system76.com>2019-01-13 16:48:45 -0700
committerJeremy Soller <jeremy@system76.com>2019-01-13 16:48:45 -0700
commitd4d3ef379ced724876f3b348f7aa9f7f7a942a3c (patch)
treeea8ade372c873fefe06eefa00f0ed81e16c9ef0f
parent3a5ec3f91efbca685bf9d061fdcbc7ddddf2c576 (diff)
downloadrust-libc-d4d3ef379ced724876f3b348f7aa9f7f7a942a3c.tar.gz
Add more types
-rw-r--r--src/redox/mod.rs58
1 files changed, 50 insertions, 8 deletions
diff --git a/src/redox/mod.rs b/src/redox/mod.rs
index 578ce6fa60..8dabd9063e 100644
--- a/src/redox/mod.rs
+++ b/src/redox/mod.rs
@@ -30,16 +30,35 @@ pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
-pub type wchar_t = i16;
+pub type wchar_t = i32;
+pub type wint_t = u32;
+pub type wctype_t = i64;
+pub type regoff_t = size_t;
pub type off_t = c_long;
-pub type mode_t = u16;
-pub type time_t = i64;
-pub type pid_t = usize;
-pub type gid_t = usize;
-pub type uid_t = usize;
-
-pub type suseconds_t = i64;
+pub type mode_t = c_int;
+pub type time_t = c_long;
+pub type pid_t = c_int;
+pub type id_t = c_uint;
+pub type gid_t = c_int;
+pub type uid_t = c_int;
+pub type dev_t = c_long;
+pub type ino_t = c_ulong;
+pub type nlink_t = c_ulong;
+pub type blksize_t = c_long;
+pub type blkcnt_t = c_ulong;
+
+pub type fsblkcnt_t = c_ulong;
+pub type fsfilcnt_t = c_ulong;
+
+pub type useconds_t = c_uint;
+pub type suseconds_t = c_int;
+
+pub type clock_t = c_long;
+pub type clockid_t = c_int;
+pub type timer_t = *mut c_void;
+
+pub type nfds_t = c_ulong;
s! {
pub struct fd_set {
@@ -52,6 +71,25 @@ s! {
pub revents: ::c_short,
}
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+
+ pub st_atime: ::timespec,
+ pub st_mtime: ::timespec,
+ pub st_ctime: ::timespec,
+
+ _pad: [c_char; 24],
+ }
+
pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
@@ -128,6 +166,8 @@ pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
+pub const FD_CLOEXEC: ::c_int = 0x0100_0000;
+
pub const O_RDONLY: ::c_int = 0x0001_0000;
pub const O_WRONLY: ::c_int = 0x0002_0000;
pub const O_RDWR: ::c_int = 0x0003_0000;
@@ -303,6 +343,7 @@ extern {
pub fn close(fd: ::c_int) -> ::c_int;
pub fn fchown(fd: ::c_int, uid: ::uid_t, gid: ::gid_t) -> ::c_int;
pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
+ pub fn fstat(fd: ::c_int, buf: *mut stat) -> ::c_int;
pub fn fsync(fd: ::c_int) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn getpid() -> pid_t;
@@ -317,6 +358,7 @@ extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
+ pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int)
-> ::c_int;