merge
This commit is contained in:
@@ -7,3 +7,6 @@
|
||||
[submodule "ralloc"]
|
||||
path = ralloc
|
||||
url = https://github.com/redox-os/ralloc.git
|
||||
[submodule "va_list"]
|
||||
path = va_list
|
||||
url = https://github.com/redox-os/va_list-rs.git
|
||||
|
||||
Generated
+28
-3
@@ -97,6 +97,11 @@ name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "grp"
|
||||
version = "0.1.0"
|
||||
@@ -140,6 +145,14 @@ dependencies = [
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mman"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cbindgen 0.5.0",
|
||||
"platform 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.1"
|
||||
@@ -177,6 +190,7 @@ dependencies = [
|
||||
name = "platform"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -197,6 +211,7 @@ dependencies = [
|
||||
name = "ralloc_shim"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -231,6 +246,7 @@ dependencies = [
|
||||
"ctype 0.1.0",
|
||||
"fcntl 0.1.0",
|
||||
"grp 0.1.0",
|
||||
"mman 0.1.0",
|
||||
"platform 0.1.0",
|
||||
"stdio 0.1.0",
|
||||
"stdlib 0.1.0",
|
||||
@@ -411,7 +427,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"cbindgen 0.5.0",
|
||||
"platform 0.1.0",
|
||||
"va_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"va_list 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -529,7 +545,16 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "va_list"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"va_list-helper 0.0.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "va_list-helper"
|
||||
version = "0.0.2"
|
||||
dependencies = [
|
||||
"gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
@@ -575,6 +600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
|
||||
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)" = "56aebce561378d99a0bb578f8cb15b6114d2a1814a6c7949bbe646d968bb4fa9"
|
||||
@@ -618,7 +644,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum va_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7365862faee55ed0dbc112491aa5f0451ca01bf98afcc6463183b5aaa5bd3128"
|
||||
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
|
||||
|
||||
+4
-1
@@ -3,5 +3,8 @@ name = "platform"
|
||||
version = "0.1.0"
|
||||
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
sc = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "redox")'.dependencies]
|
||||
redox_syscall = "0.1"
|
||||
|
||||
+16
-1
@@ -20,7 +20,22 @@ pub mod types;
|
||||
|
||||
use core::fmt;
|
||||
|
||||
use types::c_int;
|
||||
use types::*;
|
||||
|
||||
pub unsafe fn c_str(s: *const c_char) -> &'static [u8] {
|
||||
use core::slice;
|
||||
|
||||
let mut size = 0;
|
||||
|
||||
loop {
|
||||
if *s.offset(size) == 0 {
|
||||
break;
|
||||
}
|
||||
size += 1;
|
||||
}
|
||||
|
||||
slice::from_raw_parts(s as *const u8, size as usize)
|
||||
}
|
||||
|
||||
pub struct FileWriter(pub c_int);
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use core::slice;
|
||||
use syscall;
|
||||
use c_str;
|
||||
use types::*;
|
||||
|
||||
pub unsafe fn cstr_to_slice<'a>(buf: *const c_char) -> &'a [u8] {
|
||||
slice::from_raw_parts(buf as *const u8, ::strlen(buf) as usize)
|
||||
@@ -8,22 +11,30 @@ pub fn chdir(path: *const c_char) -> c_int {
|
||||
syscall::chdir(cstr_to_slice(path))? as c_int
|
||||
}
|
||||
|
||||
pub fn close(fildes: c_int) -> c_int {
|
||||
syscall::close(fildes as usize)? as c_int
|
||||
pub fn close(fd: c_int) -> c_int {
|
||||
syscall::close(fd as usize);
|
||||
0
|
||||
}
|
||||
|
||||
pub fn dup(fildes: c_int) -> c_int {
|
||||
syscall::dup(file as usize, &[])? as c_int
|
||||
pub fn dup(fd: c_int) -> c_int {
|
||||
syscall::dup(fd as usize, &[])? as c_int
|
||||
}
|
||||
|
||||
pub fn dup2(fildes: c_int, fildes2) -> c_int {
|
||||
syscall::dup2(fildes as usize, fildes2 as usize, &[])? as c_int
|
||||
pub fn dup2(fd1: c_int, fd2) -> c_int {
|
||||
syscall::dup2(fd1 as usize, fd2 as usize, &[])? as c_int
|
||||
}
|
||||
|
||||
pub fn exit(status: c_int) -> ! {
|
||||
syscall::exit(status);
|
||||
syscall::exit(status as usize);
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
|
||||
let path = unsafe { c_str(path) };
|
||||
syscall::open(path, (oflag as usize) | (mode as usize)).unwrap() as c_int
|
||||
}
|
||||
|
||||
pub fn write(fd: c_int, buf: &[u8]) -> ssize_t {
|
||||
syscall::write(fd, buf);
|
||||
syscall::write(fd as usize, buf);
|
||||
buf.len() as ssize_t
|
||||
}
|
||||
|
||||
+1
-1
Submodule ralloc updated: b521bac287...31b781a287
@@ -7,6 +7,7 @@ extern crate platform;
|
||||
extern crate ctype;
|
||||
extern crate fcntl;
|
||||
extern crate grp;
|
||||
extern crate mman;
|
||||
extern crate stdio;
|
||||
extern crate stdlib;
|
||||
extern crate string;
|
||||
|
||||
@@ -9,4 +9,4 @@ cbindgen = { path = "../../cbindgen" }
|
||||
|
||||
[dependencies]
|
||||
platform = { path = "../../platform" }
|
||||
va_list = { version = "0.1", features = ["no_std"] }
|
||||
va_list = { path = "../../va_list", features = ["no_std"] }
|
||||
|
||||
@@ -116,8 +116,7 @@ pub unsafe extern "C" fn exit(status: c_int) {
|
||||
use core::mem;
|
||||
|
||||
for i in (0..ATEXIT_FUNCS.len()).rev() {
|
||||
if ATEXIT_FUNCS[i] != None {
|
||||
let func = mem::transmute::<usize, extern "C" fn()>(ATEXIT_FUNCS[i].unwrap());
|
||||
if let Some(func) = ATEXIT_FUNCS[i] {
|
||||
(func)();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-10
@@ -104,16 +104,7 @@ pub extern "C" fn strerror(errnum: c_int) -> *mut c_char {
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn strlen(s: *const c_char) -> size_t {
|
||||
let mut size = 0;
|
||||
|
||||
loop {
|
||||
if *s.offset(size) == 0 {
|
||||
break;
|
||||
}
|
||||
size += 1;
|
||||
}
|
||||
|
||||
size as size_t
|
||||
platform::c_str(s).len() as size_t
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
+14
-12
@@ -14,16 +14,18 @@ clean:
|
||||
run: $(BINS)
|
||||
for bin in $(BINS); do echo "\\033[1m$${bin}\\033[0m"; ./$${bin} test args; done
|
||||
|
||||
GCCHEAD=\
|
||||
-nostdinc \
|
||||
-nostdlib \
|
||||
-I ../include \
|
||||
-I ../target/include \
|
||||
-I ../openlibm/include \
|
||||
-I ../openlibm/src \
|
||||
../target/debug/libcrt0.a
|
||||
|
||||
GCCTAIL=\
|
||||
../target/debug/libc.a \
|
||||
../openlibm/libopenlibm.a
|
||||
|
||||
%: %.c
|
||||
gcc \
|
||||
-nostdinc \
|
||||
-nostdlib \
|
||||
-I ../include \
|
||||
-I ../target/include \
|
||||
-I ../openlibm/include \
|
||||
-I ../openlibm/src \
|
||||
../target/debug/libcrt0.a \
|
||||
$< \
|
||||
../target/debug/libc.a \
|
||||
../openlibm/libopenlibm.a \
|
||||
-o $@
|
||||
gcc -fno-stack-protector $(GCCHEAD) $< $(GCCTAIL) -o $@
|
||||
|
||||
Submodule
+1
Submodule va_list added at 4762a18450
Reference in New Issue
Block a user