@@ -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" }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[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" }
|
||||
@@ -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/semaphore.h");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
sys_includes = []
|
||||
include_guard = "_SEMAPHORE_H"
|
||||
language = "C"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1,67 @@
|
||||
#![no_std]
|
||||
|
||||
extern crate platform;
|
||||
|
||||
use platform::types::*;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy)]
|
||||
pub union sem_t {
|
||||
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: c_int,
|
||||
value: c_uint) -> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_destroy(sem: *mut sem_t) -> 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_close(sem: *mut sem_t) -> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_unlink(name: *const c_char)
|
||||
-> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
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) -> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
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 c_int)
|
||||
-> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#[repr(C)]
|
||||
#[derive(Copy)]
|
||||
pub union sem_t {
|
||||
pub size: [libc::c_char; 32usize],
|
||||
pub align: libc::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 {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_open(name: *const libc::c_char,
|
||||
oflag: libc::c_int, ...) -> *mut sem_t {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_close(sem: *mut sem_t) -> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_unlink(name: *const libc::c_char)
|
||||
-> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_wait(sem: *mut sem_t) -> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec)
|
||||
-> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_trywait(sem: *mut sem_t) -> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_post(sem: *mut sem_t) -> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sem_getvalue(sem: *mut sem_t, sval: *mut libc::c_int)
|
||||
-> libc::c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user