build semaphore header

This commit is contained in:
Paul Sajna
2018-03-03 21:07:40 -08:00
parent eea3f0ede6
commit 6cf4b3bf82
5 changed files with 99 additions and 65 deletions
+11
View File
@@ -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" }
+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/semaphore.h");
}
+6
View File
@@ -0,0 +1,6 @@
sys_includes = []
include_guard = "_SEMAPHORE_H"
language = "C"
[enum]
prefix_with_name = true
+71
View File
@@ -0,0 +1,71 @@
#![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_timedwait(sem: *mut sem_t, abstime: *const timespec)
-> 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!();
}
-65
View File
@@ -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!();
}