Enable libc's printf
This commit is contained in:
parent
10e3da87cc
commit
4107a65248
@ -185,8 +185,6 @@ impl SgxFileInner {
|
||||
for buf in bufs {
|
||||
match file.write(buf) {
|
||||
Ok(this_bytes) => {
|
||||
if this_bytes == 0 { break; }
|
||||
|
||||
total_bytes += this_bytes;
|
||||
if this_bytes < buf.len() { break; }
|
||||
}
|
||||
@ -221,8 +219,6 @@ impl SgxFileInner {
|
||||
for buf in bufs {
|
||||
match file.read(buf) {
|
||||
Ok(this_bytes) => {
|
||||
if this_bytes == 0 { break; }
|
||||
|
||||
total_bytes += this_bytes;
|
||||
if this_bytes < buf.len() { break; }
|
||||
}
|
||||
@ -282,7 +278,6 @@ impl File for StdoutFile {
|
||||
for buf in bufs {
|
||||
match guard.write(buf) {
|
||||
Ok(this_len) => {
|
||||
if this_len == 0 { break; }
|
||||
total_bytes += this_len;
|
||||
if this_len < buf.len() { break; }
|
||||
}
|
||||
@ -352,7 +347,6 @@ impl File for StdinFile {
|
||||
for buf in bufs {
|
||||
match guard.read(buf) {
|
||||
Ok(this_len) => {
|
||||
if this_len == 0 { break; }
|
||||
total_bytes += this_len;
|
||||
if this_len < buf.len() { break; }
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ use std::panic;
|
||||
use sgx_types::*;
|
||||
use sgx_trts::libc;
|
||||
|
||||
#[macro_use]
|
||||
mod prelude;
|
||||
mod elf_helper;
|
||||
mod errno;
|
||||
|
@ -21,3 +21,9 @@ pub use errno::Error as Error;
|
||||
pub use errno::Errno;
|
||||
|
||||
pub use fs::off_t;
|
||||
|
||||
macro_rules! debug_trace {
|
||||
() => {
|
||||
println!("> Line = {}, File = {}", line!(), file!())
|
||||
};
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ fn do_writev(fd: c_int, iov: *const iovec_t, count: c_int)
|
||||
let buf = unsafe {
|
||||
std::slice::from_raw_parts(iov.base as * const u8, iov.len)
|
||||
};
|
||||
bufs_vec[iov_i] = buf;
|
||||
bufs_vec.push(buf);
|
||||
}
|
||||
bufs_vec
|
||||
};
|
||||
@ -122,7 +122,7 @@ fn do_readv(fd: c_int, iov: *mut iovec_t, count: c_int)
|
||||
let buf = unsafe {
|
||||
std::slice::from_raw_parts_mut(iov.base as * mut u8, iov.len)
|
||||
};
|
||||
bufs_vec[iov_i] = buf;
|
||||
bufs_vec.push(buf);
|
||||
}
|
||||
bufs_vec
|
||||
};
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static const char* msg = "Hello World\n";
|
||||
|
||||
int main(void) {
|
||||
write(1, msg, strlen(msg) + 1);
|
||||
printf("%s", msg);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user