@@ -0,0 +1,28 @@
+use platform::types::*;
+
+#[derive(Clone, Copy)]
+struct CxaAtExitFunc {
+ func: extern "C" fn (*mut c_void),
+ arg: *mut c_void,
+ dso: *mut c_void
+}
+static mut CXA_ATEXIT_FUNCS: [Option<CxaAtExitFunc>; 32] = [None; 32];
+#[no_mangle]
+pub unsafe extern "C" fn __cxa_atexit (func_opt: Option<extern "C" fn (*mut c_void)>, arg: *mut c_void, dso: *mut c_void) -> c_int {
+ for i in 0..CXA_ATEXIT_FUNCS.len() {
+ if CXA_ATEXIT_FUNCS[i].is_none() {
+ CXA_ATEXIT_FUNCS[i] = func_opt.map(|func| CxaAtExitFunc {
+ func,
+ arg,
+ dso
+ });
+ return 0;
+ }
+ -1
+// TODO: cxa_finalize
@@ -5,6 +5,10 @@ language = "C"
# sgtty is used by another header, and cbindgen doesn't prefix that with `struct` :|
style = "Both"
+[defines]
+"target_os=linux" = "__linux__"
+"target_os=redox" = "__redox__"
[enum]
prefix_with_name = true
@@ -12,20 +12,20 @@ pub struct sgttyb {
sg_flags: c_ushort,
}
-#[repr(C)]
-#[derive(Default)]
-pub struct winsize {
- ws_row: c_ushort,
- ws_col: c_ushort,
- ws_xpixel: c_ushort,
- ws_ypixel: c_ushort,
-}
-
#[cfg(target_os = "linux")]
pub mod inner {
use platform::types::*;
use platform::Sys;
+ #[repr(C)]
+ #[derive(Default)]
+ pub struct winsize {
+ ws_row: c_ushort,
+ ws_col: c_ushort,
+ ws_xpixel: c_ushort,
+ ws_ypixel: c_ushort,
#[no_mangle]
pub extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) -> c_int {
// TODO: Somehow support varargs to syscall??
@@ -36,6 +36,7 @@ extern crate spin;
#[macro_use]
mod macros;
pub mod c_str;
+pub mod cxa;
pub mod fs;
pub mod header;
pub mod io;