aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys/src/sys
diff options
context:
space:
mode:
authorFenrir <[email protected]>2016-10-28 13:57:38 -0600
committerFenrir <[email protected]>2016-10-28 13:57:38 -0600
commit63d8c50b4835419a58584a3aaab079ecd9c6ed2b (patch)
treee807076431c28f0348687ddcedebdaf3db39d39a /ctru-sys/src/sys
parentMinor console refactor (diff)
downloadarchived-ctru-rs-63d8c50b4835419a58584a3aaab079ecd9c6ed2b.tar.xz
archived-ctru-rs-63d8c50b4835419a58584a3aaab079ecd9c6ed2b.zip
ctru-sys: recreate types.h and libc bindings
Diffstat (limited to 'ctru-sys/src/sys')
-rw-r--r--ctru-sys/src/sys/libc.rs63
-rw-r--r--ctru-sys/src/sys/mod.rs2
2 files changed, 63 insertions, 2 deletions
diff --git a/ctru-sys/src/sys/libc.rs b/ctru-sys/src/sys/libc.rs
index e7870a9..ab8eb7c 100644
--- a/ctru-sys/src/sys/libc.rs
+++ b/ctru-sys/src/sys/libc.rs
@@ -1,3 +1,8 @@
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+
pub const STDOUT_FILENO: c_int = 1;
#[repr(u8)]
@@ -19,10 +24,66 @@ pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type c_float = f32;
pub type c_double = f64;
-
pub type size_t = usize;
pub type ssize_t = isize;
+pub type u_char = c_uchar;
+pub type u_short = c_ushort;
+pub type u_int = c_uint;
+pub type u_long = c_ulong;
+pub type ushort = c_ushort;
+pub type uint_ = c_uint;
+pub type ulong = c_ulong;
+pub type clock_t = c_ulong;
+pub type time_t = c_long;
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct timespec {
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
+}
+impl ::core::default::Default for timespec {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct itimerspec {
+ pub it_interval: timespec,
+ pub it_value: timespec,
+}
+impl ::core::default::Default for itimerspec {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type daddr_t = c_long;
+pub type caddr_t = *mut c_char;
+pub type ino_t = c_uint;
+pub type off_t = c_long;
+pub type dev_t = c_int;
+pub type uid_t = c_ushort;
+pub type gid_t = c_ushort;
+pub type pid_t = c_int;
+pub type key_t = c_long;
+pub type mode_t = c_uint;
+pub type nlink_t = c_ushort;
+pub type fd_mask = c_long;
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct _types_fd_set {
+ pub fds_bits: [fd_mask; 1usize],
+}
+impl ::core::default::Default for _types_fd_set {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type clockid_t = c_ulong;
+pub type timer_t = c_ulong;
+pub type useconds_t = c_ulong;
+pub type suseconds_t = c_long;
+pub type fsblkcnt_t = c_uint;
+pub type fsfilcnt_t = c_uint;
+
extern "C" {
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
diff --git a/ctru-sys/src/sys/mod.rs b/ctru-sys/src/sys/mod.rs
index ca421e7..357a4d6 100644
--- a/ctru-sys/src/sys/mod.rs
+++ b/ctru-sys/src/sys/mod.rs
@@ -1,2 +1,2 @@
-pub mod lock;
pub mod libc;
+pub mod lock;