Rename sys header crates, add mman constants

This commit is contained in:
Jeremy Soller
2018-03-27 20:25:42 -06:00
parent afdc80629f
commit ea804582b9
27 changed files with 122 additions and 186 deletions
+11
View File
@@ -0,0 +1,11 @@
[package]
name = "sys_wait"
version = "0.1.0"
authors = ["Dan Robertson <danlrobertson89@gmail.com>"]
[build-dependencies]
cbindgen = { path = "../../cbindgen" }
[dependencies]
platform = { path = "../platform" }
sys_resource = { path = "../sys_resource" }
+11
View File
@@ -0,0 +1,11 @@
extern crate cbindgen;
use std::{env, fs};
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
fs::create_dir_all("../../target/include").expect("failed to create include directory");
cbindgen::generate(crate_dir)
.expect("failed to generate bindings")
.write_to_file("../../target/include/sys/wait.h");
}
+7
View File
@@ -0,0 +1,7 @@
sys_includes = ["sys/types.h", "sys/resource.h"]
include_guard = "_SYS_WAIT_H"
style = "Tag"
language = "C"
[enum]
prefix_with_name = true
+43
View File
@@ -0,0 +1,43 @@
//! sys/wait.h implementation for Redox, following
//! http://pubs.opengroup.org/onlinepubs/7908799/xsh/syswait.h.html
#![no_std]
extern crate platform;
extern crate sys_resource;
use platform::types::*;
use sys_resource::rusage;
#[no_mangle]
pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t {
waitpid(!0, stat_loc, 0)
}
#[no_mangle]
pub unsafe extern "C" fn wait3(
stat_loc: *mut c_int,
options: c_int,
resource_usage: *mut rusage,
) -> pid_t {
unimplemented!();
}
/*
* TODO: implement idtype_t, id_t, and siginfo_t
*
* #[no_mangle]
* pub unsafe extern "C" fn waitid(
* idtype: idtype_t,
* id: id_t,
* infop: siginfo_t,
* options: c_int
* ) -> c_int {
* unimplemented!();
* }
*/
#[no_mangle]
pub unsafe extern "C" fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t {
platform::waitpid(pid, stat_loc, options)
}