Browse Source

添加mknod系统调用以及导出libc (#30)

* - 添加mknod系统调用
- 添加libc模块导出dlibc,使得使用drstd的程序也能使用libc的内容进行更底层的编程
GnoCiYeH 1 year ago
parent
commit
8b1e314e01
4 changed files with 5 additions and 3 deletions
  1. 2 2
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal.rs
  2. 1 1
      src/start.rs
  3. 1 0
      src/std/libc.rs
  4. 1 0
      src/std/mod.rs

+ 2 - 2
dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal.rs

@@ -254,8 +254,8 @@ pub extern "C" fn mkdir(path: *const ::c_char, mode: mode_t) -> ::c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn mkfifo(_path: *const ::c_char, _mode: mode_t) -> ::c_int {
-    unimplemented!()
+pub extern "C" fn mkfifo(path: *const ::c_char, mode: mode_t) -> ::c_int {
+    e(unsafe { syscall!(SYS_MKNOD, path, mode | 4096, 0) }) as ::c_int
 }
 
 #[no_mangle]

+ 1 - 1
src/start.rs

@@ -1,5 +1,5 @@
 use alloc::{boxed::Box, vec::Vec};
-use core::{fmt::Debug, intrinsics, ptr};
+use core::{intrinsics, ptr};
 use dlibc::unix::platform::allocator::new_mspace;
 use dlibc::{
     ld_so::start::Stack,

+ 1 - 0
src/std/libc.rs

@@ -0,0 +1 @@
+pub use ::dlibc::*;

+ 1 - 0
src/std/mod.rs

@@ -105,6 +105,7 @@ pub mod error;
 pub mod ffi;
 pub mod fs;
 pub mod io;
+pub mod libc;
 pub mod net;
 pub mod num;
 pub mod os;