From c7e709ffa41465779d9af727e061d1ab9fe916a9 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Mon, 5 Sep 2016 13:47:25 -0700 Subject: [PATCH] ctru-sys: add proper libc typedefs --- ctru-sys/src/sys/libc.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ctru-sys/src/sys/libc.rs b/ctru-sys/src/sys/libc.rs index b4d4a12..997744d 100644 --- a/ctru-sys/src/sys/libc.rs +++ b/ctru-sys/src/sys/libc.rs @@ -1,4 +1,4 @@ -pub const STDOUT_FILENO: i32 = 1; +pub const STDOUT_FILENO: c_int = 1; #[repr(u8)] pub enum c_void { @@ -6,7 +6,23 @@ pub enum c_void { __variant2, } +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_char = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_longlong = i64; +pub type c_ulonglong = u64; + +pub type size_t = usize; +pub type ssize_t = isize; + extern "C" { - pub fn abort() -> !; - pub fn write(fd: i32, buf: *const c_void, count: usize) -> isize; + pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; + 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; }