Add the last few things for bash to compile :D

This commit is contained in:
jD91mZM2
2018-08-03 11:18:52 +02:00
parent 44599a032e
commit ba8bd8c4e8
12 changed files with 112 additions and 26 deletions
+4
View File
@@ -443,6 +443,10 @@ pub fn times(out: *mut tms) -> clock_t {
unsafe { syscall!(TIMES, out) as clock_t }
}
pub fn umask(mask: mode_t) -> mode_t {
unsafe { syscall!(UMASK, mask) as mode_t }
}
pub fn uname(utsname: *mut utsname) -> c_int {
e(unsafe { syscall!(UNAME, utsname, 0) }) as c_int
}
+17 -12
View File
@@ -415,7 +415,7 @@ pub fn getgid() -> gid_t {
}
pub fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: getrusage({}, {:p})",
who,
@@ -475,7 +475,7 @@ unsafe fn inner_get_name(
}
pub fn getitimer(which: c_int, out: *mut itimerval) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: getitimer({}, {:p})",
which,
@@ -523,7 +523,7 @@ pub fn getsockopt(
option_value: *mut c_void,
option_len: *mut socklen_t,
) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: getsockopt({}, {}, {}, {:p}, {:p})",
socket,
@@ -838,7 +838,7 @@ pub unsafe fn sendto(
}
pub fn setitimer(which: c_int, new: *const itimerval, old: *mut itimerval) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: setitimer({}, {:p}, {:p})",
which,
@@ -871,7 +871,7 @@ pub fn setsockopt(
option_value: *const c_void,
option_len: socklen_t,
) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: setsockopt({}, {}, {}, {:p}, {})",
socket,
@@ -884,7 +884,7 @@ pub fn setsockopt(
}
pub fn shutdown(socket: c_int, how: c_int) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: shutdown({}, {})",
socket,
@@ -896,14 +896,14 @@ pub fn shutdown(socket: c_int, how: c_int) -> c_int {
pub unsafe fn sigaction(sig: c_int, act: *const sigaction, oact: *mut sigaction) -> c_int {
if !oact.is_null() {
// Assumes the last sigaction() call was made by relibc and not a different one
if let Some(callback) = SIG_HANDLER {
(*oact).sa_handler = callback;
if SIG_HANDLER.is_some() {
(*oact).sa_handler = SIG_HANDLER;
}
}
let act = if act.is_null() {
None
} else {
SIG_HANDLER = Some((*act).sa_handler);
SIG_HANDLER = (*act).sa_handler;
let m = (*act).sa_mask;
Some(syscall::SigAction {
sa_handler: sig_handler,
@@ -926,7 +926,7 @@ pub unsafe fn sigaction(sig: c_int, act: *const sigaction, oact: *mut sigaction)
}
pub fn sigprocmask(how: c_int, set: *const sigset_t, oset: *mut sigset_t) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: sigprocmask({}, {:p}, {:p})",
how,
@@ -981,7 +981,7 @@ pub unsafe fn socket(domain: c_int, mut kind: c_int, protocol: c_int) -> c_int {
}
pub fn socketpair(domain: c_int, kind: c_int, protocol: c_int, socket_vector: *mut c_int) -> c_int {
let _ = write!(
let _ = writeln!(
FileWriter(2),
"unimplemented: socketpair({}, {}, {}, {:p})",
domain,
@@ -1029,10 +1029,15 @@ pub fn tcsetattr(fd: c_int, _act: c_int, value: *const termios) -> c_int {
}
pub fn times(out: *mut tms) -> clock_t {
let _ = write!(FileWriter(2), "unimplemented: times({:p})", out);
let _ = writeln!(FileWriter(2), "unimplemented: times({:p})", out);
!0
}
pub fn umask(mask: mode_t) -> mode_t {
let _ = writeln!(FileWriter(2), "unimplemented: umask({})", mask);
0
}
pub fn unlink(path: *const c_char) -> c_int {
let path = unsafe { c_str(path) };
e(syscall::unlink(path)) as c_int
+2 -2
View File
@@ -165,9 +165,9 @@ pub struct sockaddr_in {
#[repr(C)]
pub struct sigaction {
pub sa_handler: extern "C" fn(c_int),
pub sa_handler: Option<extern "C" fn(c_int)>,
pub sa_flags: c_ulong,
pub sa_restorer: unsafe extern "C" fn(),
pub sa_restorer: Option<unsafe extern "C" fn()>,
pub sa_mask: sigset_t,
}