diff --git a/ctru-sys/bindgen-ctru-sys/src/main.rs b/ctru-sys/bindgen-ctru-sys/src/main.rs index 1a0f7eb..222eb66 100644 --- a/ctru-sys/bindgen-ctru-sys/src/main.rs +++ b/ctru-sys/bindgen-ctru-sys/src/main.rs @@ -16,13 +16,15 @@ fn main() { let devkitarm = std::env::var("DEVKITARM").expect("DEVKITARM not set in environment"); let include_path = PathBuf::from_iter([devkitpro.as_str(), "libctru", "include"]); - let header = include_path.join("3ds.h"); + let ctru_header = include_path.join("3ds.h"); let sysroot = PathBuf::from(devkitarm).join("arm-none-eabi"); let system_include = sysroot.join("include"); + let errno_header = system_include.join("errno.h"); let bindings = Builder::default() - .header(header.to_str().unwrap()) + .header(ctru_header.to_str().unwrap()) + .header(errno_header.to_str().unwrap()) .rust_target(RustTarget::Nightly) .use_core() .trust_clang_mangling(false) diff --git a/ctru-sys/src/bindings.rs b/ctru-sys/src/bindings.rs index fc480d8..3b092c3 100644 --- a/ctru-sys/src/bindings.rs +++ b/ctru-sys/src/bindings.rs @@ -1231,6 +1231,93 @@ pub const MIISELECTOR_USERMII_SLOTS: u32 = 100; pub const MIISELECTOR_GUESTMII_NAME_LEN: u32 = 12; pub const ARCHIVE_DIRITER_MAGIC: u32 = 1751347809; pub const LINK3DS_COMM_PORT: u32 = 17491; +pub const __error_t_defined: u32 = 1; +pub const EPERM: u32 = 1; +pub const ENOENT: u32 = 2; +pub const ESRCH: u32 = 3; +pub const EINTR: u32 = 4; +pub const EIO: u32 = 5; +pub const ENXIO: u32 = 6; +pub const E2BIG: u32 = 7; +pub const ENOEXEC: u32 = 8; +pub const EBADF: u32 = 9; +pub const ECHILD: u32 = 10; +pub const EAGAIN: u32 = 11; +pub const ENOMEM: u32 = 12; +pub const EACCES: u32 = 13; +pub const EFAULT: u32 = 14; +pub const EBUSY: u32 = 16; +pub const EEXIST: u32 = 17; +pub const EXDEV: u32 = 18; +pub const ENODEV: u32 = 19; +pub const ENOTDIR: u32 = 20; +pub const EISDIR: u32 = 21; +pub const EINVAL: u32 = 22; +pub const ENFILE: u32 = 23; +pub const EMFILE: u32 = 24; +pub const ENOTTY: u32 = 25; +pub const ETXTBSY: u32 = 26; +pub const EFBIG: u32 = 27; +pub const ENOSPC: u32 = 28; +pub const ESPIPE: u32 = 29; +pub const EROFS: u32 = 30; +pub const EMLINK: u32 = 31; +pub const EPIPE: u32 = 32; +pub const EDOM: u32 = 33; +pub const ERANGE: u32 = 34; +pub const ENOMSG: u32 = 35; +pub const EIDRM: u32 = 36; +pub const EDEADLK: u32 = 45; +pub const ENOLCK: u32 = 46; +pub const ENOSTR: u32 = 60; +pub const ENODATA: u32 = 61; +pub const ETIME: u32 = 62; +pub const ENOSR: u32 = 63; +pub const ENOLINK: u32 = 67; +pub const EPROTO: u32 = 71; +pub const EMULTIHOP: u32 = 74; +pub const EBADMSG: u32 = 77; +pub const EFTYPE: u32 = 79; +pub const ENOSYS: u32 = 88; +pub const ENOTEMPTY: u32 = 90; +pub const ENAMETOOLONG: u32 = 91; +pub const ELOOP: u32 = 92; +pub const EOPNOTSUPP: u32 = 95; +pub const EPFNOSUPPORT: u32 = 96; +pub const ECONNRESET: u32 = 104; +pub const ENOBUFS: u32 = 105; +pub const EAFNOSUPPORT: u32 = 106; +pub const EPROTOTYPE: u32 = 107; +pub const ENOTSOCK: u32 = 108; +pub const ENOPROTOOPT: u32 = 109; +pub const ECONNREFUSED: u32 = 111; +pub const EADDRINUSE: u32 = 112; +pub const ECONNABORTED: u32 = 113; +pub const ENETUNREACH: u32 = 114; +pub const ENETDOWN: u32 = 115; +pub const ETIMEDOUT: u32 = 116; +pub const EHOSTDOWN: u32 = 117; +pub const EHOSTUNREACH: u32 = 118; +pub const EINPROGRESS: u32 = 119; +pub const EALREADY: u32 = 120; +pub const EDESTADDRREQ: u32 = 121; +pub const EMSGSIZE: u32 = 122; +pub const EPROTONOSUPPORT: u32 = 123; +pub const EADDRNOTAVAIL: u32 = 125; +pub const ENETRESET: u32 = 126; +pub const EISCONN: u32 = 127; +pub const ENOTCONN: u32 = 128; +pub const ETOOMANYREFS: u32 = 129; +pub const EDQUOT: u32 = 132; +pub const ESTALE: u32 = 133; +pub const ENOTSUP: u32 = 134; +pub const EILSEQ: u32 = 138; +pub const EOVERFLOW: u32 = 139; +pub const ECANCELED: u32 = 140; +pub const ENOTRECOVERABLE: u32 = 141; +pub const EOWNERDEAD: u32 = 142; +pub const EWOULDBLOCK: u32 = 11; +pub const __ELASTERROR: u32 = 2000; pub type __int8_t = ::libc::c_schar; pub type __uint8_t = ::libc::c_uchar; pub type __int16_t = ::libc::c_short; @@ -18357,3 +18444,13 @@ extern "C" { #[doc = " Connects to the 3dslink host, setting up an output stream.\n # Arguments\n\n* `redirStdout` (direction in) - Whether to redirect stdout to nxlink output.\n * `redirStderr` (direction in) - Whether to redirect stderr to nxlink output.\n # Returns\n\nSocket fd on success, negative number on failure.\n > **Note:** The socket should be closed with close() during application cleanup."] pub fn link3dsConnectToHost(redirStdout: bool, redirStderr: bool) -> ::libc::c_int; } +pub type error_t = ::libc::c_int; +extern "C" { + pub fn __errno() -> *mut ::libc::c_int; +} +extern "C" { + pub static _sys_errlist: [*const ::libc::c_char; 0usize]; +} +extern "C" { + pub static mut _sys_nerr: ::libc::c_int; +} diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs index 3ec110d..474e1d2 100644 --- a/ctru-sys/src/lib.rs +++ b/ctru-sys/src/lib.rs @@ -16,7 +16,3 @@ pub use result::*; pub unsafe fn errno() -> s32 { *__errno() } - -extern "C" { - fn __errno() -> *mut libc::c_int; -}