Skip to content
Snippets Groups Projects
Verified Commit 9b0c74b9 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Fix ioctl being defined on redox, add cxa_atexit for gcc

parent 02c8355c
No related branches found
No related tags found
No related merge requests found
Pipeline #1796 passed with warnings
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" ...@@ -5,6 +5,10 @@ language = "C"
# sgtty is used by another header, and cbindgen doesn't prefix that with `struct` :| # sgtty is used by another header, and cbindgen doesn't prefix that with `struct` :|
style = "Both" style = "Both"
[defines]
"target_os=linux" = "__linux__"
"target_os=redox" = "__redox__"
[enum] [enum]
prefix_with_name = true prefix_with_name = true
......
...@@ -12,20 +12,20 @@ pub struct sgttyb { ...@@ -12,20 +12,20 @@ pub struct sgttyb {
sg_flags: c_ushort, 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")] #[cfg(target_os = "linux")]
pub mod inner { pub mod inner {
use platform::types::*; use platform::types::*;
use platform::Sys; 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] #[no_mangle]
pub extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) -> c_int { pub extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) -> c_int {
// TODO: Somehow support varargs to syscall?? // TODO: Somehow support varargs to syscall??
......
...@@ -36,6 +36,7 @@ extern crate spin; ...@@ -36,6 +36,7 @@ extern crate spin;
#[macro_use] #[macro_use]
mod macros; mod macros;
pub mod c_str; pub mod c_str;
pub mod cxa;
pub mod fs; pub mod fs;
pub mod header; pub mod header;
pub mod io; pub mod io;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment