diff --git a/unistd/.gitignore b/.gitignore similarity index 100% rename from unistd/.gitignore rename to .gitignore diff --git a/.gitmodules b/.gitmodules index ba57c697c821310368bba5c93e093558ff4cc139..271673cd4e4b2a0a9abe3f6ba6cc4627236d5c87 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "openlibm"] path = openlibm url = https://github.com/redox-os/openlibm.git +[submodule "cbindgen"] + path = cbindgen + url = https://github.com/redox-os/cbindgen.git diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..7c83df5ab557f3a0045ddc9ed0711c668f73adfe --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "relibc" +version = "0.1.0" +authors = ["Jeremy Soller <jackpot51@gmail.com>"] + +[lib] +name = "c" +crate-type = ["staticlib"] + +[workspace] + +[dependencies] +fcntl = { path = "fcntl" } +unistd = { path = "unistd" } + +[profile.dev] +incremental = false +lto = true +panic = "abort" + +[profile.release] +incremental = false +lto = true +panic = "abort" diff --git a/cbindgen b/cbindgen new file mode 160000 index 0000000000000000000000000000000000000000..97ceb5862f397b14c5b63cd60af7f5f345ad065c --- /dev/null +++ b/cbindgen @@ -0,0 +1 @@ +Subproject commit 97ceb5862f397b14c5b63cd60af7f5f345ad065c diff --git a/common/Cargo.toml b/common/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..3b6ffb52567397590c5db63686996dd2bf66e0de --- /dev/null +++ b/common/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "common" +version = "0.1.0" +authors = ["Jeremy Soller <jackpot51@gmail.com>"] diff --git a/common/src/lib.rs b/common/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..ecb19b8e28113be8ec7e187b4d53cad9368c9c19 --- /dev/null +++ b/common/src/lib.rs @@ -0,0 +1,60 @@ +//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html + +#![no_std] +#![allow(non_camel_case_types)] + +// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable +// more optimization opportunities around it recognizing things like +// malloc/free. +#[repr(u8)] +pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, +} + +pub type int8_t = i8; +pub type int16_t = i16; +pub type int32_t = i32; +pub type int64_t = i64; +pub type uint8_t = u8; +pub type uint16_t = u16; +pub type uint32_t = u32; +pub type uint64_t = u64; + +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; + +pub type size_t = usize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; +pub type uintptr_t = usize; +pub type ssize_t = isize; + +pub type c_char = i8; +pub type c_long = i64; +pub type c_ulong = u64; + +pub type wchar_t = i16; + +pub type off_t = c_long; +pub type mode_t = u16; +pub type time_t = i64; +pub type pid_t = usize; +pub type gid_t = usize; +pub type uid_t = usize; + +pub type useconds_t = i32; +pub type suseconds_t = i64; diff --git a/fcntl/Cargo.toml b/fcntl/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..3527c6e779b404925e866295643a08dda6461a7c --- /dev/null +++ b/fcntl/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "fcntl" +version = "0.1.0" +authors = ["Jeremy Soller <jackpot51@gmail.com>"] +build = "build.rs" + +[build-dependencies] +cbindgen = { path = "../cbindgen" } + +[dependencies] +common = { path = "../common" } diff --git a/fcntl/build.rs b/fcntl/build.rs new file mode 100644 index 0000000000000000000000000000000000000000..b04c12cdaf51c793d6d4c86b9e066cbc4b5cf7b0 --- /dev/null +++ b/fcntl/build.rs @@ -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/fcntl.h"); +} diff --git a/fcntl/cbindgen.toml b/fcntl/cbindgen.toml new file mode 100644 index 0000000000000000000000000000000000000000..948863cda4d8bdbe514ab129406efeea2361fe6d --- /dev/null +++ b/fcntl/cbindgen.toml @@ -0,0 +1,6 @@ +sys_includes = ["sys/types.h"] +include_guard = "_FCNTL_H" +language = "C" + +[enum] +prefix_with_name = true diff --git a/fcntl/src/lib.rs b/fcntl/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..b68a5929bb61d4ddd1da0b096dac620ee761adc4 --- /dev/null +++ b/fcntl/src/lib.rs @@ -0,0 +1,63 @@ +//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html + +#![no_std] + +extern crate common; + +pub use common::*; + +pub const F_DUPFD: c_int = 0; +pub const F_GETFD: c_int = 1; +pub const F_SETFD: c_int = 2; +pub const F_GETFL: c_int = 3; +pub const F_SETFL: c_int = 4; +pub const F_GETLK: c_int = 5; +pub const F_SETLK: c_int = 6; +pub const F_SETLKW: c_int = 7; + +pub const FD_CLOEXEC: c_int = 0x0100_0000; + +pub const F_RDLCK: c_int = 0; +pub const F_WRLCK: c_int = 1; +pub const F_UNLCK: c_int = 2; + +pub const O_RDONLY: c_int = 0x0001_0000; +pub const O_WRONLY: c_int = 0x0002_0000; +pub const O_RDWR: c_int = 0x0003_0000; +pub const O_NONBLOCK: c_int = 0x0004_0000; +pub const O_APPEND: c_int = 0x0008_0000; +pub const O_SHLOCK: c_int = 0x0010_0000; +pub const O_EXLOCK: c_int = 0x0020_0000; +pub const O_ASYNC: c_int = 0x0040_0000; +pub const O_FSYNC: c_int = 0x0080_0000; +pub const O_CLOEXEC: c_int = 0x0100_0000; +pub const O_CREAT: c_int = 0x0200_0000; +pub const O_TRUNC: c_int = 0x0400_0000; +pub const O_EXCL: c_int = 0x0800_0000; +pub const O_DIRECTORY: c_int = 0x1000_0000; +pub const O_STAT: c_int = 0x2000_0000; +pub const O_SYMLINK: c_int = 0x4000_0000; +pub const O_NOFOLLOW: c_int = 0x8000_0000; +pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR; + +#[no_mangle] +pub extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int { + open(path, O_WRONLY | O_CREAT | O_TRUNC, mode) +} + +#[no_mangle] +pub extern "C" fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int { + unimplemented!(); +} + +/* +#[no_mangle] +pub extern "C" fn func(args) -> c_int { + unimplemented!(); +} +*/ diff --git a/include/stdbool.h b/include/stdbool.h new file mode 100644 index 0000000000000000000000000000000000000000..1a9f870bb916372337084702da06bfed1cd9267e --- /dev/null +++ b/include/stdbool.h @@ -0,0 +1,9 @@ +#ifndef _STDBOOL_H +#define _STDBOOL_H + +typedef _Bool bool; +#define true 1 +#define false 0 +#define __bool_true_false_are_defined 1 + +#endif /* _STDBOOL_H */ diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 0000000000000000000000000000000000000000..ade0ab4fed39b790af58885a4fef13095682ef03 --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,52 @@ +#ifndef _STDINT_H +#define _STDINT_H + +#define INT8_MIN -0x80 +#define INT8_MAX 0x7F +typedef signed char int8_t; + +#define UINT8_MIN 0x00 +#define UINT8_MAX 0xFF +typedef unsigned char uint8_t; + +#define INT16_MIN -0x8000 +#define INT16_MAX 0x7FFF +typedef signed short int16_t; + +#define UINT16_MIN 0x0000 +#define UINT16_MAX 0xFFFF +typedef unsigned short uint16_t; + +#define INT32_MIN -0x80000000 +#define INT32_MAX 0x7FFFFFFF +typedef signed long int32_t; + +#define UINT32_MIN 0x00000000 +#define UINT32_MAX 0xFFFFFFFF +typedef unsigned long uint32_t; + +#define INT64_MIN -0x8000000000000000 +#define INT64_MAX 0x7FFFFFFFFFFFFFFF +typedef signed long long int64_t; + +#define UINT64_MIN 0x0000000000000000 +#define UINT64_MAX 0xFFFFFFFFFFFFFFFF +typedef unsigned long long uint64_t; + +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +typedef int64_t intptr_t; + +#define UINTPTR_MIN UINT64_MIN +#define UINTPTR_MAX UINT64_MAX +typedef uint64_t uintptr_t; + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +typedef int64_t intmax_t; + +#define UINTMAX_MIN UINT64_MIN +#define UINTMAX_MAX UINT64_MAX +typedef uint64_t uintmax_t; + +#endif /* _STDINT_H */ diff --git a/include/sys/types.h b/include/sys/types.h new file mode 100644 index 0000000000000000000000000000000000000000..416f51149b97d6646bb11f5ef507dfd46ffb6a30 --- /dev/null +++ b/include/sys/types.h @@ -0,0 +1,16 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +typedef int gid_t; +typedef int uid_t; + +typedef long off_t; + +typedef int pid_t; + +typedef unsigned long size_t; +typedef long ssize_t; + +typedef int useconds_t; + +#endif /* _SYS_TYPES_H */ diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..4c84deb54906e604414626a022cfbab623a10f23 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,14 @@ +#![no_std] +#![feature(lang_items)] + +extern crate fcntl; +extern crate unistd; + +pub use fcntl::*; +pub use unistd::*; + +#[lang = "panic_fmt"] +#[no_mangle] +pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! { + loop {} +} diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7cd82ddb60121c7156bc78719a5ea4d4facfeaab --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +/write diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..84981286b1357861e2f8f591651e338d2247ab9b --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,5 @@ +write: write.c + gcc -nostdinc -nostdlib -I ../include -I ../target/include $< ../target/debug/libc.a -o $@ + +clean: + rm -f write diff --git a/tests/write.c b/tests/write.c new file mode 100644 index 0000000000000000000000000000000000000000..0349a5c09408edb5574056d3d0181af69745f8bf --- /dev/null +++ b/tests/write.c @@ -0,0 +1,5 @@ +#include <unistd.h> + +void _start(void) { + write(STDOUT_FILENO, "Hello World!\n", 14); +} diff --git a/unistd/Cargo.toml b/unistd/Cargo.toml index 1d4f993953e5f35bc00febdd9f30de711d8edc8f..0a7878fe71109492006ecc8281c92d19e13a2830 100644 --- a/unistd/Cargo.toml +++ b/unistd/Cargo.toml @@ -2,13 +2,10 @@ name = "unistd" version = "0.1.0" authors = ["Jeremy Soller <jackpot51@gmail.com>"] - -[lib] -name = "unistd" -crate-type = ["cdylib"] +build = "build.rs" [build-dependencies] -cbindgen = "0.5" +cbindgen = { path = "../cbindgen" } [dependencies] -libc = "0.2" +common = { path = "../common" } diff --git a/unistd/build.rs b/unistd/build.rs index 8ae3813ef8df43f1acdf5c344254779124cc3926..c12853664c1430d199987b9cf572884ac95105cd 100644 --- a/unistd/build.rs +++ b/unistd/build.rs @@ -1,11 +1,11 @@ extern crate cbindgen; -use std::env; +use std::{env, fs}; fn main() { - let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - + 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("Unable to generate bindings") - .write_to_file("target/unistd.h"); + .expect("failed to generate bindings") + .write_to_file("../target/include/unistd.h"); } diff --git a/unistd/cbindgen.toml b/unistd/cbindgen.toml index 32fdb822571cfbc45ef868ab35cf455839b9495f..259e4fadf236a580c35a4e995ae39e362322c873 100644 --- a/unistd/cbindgen.toml +++ b/unistd/cbindgen.toml @@ -1,3 +1,4 @@ +sys_includes = ["stdint.h", "sys/types.h"] include_guard = "_UNISTD_H" language = "C" diff --git a/unistd/src/lib.rs b/unistd/src/lib.rs index ef4c8afd3ada049b3c63e310a0b05f55a0fbcabc..642965125b74d38b5812f9db2dc55fef5a3a7d9a 100644 --- a/unistd/src/lib.rs +++ b/unistd/src/lib.rs @@ -1,139 +1,148 @@ +//! unistd implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html + +#![no_std] + +extern crate common; + +pub use common::*; + +pub const NULL: c_int = 0; + +pub const R_OK: c_int = 1; +pub const W_OK: c_int = 2; +pub const X_OK: c_int = 4; +pub const F_OK: c_int = 8; + +pub const SEEK_SET: c_int = 0; +pub const SEEK_CUR: c_int = 1; +pub const SEEK_END: c_int = 2; + +pub const F_ULOCK: c_int = 0; +pub const F_LOCK: c_int = 1; +pub const F_TLOCK: c_int = 2; +pub const F_TEST: c_int = 3; + +pub const STDIN_FILENO: c_int = 0; +pub const STDOUT_FILENO: c_int = 1; +pub const STDERR_FILENO: c_int = 2; + +#[no_mangle] +pub extern "C" fn _exit(status: c_int) { + unimplemented!(); +} + #[no_mangle] -pub extern "C" fn alarm(arg1: libc::c_uint) -> libc::c_uint { +pub extern "C" fn access(path: *const c_char, amode: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn brk(arg1: *mut libc::c_void) -> libc::c_int { +pub extern "C" fn alarm(seconds: c_uint) -> c_uint { unimplemented!(); } #[no_mangle] -pub extern "C" fn chdir(arg1: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn brk(addr: *mut c_void) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn chroot(arg1: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn chdir(path: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn chown(arg1: *const libc::c_char, arg2: uid_t, - arg3: gid_t) -> libc::c_int { +pub extern "C" fn chroot(path: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn close(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn chown(path: *const c_char, owner: uid_t, group: gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn confstr(arg1: libc::c_int, - arg2: *mut libc::c_char, arg3: usize) -> usize { +pub extern "C" fn close(fildes: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn crypt(arg1: *const libc::c_char, - arg2: *const libc::c_char) - -> *mut libc::c_char { +pub extern "C" fn confstr(name: c_int, buf: *mut c_char, len: size_t) -> size_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn ctermid(arg1: *mut libc::c_char) - -> *mut libc::c_char { +pub extern "C" fn crypt(key: *const c_char, salt: *const c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn cuserid(s: *mut libc::c_char) - -> *mut libc::c_char { +pub extern "C" fn ctermid(s: *mut c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn dup(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn cuserid(s: *mut c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn dup2(arg1: libc::c_int, arg2: libc::c_int) - -> libc::c_int { +pub extern "C" fn dup(fildes: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn encrypt(arg1: *mut libc::c_char, - arg2: libc::c_int) { +pub extern "C" fn dup2(fildes: c_int, fildes2: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn execl(arg1: *const libc::c_char, - arg2: *const libc::c_char, ...) - -> libc::c_int { +pub extern "C" fn encrypt(block: [c_char; 64], edflag: c_int) { unimplemented!(); } #[no_mangle] -pub extern "C" fn execle(arg1: *const libc::c_char, - arg2: *const libc::c_char, ...) - -> libc::c_int { +pub extern "C" fn execl(path: *const c_char, arg0: *const c_char /* TODO: , mut args: ... */) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn execlp(arg1: *const libc::c_char, - arg2: *const libc::c_char, ...) - -> libc::c_int { +pub extern "C" fn execle(path: *const c_char, arg0: *const c_char /* TODO: , mut args: ... */) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn execv(arg1: *const libc::c_char, - arg2: *const *const libc::c_char) - -> libc::c_int { +pub extern "C" fn execlp(file: *const c_char, arg0: *const c_char /* TODO: , mut args: ... */) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn execve(arg1: *const libc::c_char, - arg2: *const *const libc::c_char, - arg3: *const *const libc::c_char) - -> libc::c_int { +pub extern "C" fn execv(path: *const c_char, argv: *const *mut c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn execvp(arg1: *const libc::c_char, - arg2: *const *const libc::c_char) - -> libc::c_int { +pub extern "C" fn execve(path: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn _exit(arg1: libc::c_int) { +pub extern "C" fn execvp(file: *const c_char, argv: *const *mut c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn fchown(arg1: libc::c_int, arg2: uid_t, arg3: gid_t) - -> libc::c_int { +pub extern "C" fn fchown(fildes: c_int, owner: uid_t, group: gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn fchdir(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn fchdir(fildes: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn fdatasync(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn fdatasync(fildes: c_int) -> c_int { unimplemented!(); } @@ -143,30 +152,27 @@ pub extern "C" fn fork() -> pid_t { } #[no_mangle] -pub extern "C" fn fpathconf(arg1: libc::c_int, arg2: libc::c_int) - -> libc::c_long { +pub extern "C" fn fpathconf(fildes: c_int, name: c_int) -> c_long { unimplemented!(); } #[no_mangle] -pub extern "C" fn fsync(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn fsync(fildes: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn ftruncate(arg1: libc::c_int, arg2: off_t) - -> libc::c_int { +pub extern "C" fn ftruncate(fildes: c_int, length: off_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn getcwd(arg1: *mut libc::c_char, arg2: usize) - -> *mut libc::c_char { +pub extern "C" fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn getdtablesize() -> libc::c_int { +pub extern "C" fn getdtablesize() -> c_int { unimplemented!(); } @@ -186,48 +192,42 @@ pub extern "C" fn getgid() -> gid_t { } #[no_mangle] -pub extern "C" fn getgroups(arg1: libc::c_int, arg2: *mut gid_t) - -> libc::c_int { +pub extern "C" fn getgroups(gidsetsize: c_int, grouplist: *mut gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn gethostid() -> libc::c_long { +pub extern "C" fn gethostid() -> c_long { unimplemented!(); } #[no_mangle] -pub extern "C" fn getlogin() -> *mut libc::c_char { +pub extern "C" fn getlogin() -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn getlogin_r(arg1: *mut libc::c_char, arg2: usize) - -> libc::c_int { +pub extern "C" fn getlogin_r(name: *mut c_char, namesize: size_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn getopt(arg1: libc::c_int, - arg2: *const *const libc::c_char, - arg3: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn getopt(argc: c_int, argv: *const *mut c_char, opstring: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn getpagesize() -> libc::c_int { +pub extern "C" fn getpagesize() -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn getpass(arg1: *const libc::c_char) - -> *mut libc::c_char { +pub extern "C" fn getpass(prompt: *const c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn getpgid(arg1: pid_t) -> pid_t { +pub extern "C" fn getpgid(pid: pid_t) -> pid_t { unimplemented!(); } @@ -247,7 +247,7 @@ pub extern "C" fn getppid() -> pid_t { } #[no_mangle] -pub extern "C" fn getsid(arg1: pid_t) -> pid_t { +pub extern "C" fn getsid(pid: pid_t) -> pid_t { unimplemented!(); } @@ -257,114 +257,97 @@ pub extern "C" fn getuid() -> uid_t { } #[no_mangle] -pub extern "C" fn getwd(arg1: *mut libc::c_char) - -> *mut libc::c_char { +pub extern "C" fn getwd(path_name: *mut c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn isatty(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn isatty(fildes: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn lchown(arg1: *const libc::c_char, arg2: uid_t, - arg3: gid_t) -> libc::c_int { +pub extern "C" fn lchown(path: *const c_char, owner: uid_t, group: gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn link(arg1: *const libc::c_char, - arg2: *const libc::c_char) -> libc::c_int { +pub extern "C" fn link(path1: *const c_char, path2: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn lockf(arg1: libc::c_int, arg2: libc::c_int, - arg3: off_t) -> libc::c_int { +pub extern "C" fn lockf(fildes: c_int, function: c_int, size: off_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn lseek(arg1: libc::c_int, arg2: off_t, - arg3: libc::c_int) -> off_t { +pub extern "C" fn lseek(fildes: c_int, offset: off_t, whence: c_int) -> off_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn nice(arg1: libc::c_int) -> libc::c_int { +pub extern "C" fn nice(incr: c_int) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn pathconf(arg1: *const libc::c_char, - arg2: libc::c_int) -> libc::c_long { +pub extern "C" fn pathconf(path: *const c_char, name: c_int) -> c_long { unimplemented!(); } #[no_mangle] -pub extern "C" fn pause() -> libc::c_int { +pub extern "C" fn pause() -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn pipe(arg1: *mut libc::c_int) -> libc::c_int { +pub extern "C" fn pipe(fildes: [c_int; 2]) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn pread(arg1: libc::c_int, - arg2: *mut libc::c_void, arg3: usize, arg4: off_t) - -> isize { +pub extern "C" fn pread(fildes: c_int, buf: *mut c_void, nbyte: size_t, offset: off_t) -> ssize_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn pthread_atfork(arg1: ::std::option::Option<unsafe extern "C" fn()>, - arg2: ::std::option::Option<unsafe extern "C" fn()>, - arg3: ::std::option::Option<unsafe extern "C" fn()>) - -> libc::c_int { +pub extern "C" fn pthread_atfork(prepare: extern "C" fn(), parent: extern "C" fn(), child: extern "C" fn()) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn pwrite(arg1: libc::c_int, - arg2: *const libc::c_void, arg3: usize, - arg4: off_t) -> isize { +pub extern "C" fn pwrite(fildes: c_int, buf: *const c_void, nbyte: size_t, offset: off_t) -> ssize_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn read(arg1: libc::c_int, - arg2: *mut libc::c_void, arg3: usize) -> isize { +pub extern "C" fn read(fildes: c_int, buf: *const c_void, nbyte: size_t) -> ssize_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn readlink(arg1: *const libc::c_char, - arg2: *mut libc::c_char, arg3: usize) - -> libc::c_int { +pub extern "C" fn readlink(path: *const c_char, buf: *mut c_char, bufsize: size_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn rmdir(arg1: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn rmdir(path: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn sbrk(arg1: isize) -> *mut libc::c_void { +pub extern "C" fn sbrk(incr: intptr_t) -> *mut c_void { unimplemented!(); } #[no_mangle] -pub extern "C" fn setgid(arg1: gid_t) -> libc::c_int { +pub extern "C" fn setgid(gid: gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn setpgid(arg1: pid_t, arg2: pid_t) -> libc::c_int { +pub extern "C" fn setpgid(pid: pid_t, pgid: pid_t) -> c_int { unimplemented!(); } @@ -374,12 +357,12 @@ pub extern "C" fn setpgrp() -> pid_t { } #[no_mangle] -pub extern "C" fn setregid(arg1: gid_t, arg2: gid_t) -> libc::c_int { +pub extern "C" fn setregid(rgid: gid_t, egid: gid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn setreuid(arg1: uid_t, arg2: uid_t) -> libc::c_int { +pub extern "C" fn setreuid(ruid: uid_t, euid: uid_t) -> c_int { unimplemented!(); } @@ -389,25 +372,22 @@ pub extern "C" fn setsid() -> pid_t { } #[no_mangle] -pub extern "C" fn setuid(arg1: uid_t) -> libc::c_int { +pub extern "C" fn setuid(uid: uid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn sleep(arg1: libc::c_uint) -> libc::c_uint { +pub extern "C" fn sleep(seconds: c_uint) -> c_uint { unimplemented!(); } #[no_mangle] -pub extern "C" fn swab(arg1: *const libc::c_void, - arg2: *mut libc::c_void, arg3: isize) { +pub extern "C" fn swab(src: *const c_void, dest: *mut c_void, nbytes: ssize_t) { unimplemented!(); } #[no_mangle] -pub extern "C" fn symlink(arg1: *const libc::c_char, - arg2: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn symlink(path1: *const c_char, path2: *const c_char) -> c_int { unimplemented!(); } @@ -417,64 +397,63 @@ pub extern "C" fn sync() { } #[no_mangle] -pub extern "C" fn sysconf(arg1: libc::c_int) -> libc::c_long { +pub extern "C" fn sysconf(name: c_int) -> c_long { unimplemented!(); } #[no_mangle] -pub extern "C" fn tcgetpgrp(arg1: libc::c_int) -> pid_t { +pub extern "C" fn tcgetpgrp() -> pid_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn tcsetpgrp(arg1: libc::c_int, arg2: pid_t) - -> libc::c_int { +pub extern "C" fn tcsetpgrp(fildes: c_int, pgid_id: pid_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn truncate(arg1: *const libc::c_char, arg2: off_t) - -> libc::c_int { +pub extern "C" fn truncate(path: *const c_char, length: off_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn ttyname(arg1: libc::c_int) - -> *mut libc::c_char { +pub extern "C" fn ttyname(fildes: c_int) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn ttyname_r(arg1: libc::c_int, - arg2: *mut libc::c_char, arg3: usize) - -> libc::c_int { +pub extern "C" fn ttyname_r(fildes: c_int, name: *mut c_char, namesize: size_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn ualarm(arg1: useconds_t, arg2: useconds_t) -> useconds_t { +pub extern "C" fn ualarm(useconds: useconds_t, interval: useconds_t) -> useconds_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn unlink(arg1: *const libc::c_char) - -> libc::c_int { +pub extern "C" fn unlink(path: *const c_char) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn usleep(arg1: useconds_t) -> libc::c_int { +pub extern "C" fn usleep(useconds: useconds_t) -> c_int { unimplemented!(); } #[no_mangle] -pub extern "C" fn vfork() -> libc::c_int { +pub extern "C" fn vfork() -> pid_t { unimplemented!(); } #[no_mangle] -pub extern "C" fn write(arg1: libc::c_int, - arg2: *const libc::c_void, arg3: usize) -> isize { +pub extern "C" fn write(fildes: c_int, buf: *const c_void, nbyte: size_t) -> ssize_t { unimplemented!(); } +/* +#[no_mangle] +pub extern "C" fn func(args) -> c_int { + unimplemented!(); +} +*/