Skip to content
Snippets Groups Projects
Verified Commit c6f16547 authored by Dan Robertson's avatar Dan Robertson Committed by Dan Robertson
Browse files

resource: Add crate for sys/resource.h

Add the basics of sys/resource.h so that work can begin on sys/wait.h
parent 2f718d40
No related branches found
No related tags found
No related merge requests found
......@@ -257,6 +257,7 @@ dependencies = [
"grp 0.1.0",
"mman 0.1.0",
"platform 0.1.0",
"resource 0.1.0",
"semaphore 0.1.0",
"stat 0.1.0",
"stdio 0.1.0",
......@@ -277,6 +278,15 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "resource"
version = "0.1.0"
dependencies = [
"cbindgen 0.5.0",
"platform 0.1.0",
"sys_time 0.1.0",
]
[[package]]
name = "rustc-ap-proc_macro"
version = "40.0.0"
......
......@@ -12,13 +12,14 @@ members = ["src/crt0"]
[dependencies]
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins.git", default-features = false, features = ["mem"] }
platform = { path = "src/platform" }
ctype = { path = "src/ctype" }
errno = { path = "src/errno" }
fcntl = { path = "src/fcntl" }
grp = { path = "src/grp" }
semaphore = { path = "src/semaphore" }
mman = { path = "src/mman" }
platform = { path = "src/platform" }
resource = { path = "src/resource" }
stat = { path = "src/stat" }
stdio = { path = "src/stdio" }
stdlib = { path = "src/stdlib" }
......
[package]
name = "resource"
version = "0.1.0"
authors = ["Dan Robertson <danlrobertson89@gmail.com>"]
[build-dependencies]
cbindgen = { path = "../../cbindgen" }
[dependencies]
platform = { path = "../platform" }
sys_time = { path = "../sys_time" }
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/resource.h");
}
sys_includes = ["sys/types.h"]
include_guard = "_SYS_RESOURCE_H"
language = "C"
[enum]
prefix_with_name = true
//! sys/resource.h implementation for Redox, following
//! http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html
#![no_std]
extern crate platform;
extern crate sys_time;
use platform::types::*;
use sys_time::timeval;
type rlim_t = u64;
#[repr(C)]
pub struct rlimit {
pub rlim_cur: rlim_t,
pub rlim_max: rlim_t,
}
#[repr(C)]
pub struct rusage {
pub ru_utime: timeval,
pub ru_stime: timeval,
}
#[no_mangle]
pub unsafe extern "C" fn getpriority(which: c_int, who: id_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
unimplemented!();
}
#[no_mangle]
pub unsafe extern "C" fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
unimplemented!();
}
#[no_mangle]
pub unsafe extern "C" fn setpriority(which: c_int, who: id_t, nice: c_int) -> c_int {
unimplemented!();
}
#[no_mangle]
pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
unimplemented!();
}
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