Skip to content
Snippets Groups Projects
Commit aa4f7ed3 authored by Paul Sajna's avatar Paul Sajna
Browse files

Merge branch 'platform' into unistd

parents e08ffa64 6b89b462
No related branches found
No related tags found
1 merge request!14implement some unistd
......@@ -16,6 +16,7 @@ platform = { path = "platform" }
ctype = { path = "src/ctype" }
fcntl = { path = "src/fcntl" }
grp = { path = "src/grp" }
semaphore = { path = "src/semaphore" }
mman = { path = "src/mman" }
stdio = { path = "src/stdio" }
stdlib = { path = "src/stdlib" }
......
use core::ops::Deref;
pub struct RawFile(usize);
impl RawFile {
pub fn open<T: AsRef<[u8]>>(path: T, flags: usize) -> Result<RawFile> {
open(path, flags).map(RawFile)
}
pub fn dup(&self, buf: &[u8]) -> Result<RawFile> {
dup(self.0, buf).map(RawFile)
}
}
impl Drop for RawFile {
fn drop(&mut self) {
let _ = close(self.0);
}
}
impl Deref for RawFile {
type Target = usize;
fn deref(&self) -> &usize {
&self.0
}
}
[package]
name = "semaphore"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
build = "build.rs"
[build-dependencies]
cbindgen = { path = "../../cbindgen" }
[dependencies]
platform = { path = "../../platform" }
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/semaphore.h");
}
sys_includes = []
include_guard = "_SEMAPHORE_H"
language = "C"
[enum]
prefix_with_name = true
#![no_std]
extern crate platform;
use platform::types::*;
#[repr(C)]
#[derive(Copy)]
pub union sem_t {
pub size: [libc::c_char; 32usize],
pub align: libc::c_long,
pub size: [c_char; 32usize],
pub align: c_long,
_bindgen_union_align: [u64; 4usize],
}
impl Clone for sem_t {
fn clone(&self) -> Self { *self }
}
#[no_mangle]
pub extern "C" fn sem_init(sem: *mut sem_t, pshared: libc::c_int,
value: libc::c_uint) -> libc::c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_destroy(sem: *mut sem_t) -> libc::c_int {
pub extern "C" fn sem_init(sem: *mut sem_t, pshared: c_int,
value: c_uint) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_open(name: *const libc::c_char,
oflag: libc::c_int, ...) -> *mut sem_t {
pub extern "C" fn sem_destroy(sem: *mut sem_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_close(sem: *mut sem_t) -> libc::c_int {
unimplemented!();
}
/*
*#[no_mangle]
*pub extern "C" fn sem_open(name: *const c_char,
* oflag: c_int, ...) -> *mut sem_t {
* unimplemented!();
*}
*/
#[no_mangle]
pub extern "C" fn sem_unlink(name: *const libc::c_char)
-> libc::c_int {
pub extern "C" fn sem_close(sem: *mut sem_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_wait(sem: *mut sem_t) -> libc::c_int {
pub extern "C" fn sem_unlink(name: *const c_char)
-> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec)
-> libc::c_int {
pub extern "C" fn sem_wait(sem: *mut sem_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_trywait(sem: *mut sem_t) -> libc::c_int {
pub extern "C" fn sem_trywait(sem: *mut sem_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_post(sem: *mut sem_t) -> libc::c_int {
pub extern "C" fn sem_post(sem: *mut sem_t) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn sem_getvalue(sem: *mut sem_t, sval: *mut libc::c_int)
-> libc::c_int {
pub extern "C" fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int)
-> 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