Skip to content

Commit d4d3ef3

Browse files
committed
Add more types
1 parent 3a5ec3f commit d4d3ef3

File tree

1 file changed

+50
-8
lines changed

1 file changed

+50
-8
lines changed

src/redox/mod.rs

+50-8
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,35 @@ pub type c_char = i8;
3030
pub type c_long = i64;
3131
pub type c_ulong = u64;
3232

33-
pub type wchar_t = i16;
33+
pub type wchar_t = i32;
34+
pub type wint_t = u32;
35+
pub type wctype_t = i64;
3436

37+
pub type regoff_t = size_t;
3538
pub type off_t = c_long;
36-
pub type mode_t = u16;
37-
pub type time_t = i64;
38-
pub type pid_t = usize;
39-
pub type gid_t = usize;
40-
pub type uid_t = usize;
41-
42-
pub type suseconds_t = i64;
39+
pub type mode_t = c_int;
40+
pub type time_t = c_long;
41+
pub type pid_t = c_int;
42+
pub type id_t = c_uint;
43+
pub type gid_t = c_int;
44+
pub type uid_t = c_int;
45+
pub type dev_t = c_long;
46+
pub type ino_t = c_ulong;
47+
pub type nlink_t = c_ulong;
48+
pub type blksize_t = c_long;
49+
pub type blkcnt_t = c_ulong;
50+
51+
pub type fsblkcnt_t = c_ulong;
52+
pub type fsfilcnt_t = c_ulong;
53+
54+
pub type useconds_t = c_uint;
55+
pub type suseconds_t = c_int;
56+
57+
pub type clock_t = c_long;
58+
pub type clockid_t = c_int;
59+
pub type timer_t = *mut c_void;
60+
61+
pub type nfds_t = c_ulong;
4362

4463
s! {
4564
pub struct fd_set {
@@ -52,6 +71,25 @@ s! {
5271
pub revents: ::c_short,
5372
}
5473

74+
pub struct stat {
75+
pub st_dev: ::dev_t,
76+
pub st_ino: ::ino_t,
77+
pub st_nlink: ::nlink_t,
78+
pub st_mode: ::mode_t,
79+
pub st_uid: ::uid_t,
80+
pub st_gid: ::gid_t,
81+
pub st_rdev: ::dev_t,
82+
pub st_size: ::off_t,
83+
pub st_blksize: ::blksize_t,
84+
pub st_blocks: ::blkcnt_t,
85+
86+
pub st_atime: ::timespec,
87+
pub st_mtime: ::timespec,
88+
pub st_ctime: ::timespec,
89+
90+
_pad: [c_char; 24],
91+
}
92+
5593
pub struct timeval {
5694
pub tv_sec: time_t,
5795
pub tv_usec: suseconds_t,
@@ -128,6 +166,8 @@ pub const F_SETFD: ::c_int = 2;
128166
pub const F_GETFL: ::c_int = 3;
129167
pub const F_SETFL: ::c_int = 4;
130168

169+
pub const FD_CLOEXEC: ::c_int = 0x0100_0000;
170+
131171
pub const O_RDONLY: ::c_int = 0x0001_0000;
132172
pub const O_WRONLY: ::c_int = 0x0002_0000;
133173
pub const O_RDWR: ::c_int = 0x0003_0000;
@@ -303,6 +343,7 @@ extern {
303343
pub fn close(fd: ::c_int) -> ::c_int;
304344
pub fn fchown(fd: ::c_int, uid: ::uid_t, gid: ::gid_t) -> ::c_int;
305345
pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
346+
pub fn fstat(fd: ::c_int, buf: *mut stat) -> ::c_int;
306347
pub fn fsync(fd: ::c_int) -> ::c_int;
307348
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
308349
pub fn getpid() -> pid_t;
@@ -317,6 +358,7 @@ extern {
317358
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
318359
-> ::c_int;
319360
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
361+
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
320362
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
321363
pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int)
322364
-> ::c_int;

0 commit comments

Comments
 (0)