Browse Source

Patch fix unix family (#12)

* 调整unix family下,dragonos的编译

* fix dlibc

* fix std
GnoCiYeH 8 months ago
parent
commit
69bbf99969
79 changed files with 376 additions and 737 deletions
  1. 3 3
      Cargo.toml
  2. 4 6
      dlibc/build.rs
  3. 1 1
      dlibc/src/lib.rs
  4. 1 1
      dlibc/src/unix/c_vec.rs
  5. 13 13
      dlibc/src/unix/header/_aio/mod.rs
  6. 10 10
      dlibc/src/unix/header/_fenv/mod.rs
  7. 5 5
      dlibc/src/unix/header/arch_aarch64_user/mod.rs
  8. 6 6
      dlibc/src/unix/header/arch_x64_user/mod.rs
  9. 1 1
      dlibc/src/unix/header/arpa_inet/mod.rs
  10. 1 1
      dlibc/src/unix/header/assert/mod.rs
  11. 1 1
      dlibc/src/unix/header/dirent/mod.rs
  12. 3 3
      dlibc/src/unix/header/dlfcn/mod.rs
  13. 27 27
      dlibc/src/unix/header/elf/mod.rs
  14. 2 2
      dlibc/src/unix/header/fcntl/mod.rs
  15. 12 12
      dlibc/src/unix/header/grp/mod.rs
  16. 3 3
      dlibc/src/unix/header/netdb/dns/mod.rs
  17. 0 1
      dlibc/src/unix/header/netdb/host.rs
  18. 2 4
      dlibc/src/unix/header/netdb/lookup.rs
  19. 4 4
      dlibc/src/unix/header/netdb/mod.rs
  20. 1 1
      dlibc/src/unix/header/poll/mod.rs
  21. 2 3
      dlibc/src/unix/header/pwd/mod.rs
  22. 8 8
      dlibc/src/unix/header/semaphore/mod.rs
  23. 4 4
      dlibc/src/unix/header/signal/mod.rs
  24. 1 1
      dlibc/src/unix/header/stdio/getdelim.rs
  25. 1 1
      dlibc/src/unix/header/stdio/helpers.rs
  26. 1 2
      dlibc/src/unix/header/stdio/mod.rs
  27. 3 3
      dlibc/src/unix/header/stdio/printf.rs
  28. 16 16
      dlibc/src/unix/header/stdlib/mod.rs
  29. 1 1
      dlibc/src/unix/header/string/mod.rs
  30. 1 1
      dlibc/src/unix/header/sys_epoll/mod.rs
  31. 1 1
      dlibc/src/unix/header/sys_file/mod.rs
  32. 1 1
      dlibc/src/unix/header/sys_mman/mod.rs
  33. 6 6
      dlibc/src/unix/header/sys_procfs/mod.rs
  34. 1 1
      dlibc/src/unix/header/sys_ptrace/mod.rs
  35. 2 2
      dlibc/src/unix/header/sys_random/mod.rs
  36. 1 1
      dlibc/src/unix/header/sys_resource/mod.rs
  37. 1 2
      dlibc/src/unix/header/sys_stat/mod.rs
  38. 0 1
      dlibc/src/unix/header/sys_statvfs/mod.rs
  39. 1 1
      dlibc/src/unix/header/sys_utsname/mod.rs
  40. 1 1
      dlibc/src/unix/header/sys_wait/mod.rs
  41. 1 1
      dlibc/src/unix/header/termios/mod.rs
  42. 13 13
      dlibc/src/unix/header/time/mod.rs
  43. 8 8
      dlibc/src/unix/header/unistd/mod.rs
  44. 27 27
      dlibc/src/unix/header/wchar/mod.rs
  45. 2 2
      dlibc/src/unix/header/wchar/utf8.rs
  46. 2 2
      dlibc/src/unix/ld_so/access.rs
  47. 2 2
      dlibc/src/unix/ld_so/dso.rs
  48. 2 3
      dlibc/src/unix/ld_so/linker.rs
  49. 3 3
      dlibc/src/unix/ld_so/mod.rs
  50. 2 2
      dlibc/src/unix/ld_so/start.rs
  51. 4 5
      dlibc/src/unix/ld_so/tcb.rs
  52. 6 8
      dlibc/src/unix/mod.rs
  53. 1 1
      dlibc/src/unix/platform/dragonos/mod.rs
  54. 25 239
      dlibc/src/unix/platform/dragonos/pal/mod.rs
  55. 41 41
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal.rs
  56. 10 10
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal_epoll.rs
  57. 6 6
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal_signal.rs
  58. 5 5
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal_socket.rs
  59. 4 4
      dlibc/src/unix/platform/dragonos/pal/relibc_adapter/pal_trace.rs
  60. 1 1
      dlibc/src/unix/platform/mod.rs
  61. 3 4
      dlibc/src/unix/start.rs
  62. 1 1
      dlibc/src/unix/sync/once.rs
  63. 3 0
      src/lib.rs
  64. 4 4
      src/std/backtrace.rs
  65. 2 2
      src/std/collections/hash/map.rs
  66. 0 1
      src/std/io/impls.rs
  67. 1 2
      src/std/os/fd/raw.rs
  68. 1 1
      src/std/os/linux/raw.rs
  69. 7 8
      src/std/os/mod.rs
  70. 1 1
      src/std/os/unix/process.rs
  71. 1 1
      src/std/panic.rs
  72. 11 12
      src/std/panicking.rs
  73. 3 1
      src/std/path.rs
  74. 1 1
      src/std/sys/personality/mod.rs
  75. 1 1
      src/std/sys/unix/args.rs
  76. 4 4
      src/std/sys/unix/process/process_unix.rs
  77. 6 138
      src/std/sys/unix/rand.rs
  78. 7 9
      src/std/sys_common/backtrace.rs
  79. 1 1
      src/std/sys_common/thread_local_key.rs

+ 3 - 3
Cargo.toml

@@ -24,9 +24,9 @@ rand = { version = "0.5.5", default-features = false }
 memchr = { version = "2.2.0", default-features = false }
 plain = "0.2"
 unicode-width = "0.1"
-hashbrown = { version = "0.14", default-features = false}
-cfg-if = { version = "1.0"}
-dlibc = {path = "dlibc"}
+hashbrown = { version = "0.14", default-features = false }
+cfg-if = { version = "1.0" }
+dlibc = { path = "./dlibc" }
 
 [dependencies.goblin]
 version = "0.0.21"

+ 4 - 6
dlibc/build.rs

@@ -180,18 +180,16 @@ fn main() {
     let mut c = cc::Build::new();
     //#[cfg(target_os = "dragonos")]
     c.flag("-nostdinc")
-    .flag("-nostdlib")
-    .flag("-fno-stack-protector")
-    .flag("-Wno-expansion-to-defined")
-    .file("src/unix/platform/dragonos/c/dragonos_malloc.c");
+        .flag("-nostdlib")
+        .flag("-fno-stack-protector")
+        .flag("-Wno-expansion-to-defined")
+        .file("src/unix/platform/dragonos/c/dragonos_malloc.c");
     //#[cfg(target_os = "dragonos")]
     c.define("HAVE_MMAP", "0");
     //#[cfg(target_os = "dragonos")]
     c.compile("dlibc_c");
     //#[cfg(target_os = "dragonos")]
     println!("cargo:rustc-link-lib=static=dlibc_c");
-        
-    
 }
 
 fn rustc_minor_nightly() -> (u32, bool) {

+ 1 - 1
dlibc/src/lib.rs

@@ -128,7 +128,7 @@ static ALLOCATOR: crate::unix::platform::allocator::Allocator = crate::unix::pla
 #[cfg(target_os = "dragonos")]
 pub use crate::unix::macros::*;
 
-use core::panic::PanicInfo;
+
 
 #[lang = "eh_personality"]
 extern "C" fn eh_personality() {}

+ 1 - 1
dlibc/src/unix/c_vec.rs

@@ -208,7 +208,7 @@ impl<'a, T> IntoIterator for &'a mut CVec<T> {
 
 impl Write for CVec<u8> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
-        self.extend_from_slice(buf).map_err(|err| {
+        self.extend_from_slice(buf).map_err(|_err| {
             io::Error::new(
                 io::ErrorKind::Other,
                 "AllocStringWriter::write failed to allocate",

+ 13 - 13
dlibc/src/unix/header/_aio/mod.rs

@@ -10,50 +10,50 @@ pub struct aiocb {
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_read(aiocbp: *mut aiocb) -> ::c_int {
+pub extern "C" fn aio_read(_aiocbp: *mut aiocb) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_write(aiocbp: *mut aiocb) -> ::c_int {
+pub extern "C" fn aio_write(_aiocbp: *mut aiocb) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
 pub extern "C" fn lio_listio(
-    mode: ::c_int,
-    list: *const *const aiocb,
-    nent: ::c_int,
-    sig: *mut sigevent,
+    _mode: ::c_int,
+    _list: *const *const aiocb,
+    _nent: ::c_int,
+    _sig: *mut sigevent,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_error(aiocbp: *const aiocb) -> ::c_int {
+pub extern "C" fn aio_error(_aiocbp: *const aiocb) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_return(aiocbp: *mut aiocb) -> usize {
+pub extern "C" fn aio_return(_aiocbp: *mut aiocb) -> usize {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_cancel(fildes: ::c_int, aiocbp: *mut aiocb) -> ::c_int {
+pub extern "C" fn aio_cancel(_fildes: ::c_int, _aiocbp: *mut aiocb) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
 pub extern "C" fn aio_suspend(
-    list: *const *const aiocb,
-    nent: ::c_int,
-    timeout: *const ::timespec,
+    _list: *const *const aiocb,
+    _nent: ::c_int,
+    _timeout: *const ::timespec,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn aio_fsync(operation: ::c_int, aiocbp: *mut aiocb) -> ::c_int {
+pub extern "C" fn aio_fsync(_operation: ::c_int, _aiocbp: *mut aiocb) -> ::c_int {
     unimplemented!();
 }

+ 10 - 10
dlibc/src/unix/header/_fenv/mod.rs

@@ -13,17 +13,17 @@ pub struct fenv_t {
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn feclearexcept(excepts: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn feclearexcept(_excepts: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fegenenv(envp: *mut fenv_t) -> ::c_int {
+pub unsafe extern "C" fn fegenenv(_envp: *mut fenv_t) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fegetexceptflag(flagp: *mut fexcept_t, excepts: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn fegetexceptflag(_flagp: *mut fexcept_t, _excepts: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
@@ -33,36 +33,36 @@ pub unsafe extern "C" fn fegetround() -> ::c_int {
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn feholdexcept(envp: *mut fenv_t) -> ::c_int {
+pub unsafe extern "C" fn feholdexcept(_envp: *mut fenv_t) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn feraiseexcept(except: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn feraiseexcept(_except: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fesetenv(envp: *const fenv_t) -> ::c_int {
+pub unsafe extern "C" fn fesetenv(_envp: *const fenv_t) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fesetexceptflag(flagp: *const fexcept_t, excepts: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn fesetexceptflag(_flagp: *const fexcept_t, _excepts: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fesetround(round: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn fesetround(_round: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn fetestexcept(excepts: ::c_int) -> ::c_int {
+pub unsafe extern "C" fn fetestexcept(_excepts: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub unsafe extern "C" fn feupdateenv(envp: *const fenv_t) -> ::c_int {
+pub unsafe extern "C" fn feupdateenv(_envp: *const fenv_t) -> ::c_int {
     unimplemented!();
 }

+ 5 - 5
dlibc/src/unix/header/arch_aarch64_user/mod.rs

@@ -20,10 +20,10 @@ pub type elf_fpregset_t = user_fpsimd_struct;
 
 #[no_mangle]
 pub extern "C" fn _cbindgen_only_generates_structs_if_they_are_mentioned_which_is_dumb_aarch64_user(
-    a: user_regs_struct,
-    b: user_fpsimd_struct,
-    c: elf_gregset_t,
-    d: elf_greg_t,
-    e: elf_fpregset_t,
+    _a: user_regs_struct,
+    _b: user_fpsimd_struct,
+    _c: elf_gregset_t,
+    _d: elf_greg_t,
+    _e: elf_fpregset_t,
 ) {
 }

+ 6 - 6
dlibc/src/unix/header/arch_x64_user/mod.rs

@@ -71,11 +71,11 @@ pub struct user {
 
 #[no_mangle]
 pub extern "C" fn _cbindgen_only_generates_structs_if_they_are_mentioned_which_is_dumb_x86_user(
-    a: user_fpregs_struct,
-    b: user_regs_struct,
-    c: user,
-    d: elf_gregset_t,
-    e: elf_greg_t,
-    f: elf_fpregset_t,
+    _a: user_fpregs_struct,
+    _b: user_regs_struct,
+    _c: user,
+    _d: elf_gregset_t,
+    _e: elf_greg_t,
+    _f: elf_fpregset_t,
 ) {
 }

+ 1 - 1
dlibc/src/unix/header/arpa_inet/mod.rs

@@ -6,7 +6,7 @@ use core::{
 };
 use crate::unix::c_str::*;
 use crate::unix::platform;
-use unix;
+
 use crate::unix::header::{
     errno::*,
     netinet_in::{in_addr, in_addr_t, INADDR_NONE},

+ 1 - 1
dlibc/src/unix/header/assert/mod.rs

@@ -1,5 +1,5 @@
 //! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
-use crate::unix::header::{stdio, stdlib};
+
 use crate::unix::c_str::*;
 #[no_mangle]
 pub unsafe extern "C" fn __assert_fail(

+ 1 - 1
dlibc/src/unix/header/dirent/mod.rs

@@ -132,7 +132,7 @@ pub unsafe extern "C" fn scandir(
 
     let mut vec = match CVec::with_capacity(4) {
         Ok(vec) => vec,
-        Err(err) => return -1,
+        Err(_err) => return -1,
     };
 
     let old_errno = platform::errno;

+ 3 - 3
dlibc/src/unix/header/dlfcn/mod.rs

@@ -13,7 +13,7 @@ static ERROR_NOT_SUPPORTED: &'static CStr = c_str!("dlfcn not supported");
 static ERROR: AtomicUsize = AtomicUsize::new(0);
 
 #[no_mangle]
-pub unsafe extern "C" fn dladdr(addr: *mut ::c_void, info: *mut ::Dl_info) -> ::c_int {
+pub unsafe extern "C" fn dladdr(_addr: *mut ::c_void, info: *mut ::Dl_info) -> ::c_int {
     //TODO
     (*info).dli_fname = ptr::null();
     (*info).dli_fbase = ptr::null_mut();
@@ -23,7 +23,7 @@ pub unsafe extern "C" fn dladdr(addr: *mut ::c_void, info: *mut ::Dl_info) -> ::
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn dlopen(cfilename: *const ::c_char, flags: ::c_int) -> *mut ::c_void {
+pub unsafe extern "C" fn dlopen(cfilename: *const ::c_char, _flags: ::c_int) -> *mut ::c_void {
     //TODO support all sort of flags
 
     let filename = if cfilename.is_null() {
@@ -51,7 +51,7 @@ pub unsafe extern "C" fn dlopen(cfilename: *const ::c_char, flags: ::c_int) -> *
     let cbs = cbs_c.borrow();
 
     let id = match (cbs.load_library)(&mut linker, filename) {
-        Err(err) => {
+        Err(_err) => {
             ERROR.store(ERROR_NOT_SUPPORTED.as_ptr() as usize, Ordering::SeqCst);
             return ptr::null_mut();
         }

+ 27 - 27
dlibc/src/unix/header/elf/mod.rs

@@ -974,32 +974,32 @@ pub const R_X86_64_NUM: usize = 39;
 
 #[no_mangle]
 pub extern "C" fn stupid_cbindgen_needs_a_function_that_holds_all_elf_structs(
-    a: Elf32_Ehdr,
-    b: Elf64_Ehdr,
-    c: Elf32_Shdr,
-    d: Elf64_Shdr,
-    e: Elf32_Sym,
-    f: Elf64_Sym,
-    g: Elf32_Syminfo,
-    h: Elf64_Syminfo,
-    i: Elf32_Rel,
-    j: Elf64_Rel,
-    k: Elf32_Rela,
-    l: Elf64_Rela,
-    m: Elf32_Phdr,
-    n: Elf64_Phdr,
-    o: Elf32_Dyn,
-    p: Elf64_Dyn,
-    q: Elf32_Verdef,
-    r: Elf64_Verdef,
-    s: Elf32_Verdaux,
-    t: Elf64_Verdaux,
-    u: Elf32_Verneed,
-    v: Elf64_Verneed,
-    w: Elf64_Vernaux,
-    x: Elf64_auxv_t,
-    y: Elf32_Nhdr,
-    z: Elf64_Nhdr,
-    aa: Elf64_Move,
+    _a: Elf32_Ehdr,
+    _b: Elf64_Ehdr,
+    _c: Elf32_Shdr,
+    _d: Elf64_Shdr,
+    _e: Elf32_Sym,
+    _f: Elf64_Sym,
+    _g: Elf32_Syminfo,
+    _h: Elf64_Syminfo,
+    _i: Elf32_Rel,
+    _j: Elf64_Rel,
+    _k: Elf32_Rela,
+    _l: Elf64_Rela,
+    _m: Elf32_Phdr,
+    _n: Elf64_Phdr,
+    _o: Elf32_Dyn,
+    _p: Elf64_Dyn,
+    _q: Elf32_Verdef,
+    _r: Elf64_Verdef,
+    _s: Elf32_Verdaux,
+    _t: Elf64_Verdaux,
+    _u: Elf32_Verneed,
+    _v: Elf64_Verneed,
+    _w: Elf64_Vernaux,
+    _x: Elf64_auxv_t,
+    _y: Elf32_Nhdr,
+    _z: Elf64_Nhdr,
+    _aa: Elf64_Move,
 ) {
 }

+ 2 - 2
dlibc/src/unix/header/fcntl/mod.rs

@@ -1,6 +1,6 @@
 //! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html
 
-use crate::unix::c_str::CStr;
+
 
 pub use self::platform::*;
 use crate::unix::platform;
@@ -29,4 +29,4 @@ pub unsafe extern "C" fn sys_open(path: *const ::c_char, oflag: ::c_int, mode: :
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_fcntl(a: flock) {}
+pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_fcntl(_a: flock) {}

+ 12 - 12
dlibc/src/unix/header/grp/mod.rs

@@ -11,33 +11,33 @@ pub struct group {
 }
 
 // #[no_mangle]
-pub extern "C" fn getgrgid(gid: ::gid_t) -> *mut group {
+pub extern "C" fn getgrgid(_gid: ::gid_t) -> *mut group {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn getgrnam(name: *const ::c_char) -> *mut group {
+pub extern "C" fn getgrnam(_name: *const ::c_char) -> *mut group {
     unimplemented!();
 }
 
 // #[no_mangle]
 pub extern "C" fn getgrgid_r(
-    gid: ::gid_t,
-    grp: *mut group,
-    buffer: *mut ::c_char,
-    bufsize: usize,
-    result: *mut *mut group,
+    _gid: ::gid_t,
+    _grp: *mut group,
+    _buffer: *mut ::c_char,
+    _bufsize: usize,
+    _result: *mut *mut group,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
 pub extern "C" fn getgrnam_r(
-    name: *const ::c_char,
-    grp: *mut group,
-    buffer: *mut ::c_char,
-    bufsize: usize,
-    result: *mut *mut group,
+    _name: *const ::c_char,
+    _grp: *mut group,
+    _buffer: *mut ::c_char,
+    _bufsize: usize,
+    _result: *mut *mut group,
 ) -> ::c_int {
     unimplemented!();
 }

+ 3 - 3
dlibc/src/unix/header/netdb/dns/mod.rs

@@ -16,9 +16,9 @@ use core::{slice, u16};
 mod answer;
 mod query;
 
-use core::ptr;
-use mem;
-use alloc::boxed::Box;
+
+
+
 
 #[allow(non_camel_case_types)]
 #[derive(Copy, Clone, Debug, Default)]

+ 0 - 1
dlibc/src/unix/header/netdb/host.rs

@@ -3,7 +3,6 @@ use core::{mem, ptr};
 
 use crate::unix::platform;
 use crate::unix::{
-    c_str::CString,
     header::{
         arpa_inet::inet_aton, fcntl::O_RDONLY, netinet_in::in_addr, sys_socket::constants::AF_INET,
         unistd::SEEK_SET,

+ 2 - 4
dlibc/src/unix/header/netdb/lookup.rs

@@ -10,11 +10,9 @@ use crate::unix::header::{
     errno::*,
     netinet_in::{in_addr, sockaddr_in, IPPROTO_UDP},
     sys_socket::{
-        self,
         constants::{AF_INET, SOCK_DGRAM},
         socklen_t,
     },
-    time,
 };
 use unix::platform;
 use super::{
@@ -92,7 +90,7 @@ pub fn lookup_host(host: &str) -> Result<LookupHost, ::c_int> {
             Box::from_raw(packet_data_ptr);
         }
 
-        let i = 0 as socklen_t;
+        let _i = 0 as socklen_t;
         let mut buf = vec![0u8; 65536];
         let buf_ptr = buf.as_mut_ptr() as *mut ::c_void;
 
@@ -208,7 +206,7 @@ pub fn lookup_addr(addr: in_addr) -> Result<Vec<Vec<u8>>, ::c_int> {
             Box::from_raw(packet_data_ptr);
         }
 
-        let i = mem::size_of::<sockaddr_in>() as socklen_t;
+        let _i = mem::size_of::<sockaddr_in>() as socklen_t;
         let mut buf = [0u8; 65536];
         let buf_ptr = buf.as_mut_ptr() as *mut ::c_void;
 

+ 4 - 4
dlibc/src/unix/header/netdb/mod.rs

@@ -348,7 +348,7 @@ pub unsafe extern "C" fn gethostbyname(name: *const ::c_char) -> *mut hostent {
     &mut HOST_ENTRY as *mut hostent
 }
 
-pub unsafe extern "C" fn getnetbyaddr(net: u32, net_type: ::c_int) -> *mut netent {
+pub unsafe extern "C" fn getnetbyaddr(_net: u32, _net_type: ::c_int) -> *mut netent {
     unimplemented!();
 }
 
@@ -612,7 +612,7 @@ pub unsafe extern "C" fn getservent() -> *mut servent {
     let mut rlb = RawLineBuffer::new(SERVDB);
     rlb.seek(S_POS);
 
-    let r: Box<str> = Box::default();
+    let _r: Box<str> = Box::default();
 
     loop {
         let r = match rlb.next() {
@@ -839,13 +839,13 @@ pub unsafe extern "C" fn getnameinfo(
 
     let addr = &*(addr as *const sockaddr_in);
 
-    let host_opt = if host.is_null() {
+    let _host_opt = if host.is_null() {
         None
     } else {
         Some(slice::from_raw_parts_mut(host, hostlen as usize))
     };
 
-    let serv_opt = if serv.is_null() {
+    let _serv_opt = if serv.is_null() {
         None
     } else {
         Some(slice::from_raw_parts_mut(serv, servlen as usize))

+ 1 - 1
dlibc/src/unix/header/poll/mod.rs

@@ -53,7 +53,7 @@ pub fn poll_epoll(fds: &mut [pollfd], timeout: ::c_int) -> ::c_int {
     };
 
     for i in 0..fds.len() {
-        let mut pfd = &mut fds[i];
+        let pfd = &mut fds[i];
 
         let mut event = epoll_event {
             events: 0,

+ 2 - 3
dlibc/src/unix/header/pwd/mod.rs

@@ -22,8 +22,7 @@ mod dragonos;
 #[cfg(target_os = "redox")]
 mod redox;
 
-#[cfg(target_os = "dragonos")]
-use self::dragonos as sys;
+
 #[cfg(target_os = "linux")]
 use self::linux as sys;
 #[cfg(target_os = "redox")]
@@ -243,7 +242,7 @@ pub unsafe extern "C" fn getpwuid_r(
     size: ::size_t,
     result: *mut *mut passwd,
 ) -> ::c_int {
-    let slice = core::slice::from_raw_parts_mut(buf as *mut u8, size);
+    let _slice = core::slice::from_raw_parts_mut(buf as *mut u8, size);
     mux(
         pwd_lookup(
             |part| part.pw_uid == uid,

+ 8 - 8
dlibc/src/unix/header/semaphore/mod.rs

@@ -13,12 +13,12 @@ impl Clone for sem_t {
     }
 }
 // #[no_mangle]
-pub extern "C" fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int {
+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 {
+pub extern "C" fn sem_destroy(_sem: *mut sem_t) -> ::c_int {
     unimplemented!();
 }
 
@@ -31,31 +31,31 @@ pub extern "C" fn sem_destroy(sem: *mut sem_t) -> ::c_int {
  */
 
 // #[no_mangle]
-pub extern "C" fn sem_close(sem: *mut sem_t) -> ::c_int {
+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 {
+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 {
+pub extern "C" fn sem_wait(_sem: *mut sem_t) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn sem_trywait(sem: *mut sem_t) -> ::c_int {
+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 {
+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 {
+pub extern "C" fn sem_getvalue(_sem: *mut sem_t, _sval: *mut ::c_int) -> ::c_int {
     unimplemented!();
 }

+ 4 - 4
dlibc/src/unix/header/signal/mod.rs

@@ -9,7 +9,7 @@ use crate::unix::header::errno;
 pub use self::platform::*;
 
 use crate::unix::platform;
-use crate::unix::header::signal::sys::{SA_RESTORER,NSIG};
+use crate::unix::header::signal::sys::{NSIG};
 
 #[cfg(target_os = "linux")]
 #[path = "linux.rs"]
@@ -156,17 +156,17 @@ pub extern "C" fn sigfillset(set: *mut sigset_t) -> ::c_int {
 }
 
 // #[no_mangle]
-pub extern "C" fn sighold(sig: ::c_int) -> ::c_int {
+pub extern "C" fn sighold(_sig: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn sigignore(sig: ::c_int) -> ::c_int {
+pub extern "C" fn sigignore(_sig: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn siginterrupt(sig: ::c_int, flag: ::c_int) -> ::c_int {
+pub extern "C" fn siginterrupt(_sig: ::c_int, _flag: ::c_int) -> ::c_int {
     unimplemented!();
 }
 

+ 1 - 1
dlibc/src/unix/header/stdio/getdelim.rs

@@ -32,7 +32,7 @@ pub unsafe extern "C" fn __getdelim(
         let mut stream = (*stream).lock();
         match stream.read_until(delim, &mut buf) {
             Ok(ok) => ok,
-            Err(err) => return -1,
+            Err(_err) => return -1,
         }
     };
 

+ 1 - 1
dlibc/src/unix/header/stdio/helpers.rs

@@ -1,6 +1,6 @@
 use alloc::boxed::Box;
 
-use super::{constants::*, Buffer, FILE};
+use super::{Buffer, FILE};
 use crate::unix::header::{errno, fcntl::*, string::strchr};
 use crate::unix::{
     fs::File,

+ 1 - 2
dlibc/src/unix/header/stdio/mod.rs

@@ -18,7 +18,6 @@ use crate::unix::header::{
     errno::{self, STR_ERROR},
     fcntl, stdlib,
     string::{self, strlen},
-    unistd,
 };
 use unix::{
     c_str::CStr,
@@ -992,7 +991,7 @@ pub unsafe extern "C" fn setbuf(stream: *mut FILE, buf: *mut ::c_char) {
 pub unsafe extern "C" fn setvbuf(
     stream: *mut FILE,
     buf: *mut ::c_char,
-    mode: ::c_int,
+    _mode: ::c_int,
     mut size: ::size_t,
 ) -> ::c_int {
     let mut stream = (*stream).lock();

+ 3 - 3
dlibc/src/unix/header/stdio/printf.rs

@@ -622,7 +622,7 @@ unsafe fn inner_printf<W: Write>(w: W, format: *const ::c_char, mut ap: VaList)
 
     for section in iterator {
         let arg = match section {
-            Ok(PrintfFmt::Plain(text)) => continue,
+            Ok(PrintfFmt::Plain(_text)) => continue,
             Ok(PrintfFmt::Arg(arg)) => arg,
             Err(()) => return Ok(-1),
         };
@@ -705,7 +705,7 @@ unsafe fn inner_printf<W: Write>(w: W, format: *const ::c_char, mut ap: VaList)
             FmtKind::Signed => {
                 let string = match varargs.get(index, &mut ap, Some((arg.fmtkind, arg.intkind))) {
                     VaArg::c_char(i) => i.to_string(),
-                    VaArg::c_double(i) => panic!("this should not be possible"),
+                    VaArg::c_double(_i) => panic!("this should not be possible"),
                     VaArg::c_int(i) => i.to_string(),
                     VaArg::c_long(i) => i.to_string(),
                     VaArg::c_longlong(i) => i.to_string(),
@@ -753,7 +753,7 @@ unsafe fn inner_printf<W: Write>(w: W, format: *const ::c_char, mut ap: VaList)
             FmtKind::Unsigned => {
                 let string = match varargs.get(index, &mut ap, Some((arg.fmtkind, arg.intkind))) {
                     VaArg::c_char(i) => fmt_int(fmt, i as ::c_uchar),
-                    VaArg::c_double(i) => panic!("this should not be possible"),
+                    VaArg::c_double(_i) => panic!("this should not be possible"),
                     VaArg::c_int(i) => fmt_int(fmt, i as ::c_uint),
                     VaArg::c_long(i) => fmt_int(fmt, i as ::c_ulong),
                     VaArg::c_longlong(i) => fmt_int(fmt, i as ::c_ulonglong),

+ 16 - 16
dlibc/src/unix/header/stdlib/mod.rs

@@ -254,10 +254,10 @@ pub unsafe extern "C" fn drand48() -> ::c_double {
 
 // #[no_mangle]
 pub extern "C" fn ecvt(
-    value: ::c_double,
-    ndigit: ::c_int,
-    decpt: *mut ::c_int,
-    sign: *mut ::c_int,
+    _value: ::c_double,
+    _ndigit: ::c_int,
+    _decpt: *mut ::c_int,
+    _sign: *mut ::c_int,
 ) -> *mut ::c_char {
     unimplemented!();
 }
@@ -305,10 +305,10 @@ pub unsafe extern "C" fn exit(status: ::c_int) {
 
 // #[no_mangle]
 pub extern "C" fn fcvt(
-    value: ::c_double,
-    ndigit: ::c_int,
-    decpt: *mut ::c_int,
-    sign: *mut ::c_int,
+    _value: ::c_double,
+    _ndigit: ::c_int,
+    _decpt: *mut ::c_int,
+    _sign: *mut ::c_int,
 ) -> *mut ::c_char {
     unimplemented!();
 }
@@ -319,7 +319,7 @@ pub unsafe extern "C" fn free(ptr: *mut ::c_void) {
 }
 
 // #[no_mangle]
-pub extern "C" fn gcvt(value: ::c_double, ndigit: ::c_int, buf: *mut ::c_char) -> *mut ::c_char {
+pub extern "C" fn gcvt(_value: ::c_double, _ndigit: ::c_int, _buf: *mut ::c_char) -> *mut ::c_char {
     unimplemented!();
 }
 
@@ -357,15 +357,15 @@ pub unsafe extern "C" fn getenv(name: *const ::c_char) -> *mut ::c_char {
 
 // #[no_mangle]
 pub extern "C" fn getsubopt(
-    optionp: *mut *mut ::c_char,
-    tokens: *const *mut ::c_char,
-    valuep: *mut *mut ::c_char,
+    _optionp: *mut *mut ::c_char,
+    _tokens: *const *mut ::c_char,
+    _valuep: *mut *mut ::c_char,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn grantpt(fildes: ::c_int) -> ::c_int {
+pub extern "C" fn grantpt(_fildes: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
@@ -680,7 +680,7 @@ pub unsafe extern "C" fn posix_memalign(
 }
 
 // #[no_mangle]
-pub extern "C" fn ptsname(fildes: ::c_int) -> *mut ::c_char {
+pub extern "C" fn ptsname(_fildes: ::c_int) -> *mut ::c_char {
     unimplemented!();
 }
 
@@ -917,7 +917,7 @@ pub unsafe extern "C" fn setenv(
 }
 
 // #[no_mangle]
-pub extern "C" fn setkey(key: *const ::c_char) {
+pub extern "C" fn setkey(_key: *const ::c_char) {
     unimplemented!();
 }
 
@@ -1182,7 +1182,7 @@ pub extern "C" fn ttyslot() -> ::c_int {
 }
 
 // #[no_mangle]
-pub extern "C" fn unlockpt(fildes: ::c_int) -> ::c_int {
+pub extern "C" fn unlockpt(_fildes: ::c_int) -> ::c_int {
     unimplemented!();
 }
 

+ 1 - 1
dlibc/src/unix/header/string/mod.rs

@@ -476,7 +476,7 @@ pub unsafe extern "C" fn strlcpy(dst: *mut ::c_char, src: *const ::c_char, n: ::
 #[no_mangle]
 pub unsafe extern "C" fn strlcat(dst: *mut ::c_char, src: *const ::c_char, n: ::size_t) -> ::size_t {
     let len = strlen(dst) as isize;
-    let mut d = dst.offset(len);
+    let d = dst.offset(len);
 
     strlcpy(d, src, n)
 }

+ 1 - 1
dlibc/src/unix/header/sys_epoll/mod.rs

@@ -2,7 +2,7 @@
 
 use core::ptr;
 
-use sigset_t;
+
 
 use crate::unix::platform;
 

+ 1 - 1
dlibc/src/unix/header/sys_file/mod.rs

@@ -1,5 +1,5 @@
 //! sys/file.h implementation
-use crate::unix::platform;
+
 
 pub const LOCK_SH: usize = 1;
 pub const LOCK_EX: usize = 2;

+ 1 - 1
dlibc/src/unix/header/sys_mman/mod.rs

@@ -3,7 +3,7 @@ use crate::unix::{
     header::fcntl,
 };
 
-use crate::unix::platform;
+
 
 pub const MADV_NORMAL: ::c_int = 0;
 pub const MADV_RANDOM: ::c_int = 1;

+ 6 - 6
dlibc/src/unix/header/sys_procfs/mod.rs

@@ -63,11 +63,11 @@ pub type prpsinfo_t = elf_prpsinfo;
 
 #[no_mangle]
 pub extern "C" fn _cbindgen_only_generates_structs_if_they_are_mentioned_which_is_dumb_procfs(
-    a: psaddr_t,
-    b: prgregset_t,
-    c: prfpregset_t,
-    d: lwpid_t,
-    e: prstatus_t,
-    f: prpsinfo_t,
+    _a: psaddr_t,
+    _b: prgregset_t,
+    _c: prfpregset_t,
+    _d: lwpid_t,
+    _e: prstatus_t,
+    _f: prpsinfo_t,
 ) {
 }

+ 1 - 1
dlibc/src/unix/header/sys_ptrace/mod.rs

@@ -23,7 +23,7 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_int = 32;
 
 // Can't use "params: ..." syntax, because... guess what? Cbingen again :(
 #[no_mangle]
-pub unsafe extern "C" fn sys_ptrace(request: ::c_int, mut params: VaList) -> ::c_int {
+pub unsafe extern "C" fn sys_ptrace(request: ::c_int, _params: VaList) -> ::c_int {
     // Musl also just grabs the arguments from the varargs...
     //
     //platform::pal::ptrace(request, params.arg(), params.arg(), params.arg()) as ::c_int

+ 2 - 2
dlibc/src/unix/header/sys_random/mod.rs

@@ -1,6 +1,6 @@
-use core::slice;
 
-use crate::unix::platform;
+
+
 pub const GRND_NONBLOCK: ::c_uint = 1;
 pub const GRND_RANDOM: ::c_uint = 2;
 

+ 1 - 1
dlibc/src/unix/header/sys_resource/mod.rs

@@ -2,7 +2,7 @@
 //! http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html
 
 use crate::unix::header::sys_time::timeval;
-use crate::unix::{platform,rlimit};
+
 // Exported in bits file
 // const RUSAGE_SELF: ::c_int = 0;
 // const RUSAGE_CHILDREN: ::c_int = -1;

+ 1 - 2
dlibc/src/unix/header/sys_stat/mod.rs

@@ -1,11 +1,10 @@
 //! ::stat implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html
 
 use crate::unix::{
-    c_str::CStr,
     header::fcntl::{O_NOFOLLOW, O_PATH},
 };
 
-use timespec;
+
 
 use crate::unix::platform;
 

+ 0 - 1
dlibc/src/unix/header/sys_statvfs/mod.rs

@@ -1,7 +1,6 @@
 //! ::statvfs implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstatvfs.h.html
 
 use crate::unix::{
-    c_str::CStr,
     header::fcntl::O_PATH,
     platform,
 };

+ 1 - 1
dlibc/src/unix/header/sys_utsname/mod.rs

@@ -1,6 +1,6 @@
 //! sys/utsname implementation, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysutsname.h.html
 
-use crate::unix::platform;
+
 
 pub const UTSLENGTH: usize = 65;
 

+ 1 - 1
dlibc/src/unix/header/sys_wait/mod.rs

@@ -2,7 +2,7 @@
 //! http://pubs.opengroup.org/onlinepubs/7908799/xsh/syswait.h.html
 
 //use header::sys_resource::rusage;
-use crate::unix::platform;
+
 
 pub const WNOHANG: ::c_int = 1;
 pub const WUNTRACED: ::c_int = 2;

+ 1 - 1
dlibc/src/unix/header/termios/mod.rs

@@ -1,6 +1,6 @@
 //! termios implementation, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html
 
-use crate::unix::header::{errno, sys_ioctl};
+use crate::unix::header::{errno};
 
 pub type cc_t = u8;
 pub type speed_t = u32;

+ 13 - 13
dlibc/src/unix/header/time/mod.rs

@@ -155,7 +155,7 @@ pub extern "C" fn clock() -> ::clock_t {
 }
 
 #[no_mangle]
-pub extern "C" fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int {
+pub extern "C" fn clock_getres(_clock_id: ::clockid_t, _res: *mut ::timespec) -> ::c_int {
     unimplemented!();
 }
 
@@ -165,7 +165,7 @@ pub extern "C" fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> :
 // }
 
 // #[no_mangle]
-pub extern "C" fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int {
+pub extern "C" fn clock_settime(_clock_id: ::clockid_t, _tp: *const ::timespec) -> ::c_int {
     unimplemented!();
 }
 
@@ -200,7 +200,7 @@ pub extern "C" fn difftime(time1: ::time_t, time0: ::time_t) -> ::c_double {
 }
 
 // #[no_mangle]
-pub extern "C" fn getdate(string: *const ::c_char) -> tm {
+pub extern "C" fn getdate(_string: *const ::c_char) -> tm {
     unimplemented!();
 }
 
@@ -437,15 +437,15 @@ pub unsafe extern "C" fn timegm(tm: *mut tm) -> ::time_t {
 
 // #[no_mangle]
 pub extern "C" fn timer_create(
-    clock_id: ::clockid_t,
-    evp: *mut sigevent,
-    timerid: *mut ::timer_t,
+    _clock_id: ::clockid_t,
+    _evp: *mut sigevent,
+    _timerid: *mut ::timer_t,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn timer_delete(timerid: ::timer_t) -> ::c_int {
+pub extern "C" fn timer_delete(_timerid: ::timer_t) -> ::c_int {
     unimplemented!();
 }
 
@@ -456,21 +456,21 @@ pub extern "C" fn tzset() {
 
 // #[no_mangle]
 pub extern "C" fn timer_settime(
-    timerid: ::timer_t,
-    flags: ::c_int,
-    value: *const itimerspec,
-    ovalue: *mut itimerspec,
+    _timerid: ::timer_t,
+    _flags: ::c_int,
+    _value: *const itimerspec,
+    _ovalue: *mut itimerspec,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn timer_gettime(timerid: ::timer_t, value: *mut itimerspec) -> ::c_int {
+pub extern "C" fn timer_gettime(_timerid: ::timer_t, _value: *mut itimerspec) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn timer_getoverrun(timerid: ::timer_t) -> ::c_int {
+pub extern "C" fn timer_getoverrun(_timerid: ::timer_t) -> ::c_int {
     unimplemented!();
 }
 

+ 8 - 8
dlibc/src/unix/header/unistd/mod.rs

@@ -5,7 +5,7 @@ use core::{convert::TryFrom, mem, ptr, slice};
 use crate::unix::{
     c_str::CStr,
     header::{
-        errno, fcntl, limits, stdlib::getenv, sys_ioctl, sys_time, sys_utsname, termios,
+        errno, limits, stdlib::getenv, sys_time, termios,
     },
 };
 use alloc::collections::LinkedList;
@@ -15,9 +15,9 @@ pub use self::{brk::*, getopt::*, pathconf::*, sysconf::*};
 use ioctl;
 use TIOCSPGRP;
 use TIOCGPGRP;
-use TCXONC;
 
-use O_WRONLY;
+
+
 
 mod brk;
 mod getopt;
@@ -98,7 +98,7 @@ pub extern "C" fn alarm(seconds: ::c_uint) -> ::c_uint {
 // }
 
 #[no_mangle]
-pub extern "C" fn chroot(path: *const ::c_char) -> ::c_int {
+pub extern "C" fn chroot(_path: *const ::c_char) -> ::c_int {
     // TODO: Implement
     unsafe {
         platform::errno = crate::unix::header::errno::EPERM;
@@ -230,7 +230,7 @@ pub unsafe extern "C" fn execvp(file: *const ::c_char, argv: *const *const ::c_c
 // }
 
 // #[no_mangle]
-pub extern "C" fn fdatasync(fildes: ::c_int) -> ::c_int {
+pub extern "C" fn fdatasync(_fildes: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
@@ -362,7 +362,7 @@ pub unsafe extern "C" fn getlogin() -> *mut ::c_char {
 }
 
 #[no_mangle]
-pub extern "C" fn getlogin_r(name: *mut ::c_char, namesize: ::size_t) -> ::c_int {
+pub extern "C" fn getlogin_r(_name: *mut ::c_char, _namesize: ::size_t) -> ::c_int {
     //TODO: Determine correct getlogin result on Redox
     unsafe { platform::errno = errno::ENOENT };
     -1
@@ -458,7 +458,7 @@ pub extern "C" fn isatty(fd: ::c_int) -> ::c_int {
 // }
 
 // #[no_mangle]
-pub extern "C" fn nice(incr: ::c_int) -> ::c_int {
+pub extern "C" fn nice(_incr: ::c_int) -> ::c_int {
     unimplemented!();
 }
 
@@ -621,7 +621,7 @@ pub extern "C" fn swab(src: *const ::c_void, dest: *mut ::c_void, nbytes: ::ssiz
     }
     let number_of_swaps = nbytes / 2;
     let mut offset = 0;
-    for i in 0..number_of_swaps {
+    for _i in 0..number_of_swaps {
         unsafe {
             src.offset(offset).copy_to(dest.offset(offset + 1), 1);
             src.offset(offset + 1).copy_to(dest.offset(offset), 1);

+ 27 - 27
dlibc/src/unix/header/wchar/mod.rs

@@ -112,7 +112,7 @@ pub unsafe extern "C" fn mbsinit(ps: *const mbstate_t) -> ::c_int {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn mbrlen(s: *const ::c_char, n: ::size_t, ps: *mut mbstate_t) -> ::size_t {
+pub unsafe extern "C" fn mbrlen(s: *const ::c_char, n: ::size_t, _ps: *mut mbstate_t) -> ::size_t {
     static mut INTERNAL: mbstate_t = mbstate_t;
     mbrtowc(ptr::null_mut(), s, n, &mut INTERNAL)
 }
@@ -128,7 +128,7 @@ pub unsafe extern "C" fn mbrtowc(
     static mut INTERNAL: mbstate_t = mbstate_t;
 
     if ps.is_null() {
-        let ps = &mut INTERNAL;
+        let _ps = &mut INTERNAL;
     }
     if s.is_null() {
         let xs: [::c_char; 1] = [0];
@@ -151,7 +151,7 @@ pub unsafe extern "C" fn mbsnrtowcs(
     static mut INTERNAL: mbstate_t = mbstate_t;
 
     if ps.is_null() {
-        let ps = &mut INTERNAL;
+        let _ps = &mut INTERNAL;
     }
 
     let mut src = *src_ptr;
@@ -221,40 +221,40 @@ pub unsafe extern "C" fn putwchar(wc: ::wchar_t) -> ::wint_t {
 
 // #[no_mangle]
 pub extern "C" fn swprintf(
-    s: *mut ::wchar_t,
-    n: ::size_t,
-    format: *const ::wchar_t,
-    ap: va_list,
+    _s: *mut ::wchar_t,
+    _n: ::size_t,
+    _format: *const ::wchar_t,
+    _ap: va_list,
 ) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn swscanf(s: *const ::wchar_t, format: *const ::wchar_t, ap: va_list) -> ::c_int {
+pub extern "C" fn swscanf(_s: *const ::wchar_t, _format: *const ::wchar_t, _ap: va_list) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn ungetwc(wc: ::wint_t, stream: *mut FILE) -> ::wint_t {
+pub extern "C" fn ungetwc(_wc: ::wint_t, _stream: *mut FILE) -> ::wint_t {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn vfwprintf(stream: *mut FILE, format: *const ::wchar_t, arg: va_list) -> ::c_int {
+pub extern "C" fn vfwprintf(_stream: *mut FILE, _format: *const ::wchar_t, _arg: va_list) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn vwprintf(format: *const ::wchar_t, arg: va_list) -> ::c_int {
+pub extern "C" fn vwprintf(_format: *const ::wchar_t, _arg: va_list) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
 pub extern "C" fn vswprintf(
-    s: *mut ::wchar_t,
-    n: ::size_t,
-    format: *const ::wchar_t,
-    arg: va_list,
+    _s: *mut ::wchar_t,
+    _n: ::size_t,
+    _format: *const ::wchar_t,
+    _arg: va_list,
 ) -> ::c_int {
     unimplemented!();
 }
@@ -330,10 +330,10 @@ pub unsafe extern "C" fn wcscspn(wcs: *const ::wchar_t, set: *const ::wchar_t) -
 
 // #[no_mangle]
 pub extern "C" fn wcsftime(
-    wcs: *mut ::wchar_t,
-    maxsize: ::size_t,
-    format: *const ::wchar_t,
-    timptr: *mut tm,
+    _wcs: *mut ::wchar_t,
+    _maxsize: ::size_t,
+    _format: *const ::wchar_t,
+    _timptr: *mut tm,
 ) -> ::size_t {
     unimplemented!();
 }
@@ -435,10 +435,10 @@ pub unsafe extern "C" fn wcsrchr(ws1: *const ::wchar_t, wc: ::wchar_t) -> *mut :
 
 // #[no_mangle]
 pub extern "C" fn wcsrtombs(
-    dst: *mut ::c_char,
-    src: *mut *const ::wchar_t,
-    len: ::size_t,
-    ps: *mut mbstate_t,
+    _dst: *mut ::c_char,
+    _src: *mut *const ::wchar_t,
+    _len: ::size_t,
+    _ps: *mut mbstate_t,
 ) -> ::size_t {
     unimplemented!();
 }
@@ -630,7 +630,7 @@ pub unsafe extern "C" fn wcstoul(
 }
 
 // #[no_mangle]
-pub extern "C" fn wcswcs(ws1: *const ::wchar_t, ws2: *const ::wchar_t) -> *mut ::wchar_t {
+pub extern "C" fn wcswcs(_ws1: *const ::wchar_t, _ws2: *const ::wchar_t) -> *mut ::wchar_t {
     unimplemented!();
 }
 
@@ -648,7 +648,7 @@ pub unsafe extern "C" fn wcswidth(pwcs: *const ::wchar_t, n: ::size_t) -> ::c_in
 }
 
 // #[no_mangle]
-pub extern "C" fn wcsxfrm(ws1: *mut ::wchar_t, ws2: *const ::wchar_t, n: ::size_t) -> ::size_t {
+pub extern "C" fn wcsxfrm(_ws1: *mut ::wchar_t, _ws2: *const ::wchar_t, _n: ::size_t) -> ::size_t {
     unimplemented!();
 }
 
@@ -729,12 +729,12 @@ pub unsafe extern "C" fn wmemset(ws: *mut ::wchar_t, wc: ::wchar_t, n: ::size_t)
 }
 
 // #[no_mangle]
-pub extern "C" fn wprintf(format: *const ::wchar_t, ap: va_list) -> ::c_int {
+pub extern "C" fn wprintf(_format: *const ::wchar_t, _ap: va_list) -> ::c_int {
     unimplemented!();
 }
 
 // #[no_mangle]
-pub extern "C" fn wscanf(format: *const ::wchar_t, ap: va_list) -> ::c_int {
+pub extern "C" fn wscanf(_format: *const ::wchar_t, _ap: va_list) -> ::c_int {
     unimplemented!();
 }
 

+ 2 - 2
dlibc/src/unix/header/wchar/utf8.rs

@@ -38,7 +38,7 @@ fn utf8_char_width(b: u8) -> usize {
 }
 
 //It's guaranteed that we don't have any nullpointers here
-pub unsafe fn mbrtowc(pwc: *mut ::wchar_t, s: *const ::c_char, n: usize, ps: *mut mbstate_t) -> usize {
+pub unsafe fn mbrtowc(pwc: *mut ::wchar_t, s: *const ::c_char, n: usize, _ps: *mut mbstate_t) -> usize {
     let size = utf8_char_width(*s as u8);
     if size > n {
         platform::errno = errno::EILSEQ;
@@ -72,7 +72,7 @@ pub unsafe fn mbrtowc(pwc: *mut ::wchar_t, s: *const ::c_char, n: usize, ps: *mu
 }
 
 //It's guaranteed that we don't have any nullpointers here
-pub unsafe fn wcrtomb(s: *mut ::c_char, wc: ::wchar_t, ps: *mut mbstate_t) -> usize {
+pub unsafe fn wcrtomb(s: *mut ::c_char, wc: ::wchar_t, _ps: *mut mbstate_t) -> usize {
     let dc = char::from_u32(wc as u32);
 
     if dc.is_none() {

+ 2 - 2
dlibc/src/unix/ld_so/access.rs

@@ -3,7 +3,7 @@
 
 #[cfg(target_os = "redox")]
 use crate::unix::header::unistd::{F_OK, R_OK, W_OK, X_OK};
-use crate::unix::c_str::{CStr, CString};
+use crate::unix::c_str::{CString};
 
 pub fn accessible(path: &str, mode: ::c_int) -> ::c_int {
     let path_c = CString::new(path.as_bytes()).unwrap(); /*.map_err(|err| {
@@ -19,7 +19,7 @@ unsafe fn access(path: *const ::c_char, mode: ::c_int) -> ::c_int {
 }
 
 #[cfg(target_os = "dragonos")]
-unsafe fn access(path: *const ::c_char, mode: ::c_int) -> ::c_int {
+unsafe fn access(_path: *const ::c_char, _mode: ::c_int) -> ::c_int {
     // let path = CStr::from_ptr(path);
     // syscall!(ACCESS, (path).as_ptr(), mode) as ::c_int
     return -1;

+ 2 - 2
dlibc/src/unix/ld_so/dso.rs

@@ -4,7 +4,7 @@ use super::{
     linker::Symbol,
     tcb::{round_up, Master},
 };
-use unix::header::{errno::STR_ERROR, sys_mman};
+use unix::header::{errno::STR_ERROR};
 
 use alloc::{
     collections::BTreeMap,
@@ -258,7 +258,7 @@ impl DSO {
         // Copy data
         for ph in elf.program_headers.iter() {
             let voff = ph.p_vaddr % ph.p_align;
-            let vaddr = (ph.p_vaddr - voff) as usize;
+            let _vaddr = (ph.p_vaddr - voff) as usize;
             let vsize = round_up((ph.p_memsz + voff) as usize, ph.p_align as usize);
 
             match ph.p_type {

+ 2 - 3
dlibc/src/unix/ld_so/linker.rs

@@ -15,7 +15,6 @@ use crate::unix::{
     fs::File,
     header::{
         dl_tls::{__tls_get_addr, dl_tls_index},
-        fcntl, sys_mman,
         unistd::F_OK,
     },
     io::Read,
@@ -35,7 +34,7 @@ use O_CLOEXEC;
 
 use crate::trace;
 use PROT_EXEC;
-use PROT_NONE;
+
 use PROT_READ;
 use PROT_WRITE;
 use mprotect;
@@ -109,7 +108,7 @@ impl Linker {
     pub fn get_sym(&self, lib_id: usize, name: &str) -> Option<*mut ::c_void> {
         match self.objects.get(&lib_id) {
             Some(obj) => {
-                return obj.get_sym(name).map(|(s, strong)| {
+                return obj.get_sym(name).map(|(s, _strong)| {
                     if s.sym_type != STT_TLS {
                         s.as_ptr()
                     } else {

+ 3 - 3
dlibc/src/unix/ld_so/mod.rs

@@ -107,7 +107,7 @@ pub fn static_init(sp: &'static Stack) {
 
         let page_size = platform::pal::getpagesize();
         let voff = ph.p_vaddr as usize % page_size;
-        let vaddr = ph.p_vaddr as usize - voff;
+        let _vaddr = ph.p_vaddr as usize - voff;
         let vsize = ((ph.p_memsz as usize + voff + page_size - 1) / page_size) * page_size;
 
         match ph.p_type {
@@ -140,8 +140,8 @@ pub fn static_init(sp: &'static Stack) {
 }
 
 #[cfg(any(target_os = "linux", target_os = "redox", target_os = "dragonos"))]
-pub unsafe fn init(sp: &'static Stack) {
-    let mut tp = 0usize;
+pub unsafe fn init(_sp: &'static Stack) {
+    let _tp = 0usize;
 
     #[cfg(target_os = "linux")]
     {

+ 2 - 2
dlibc/src/unix/ld_so/start.rs

@@ -88,7 +88,7 @@ unsafe fn adjust_stack(sp: &'static mut Stack) {
         if let Ok(arg_str) = CStr::from_ptr(arg as *const ::c_char).to_str() {
             let mut parts = arg_str.splitn(2, '=');
             if let Some(key) = parts.next() {
-                if let Some(value) = parts.next() {
+                if let Some(_value) = parts.next() {
                     if let "LD_LIBRARY_PATH" = key {
                         //library_path = value
                     }
@@ -213,7 +213,7 @@ pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: usize) ->
         argv[0].to_string()
     };
 
-    let (path, name) = match resolve_path_name(&name_or_path, &envs) {
+    let (path, _name) = match resolve_path_name(&name_or_path, &envs) {
         Some((p, n)) => (p, n),
         None => {
             eprintln!("ld.so: failed to locate '{}'", name_or_path);

+ 4 - 5
dlibc/src/unix/ld_so/tcb.rs

@@ -1,13 +1,12 @@
-use crate::println;
+
 use alloc::vec::Vec;
 use core::{arch::asm, mem, ptr, slice};
 use goblin::error::{Error, Result};
 
-use super::ExpectTlsFree;
+
 
 use crate::unix::platform;
 use crate::unix::{
-    header::sys_mman,
     ld_so::linker::Linker,
     sync::mutex::Mutex,
 };
@@ -63,7 +62,7 @@ impl Tcb {
     /// Create a new TCB
     pub unsafe fn new(size: usize) -> Result<&'static mut Self> {
         let page_size = platform::pal::getpagesize();
-        let (abi_page, tls, tcb_page) = Self::os_new(round_up(size, page_size))?;
+        let (_abi_page, tls, tcb_page) = Self::os_new(round_up(size, page_size))?;
 
         let tcb_ptr = tcb_page.as_mut_ptr() as *mut Self;
         trace!("New TCB: {:p}", tcb_ptr);
@@ -273,7 +272,7 @@ impl Tcb {
 
     /// OS and architecture specific code to activate TLS - DragonOS x86_64
     #[cfg(all(target_os = "dragonos", target_arch = "x86_64"))]
-    unsafe fn os_arch_activate(tls_end: usize, _tls_len: usize) {
+    unsafe fn os_arch_activate(_tls_end: usize, _tls_len: usize) {
         const ARCH_SET_FS: usize = 0x1002;
         // syscall!(ARCH_PRCTL, ARCH_SET_FS, tls_end);
         unimplemented!()

+ 6 - 8
dlibc/src/unix/mod.rs

@@ -61,7 +61,7 @@ impl ::Clone for DIR {
 pub type locale_t = *mut ::c_void;
 
 #[cfg(target_os = "dragonos")]
-#[derive(Default,Copy,Clone)]
+#[derive(Default, Copy, Clone)]
 pub struct timespec {
     pub tv_sec: time_t,
     #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
@@ -73,7 +73,7 @@ pub struct timespec {
 // linux x32 compatibility
 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
 #[cfg(not(target_os = "dragonos"))]
-#[derive(Copy,Clone)]
+#[derive(Copy, Clone)]
 pub struct timespec {
     pub tv_sec: time_t,
     #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
@@ -1606,16 +1606,14 @@ cfg_if! {
 #[macro_use]
 pub mod macros;
 
+pub mod c_str;
+pub mod c_vec;
+pub mod crt0;
+pub mod fs;
 pub mod header;
 pub mod ld_so;
 pub mod start;
-pub mod fs;
 pub mod sync;
-pub mod c_str;
-pub mod c_vec;
-pub mod crt0;
-
-
 
 mod io;
 

+ 1 - 1
dlibc/src/unix/platform/dragonos/mod.rs

@@ -5105,7 +5105,7 @@ pub use self::pal::relibc_adapter::{
 
 pub use self::pal::errno;
 use alloc::boxed::Box;
-pub fn init(auxvs: Box<[[usize; 2]]>) {}
+pub fn init(_auxvs: Box<[[usize; 2]]>) {}
 
 cfg_if! {
     if #[cfg(libc_align)] {

+ 25 - 239
dlibc/src/unix/platform/dragonos/pal/mod.rs

@@ -1,4 +1,3 @@
-
 pub mod relibc_adapter;
 pub use self::relibc_adapter::*;
 
@@ -19,180 +18,19 @@ pub extern "C" fn e(sys: usize) -> usize {
 }
 
 #[no_mangle]
-pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
-    unimplemented!()
+pub extern "C" fn getrandom(_buf: &mut [u8], _flags: ::c_uint) -> ::ssize_t {
+    0
 }
 
-// #[no_mangle]
-// pub extern "C" fn pthread_key_delete(key: pthread_key_t) -> ::c_int{
-//     0
-// }
-// #[no_mangle]
-// pub extern "C" fn syscall(num: ::c_long) -> ::c_long{
-//     0
-// }
-// #[no_mangle]
-// pub extern "C" fn isalnum(c: ::c_int) -> ::c_int{
-//  ::c_int::from(isdigit(c) != 0 || isalpha(c) != 0)
-// }
-// #[no_mangle]
-// pub extern "C" fn isalpha(c: ::c_int) -> ::c_int {
-//     ::c_int::from(islower(c) != 0 || isupper(c) != 0)
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isascii(c: ::c_int) -> ::c_int {
-//     ::c_int::from((c & !0x7f) == 0)
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isblank(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c == ::c_int::from(b' ') || c == ::c_int::from(b'\t'))
-// }
-
-// #[no_mangle]
-// pub extern "C" fn iscntrl(c: ::c_int) -> ::c_int {
-//     ::c_int::from((c >= 0x00 && c <= 0x1f) || c == 0x7f)
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isdigit(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c >= ::c_int::from(b'0') && c <= ::c_int::from(b'9'))
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isgraph(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c >= 0x21 && c <= 0x7e)
-// }
-
-// #[no_mangle]
-// pub extern "C" fn islower(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c >= ::c_int::from(b'a') && c <= ::c_int::from(b'z'))
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isprint(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c >= 0x20 && c < 0x7f)
-// }
-
-// #[no_mangle]
-// pub extern "C" fn ispunct(c: ::c_int) -> ::c_int {
-//     ::c_int::from(
-//         (c >= ::c_int::from(b'!') && c <= ::c_int::from(b'/'))
-//             || (c >= ::c_int::from(b':') && c <= ::c_int::from(b'@'))
-//             || (c >= ::c_int::from(b'[') && c <= ::c_int::from(b'`'))
-//             || (c >= ::c_int::from(b'{') && c <= ::c_int::from(b'~')),
-//     )
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isspace(c: ::c_int) -> ::c_int {
-//     ::c_int::from(
-//         c == ::c_int::from(b' ')
-//             || c == ::c_int::from(b'\t')
-//             || c == ::c_int::from(b'\n')
-//             || c == ::c_int::from(b'\r')
-//             || c == 0x0b
-//             || c == 0x0c,
-//     )
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isupper(c: ::c_int) -> ::c_int {
-//     ::c_int::from(c >= ::c_int::from(b'A') && c <= ::c_int::from(b'Z'))
-// }
-
-// #[no_mangle]
-// pub extern "C" fn isxdigit(c: ::c_int) -> ::c_int {
-//     ::c_int::from(isdigit(c) != 0 || (c | 32 >= ::c_int::from(b'a') && c | 32 <= ::c_int::from(b'f')))
-// }
-
-// #[no_mangle]
-// /// The comment in musl:
-// /// "nonsense function that should NEVER be used!"
-// pub extern "C" fn toascii(c: ::c_int) -> ::c_int {
-//     c & 0x7f
-// }
-
-// #[no_mangle]
-// pub extern "C" fn tolower(c: ::c_int) -> ::c_int {
-//     if isupper(c) != 0 {
-//         c | 0x20
-//     } else {
-//         c
-//     }
-// }
-
-// #[no_mangle]
-// pub extern "C" fn toupper(c: ::c_int) -> ::c_int {
-//     if islower(c) != 0 {
-//         c & !0x20
-//     } else {
-//         c
-//     }
-// }
-// #[no_mangle]
-// pub extern "C" fn qsort(
-//     base: *mut c_void,
-//     num: ::size_t,
-//     size: ::size_t,
-//     compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> ::c_int>,
-// ){
-// 	unimplemented!()
-// }
-// unsafe extern "C" fn void_cmp(a: *const c_void, b: *const c_void) -> ::c_int {
-//     *(a as *const i32) - *(b as *const i32) as ::c_int
-// }
-// #[no_mangle]
-// pub unsafe extern "C" fn bsearch(
-//     key: *const c_void,
-//     base: *const c_void,
-//     num: ::size_t,
-//     size: ::size_t,
-//     compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> ::c_int>,
-// ) -> *mut c_void{
-// 	let mut start = base;
-//     let mut len = num;
-//     let cmp_fn = compar.unwrap_or(void_cmp);
-//     while len > 0 {
-//         let med = (start as ::size_t + (len >> 1) * size) as *const c_void;
-//         let diff = cmp_fn(key, med);
-//         if diff == 0 {
-//             return med as *mut c_void;
-//         } else if diff > 0 {
-//             start = (med as usize + size) as *const c_void;
-//             len -= 1;
-//         }
-//         len >>= 1;
-//     }
-//     ptr::null_mut()
-// }
-
-// pub unsafe fn parse_mode_flags(mode_str: *const ::c_char) -> i32 {
-//     let mut flags = if !strchr(mode_str, b'+' as i32).is_null() {
-//         O_RDWR
-//     } else if (*mode_str) == b'r' as i8 {
-//         O_RDONLY
-//     } else {
-//         O_WRONLY
-//     };
-//     if !strchr(mode_str, b'x' as i32).is_null() {
-//         flags |= O_EXCL;
-//     }
-//     if !strchr(mode_str, b'e' as i32).is_null() {
-//         flags |= O_CLOEXEC;
-//     }
-//     if (*mode_str) != b'r' as i8 {
-//         flags |= O_CREAT;
-//     }
-//     if (*mode_str) == b'w' as i8 {
-//         flags |= O_TRUNC;
-//     } else if (*mode_str) == b'a' as i8 {
-//         flags |= O_APPEND;
-//     }
+#[no_mangle]
+pub extern "C" fn pthread_key_delete(_key: ::pthread_key_t) -> ::c_int {
+    0
+}
+#[no_mangle]
+pub extern "C" fn syscall(_num: ::c_long) -> ::c_long {
+    0
+}
 
-//     flags
-// }
 // #[no_mangle]
 // pub extern "C" fn fopen(filename: *const ::c_char, mode: *const ::c_char) -> *mut FILE{
 // 	unimplemented!()
@@ -696,8 +534,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 //     target_vendor = "nintendo"
 // )))]
 
-
-
 // #[cfg_attr(
 //     all(target_os = "macos", not(target_arch = "aarch64")),
 //     link_name = "stat$INODE64"
@@ -729,7 +565,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[cfg_attr(
 //     all(target_os = "macos", target_arch = "x86"),
 //     link_name = "creat$UNIX2003"
@@ -740,8 +575,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[cfg_attr(
 //     all(target_os = "macos", target_arch = "x86_64"),
 //     link_name = "opendir$INODE64"
@@ -855,17 +688,11 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn alarm(seconds: ::c_uint) -> ::c_uint{
 // 	unimplemented!()
 // }
 
-
-
-
-
-
 // #[no_mangle]
 // pub extern "C" fn execl(path: *const ::c_char, arg0: *const ::c_char) -> ::c_int{
 // 	unimplemented!()
@@ -888,15 +715,11 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long{
 // 	unimplemented!()
 // }
 
-
-
-
 // #[no_mangle]
 // pub extern "C" fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int{
 // 	unimplemented!()
@@ -920,14 +743,11 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[no_mangle]
 // pub extern "C" fn isatty(fd: ::c_int) -> ::c_int{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn pathconf(path: *const ::c_char, name: ::c_int) -> c_long{
 // 	unimplemented!()
@@ -945,7 +765,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 //     link_name = "read$UNIX2003"
 // )]
 
-
 // #[no_mangle]
 // pub extern "C" fn seteuid(uid: uid_t) -> ::c_int{
 // 	unimplemented!()
@@ -968,7 +787,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[cfg_attr(
 //     all(target_os = "macos", target_arch = "x86"),
 //     link_name = "sleep$UNIX2003"
@@ -1034,7 +852,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
 // #[no_mangle]
 // pub extern "C" fn utime(file: *const ::c_char, buf: *const utimbuf) -> ::c_int{
@@ -1058,13 +875,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
-
-
-
-
-
 // #[no_mangle]
 // pub extern "C" fn if_nametoindex(ifname: *const ::c_char) -> ::c_uint{
 // 	unimplemented!()
@@ -1088,8 +898,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[cfg_attr(
 //     all(target_os = "macos", target_arch = "x86"),
 //     link_name = "setenv$UNIX2003"
@@ -1108,14 +916,11 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[no_mangle]
 // pub extern "C" fn truncate(path: *const ::c_char, length: off_t) -> ::c_int{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t{
 // 	unimplemented!()
@@ -1141,8 +946,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
 // #[no_mangle]
 // pub extern "C" fn times(buf: *mut ::tms) -> ::clock_t{
@@ -1187,21 +990,21 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // }
 // #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
 
-// #[no_mangle]
-// pub extern "C" fn pthread_key_create(
-//     key: *mut pthread_key_t,
-//     dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
-// ) -> ::c_int{
-// 	unimplemented!()
-// }
-// #[no_mangle]
-// pub extern "C" fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void{
-// 	unimplemented!()
-// }
-// #[no_mangle]
-// pub extern "C" fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int{
-// 	unimplemented!()
-// }
+#[no_mangle]
+pub extern "C" fn pthread_key_create(
+    _key: *mut ::pthread_key_t,
+    _dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
+) -> ::c_int {
+    0
+}
+#[no_mangle]
+pub extern "C" fn pthread_getspecific(_key: ::pthread_key_t) -> *mut ::c_void {
+    core::ptr::null_mut()
+}
+#[no_mangle]
+pub extern "C" fn pthread_setspecific(_key: ::pthread_key_t, _value: *const ::c_void) -> ::c_int {
+    0
+}
 // #[no_mangle]
 // pub extern "C" fn pthread_mutex_init(
 //     lock: *mut pthread_mutex_t,
@@ -1658,7 +1461,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
 // #[no_mangle]
 // pub extern "C" fn sigemptyset(set: *mut sigset_t) -> ::c_int{
@@ -1701,8 +1503,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[no_mangle]
 // pub extern "C" fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int{
 // 	unimplemented!()
@@ -2007,7 +1807,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn duplocale(base: ::locale_t) -> ::locale_t{
 // 	unimplemented!()
@@ -2175,13 +1974,11 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn pause() -> ::c_int{
 // 	unimplemented!()
@@ -2225,7 +2022,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int{
 // 	unimplemented!()
@@ -2240,7 +2036,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int{
 // 	unimplemented!()
@@ -2753,7 +2548,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn __errno_location() -> *mut ::c_int{
 // 	unimplemented!()
@@ -3018,7 +2812,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
 // #[no_mangle]
 // pub extern "C" fn remap_file_pages(
 // 	addr: *mut ::c_void,
@@ -3748,8 +3541,6 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // 	unimplemented!()
 // }
 
-
-
 // #[no_mangle]
 // pub extern "C" fn timer_create(
 // 	clockid: ::clockid_t,
@@ -3902,8 +3693,3 @@ pub extern "C" fn getrandom(buf: &mut [u8], flags: ::c_uint) -> ::ssize_t{
 // pub extern "C" fn atexit(cb: extern "C" fn()) -> ::c_int{
 //     unimplemented!()
 // }
-
-
-
-
-

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

@@ -1,11 +1,11 @@
 
 
-use crate::unix::platform::pal::{e,errno};
+use crate::unix::platform::pal::{e};
 use crate::unix::c_str::CStr;
 use crate::unix::*;
 use dsc::syscall;
 
-pub extern "C" fn utimens(path: &CStr, times: *const timespec) -> ::c_int {
+pub extern "C" fn utimens(_path: &CStr, _times: *const timespec) -> ::c_int {
 	// e(unsafe { syscall!(UTIMENSAT, AT_FDCWD, path.as_ptr(), times, 0) }) as ::c_int
 	unimplemented!()
 }
@@ -16,7 +16,7 @@ pub extern "C" fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> :
 }
 
 #[no_mangle]
-pub extern "C" fn access(path: *const ::c_char, amode: ::c_int) -> ::c_int{
+pub extern "C" fn access(_path: *const ::c_char, _amode: ::c_int) -> ::c_int{
 	unimplemented!()
 }
 
@@ -30,17 +30,17 @@ pub extern "C" fn chdir(dir: *const ::c_char) -> ::c_int{
 }
 
 #[no_mangle]
-pub extern "C" fn chmod(path: *const c_char, mode: mode_t) -> ::c_int{
+pub extern "C" fn chmod(_path: *const c_char, _mode: mode_t) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn chown(path: *const ::c_char, uid: uid_t, gid: gid_t) -> ::c_int{
+pub extern "C" fn chown(_path: *const ::c_char, _uid: uid_t, _gid: gid_t) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int{
+pub extern "C" fn clock_gettime(_clk_id: ::clockid_t, _tp: *mut ::timespec) -> ::c_int{
 	-ENOSYS
 }
 
@@ -82,27 +82,27 @@ pub extern "C" fn exit(status: ::c_int) -> !{
 }
 
 #[no_mangle]
-pub extern "C" fn fchdir(dirfd: ::c_int) -> ::c_int{
+pub extern "C" fn fchdir(_dirfd: ::c_int) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int{
+pub extern "C" fn fchmod(_fd: ::c_int, _mode: mode_t) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int{
+pub extern "C" fn fchown(_fd: ::c_int, _owner: ::uid_t, _group: ::gid_t) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int{
+pub extern "C" fn flock(_fd: ::c_int, _operation: ::c_int) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int{
+pub extern "C" fn fstatvfs(_fd: ::c_int, _buf: *mut statvfs) -> ::c_int{
 	unimplemented!()
 }
 
@@ -117,12 +117,12 @@ pub extern "C" fn fork() -> ::pid_t{
 }
 
 #[no_mangle]
-pub extern "C" fn fpath(filedes: ::c_int, name:*const ::c_char) -> c_long{
+pub extern "C" fn fpath(_filedes: ::c_int, _name:*const ::c_char) -> c_long{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn fsync(fd: ::c_int) -> ::c_int{
+pub extern "C" fn fsync(_fd: ::c_int) -> ::c_int{
 	0
 }
 
@@ -131,22 +131,22 @@ pub extern "C" fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int{
 	e(unsafe { syscall!(SYS_FTRUNCATE, fd, length) }) as ::c_int
 }
 
-pub extern "C" fn futex(addr: *mut ::c_int, op: ::c_int, val: ::c_int, val2: usize) -> ::c_int {
+pub extern "C" fn futex(_addr: *mut ::c_int, _op: ::c_int, _val: ::c_int, _val2: usize) -> ::c_int {
 	// unsafe { syscall!(FUTEX, addr, op, val, val2, 0, 0) as ::c_int }
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int{
+pub extern "C" fn futimens(_fd: ::c_int, _times: *const ::timespec) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
 pub extern "C" fn utimensat(
-	dirfd: ::c_int,
-	path: *const ::c_char,
-	times: *const ::timespec,
-	flag: ::c_int,
+	_dirfd: ::c_int,
+	_path: *const ::c_char,
+	_times: *const ::timespec,
+	_flag: ::c_int,
 ) -> ::c_int{
 	unimplemented!()
 }
@@ -171,9 +171,9 @@ pub extern "C" fn getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char{
 
 #[no_mangle]
 pub extern "C" fn getdents(
-    fd: ::c_int, 
-    dirents: *mut dirent, 
-    bytes: usize) -> ::c_int{
+    _fd: ::c_int, 
+    _dirents: *mut dirent, 
+    _bytes: usize) -> ::c_int{
         unimplemented!()
 }
 
@@ -198,7 +198,7 @@ pub extern "C" fn getpagesize() -> usize{
 }
 
 #[no_mangle]
-pub extern "C" fn getpgid(pid: ::pid_t) -> ::pid_t{
+pub extern "C" fn getpgid(_pid: ::pid_t) -> ::pid_t{
 	0
 }
 
@@ -213,12 +213,12 @@ pub extern "C" fn getppid() -> ::pid_t{
 }
 
 #[no_mangle]
-pub extern "C" fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int{
+pub extern "C" fn getrlimit(_resource: ::c_int, _rlim: *mut ::rlimit) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn getsid(pid: ::pid_t) -> ::pid_t{
+pub extern "C" fn getsid(_pid: ::pid_t) -> ::pid_t{
 	0
 }
 
@@ -238,12 +238,12 @@ pub extern "C" fn getuid() -> uid_t{
 }
 
 #[no_mangle]
-pub extern "C" fn lchown(path: *const ::c_char, uid: uid_t, gid: gid_t) -> ::c_int{
+pub extern "C" fn lchown(_path: *const ::c_char, _uid: uid_t, _gid: gid_t) -> ::c_int{
 	0
 }
 
 #[no_mangle]
-pub extern "C" fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int{
+pub extern "C" fn link(_src: *const ::c_char, _dst: *const ::c_char) -> ::c_int{
 	unimplemented!()
 }
 
@@ -258,17 +258,17 @@ 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{
+pub extern "C" fn mkfifo(_path: *const ::c_char, _mode: mode_t) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int{
+pub extern "C" fn mlock(_addr: *const ::c_void, _len: ::size_t) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn mlockall(flags: ::c_int) -> ::c_int{
+pub extern "C" fn mlockall(_flags: ::c_int) -> ::c_int{
 	unimplemented!()
 }
 
@@ -290,12 +290,12 @@ pub extern "C" fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) ->
 }
 
 #[no_mangle]
-pub extern "C" fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int{
+pub extern "C" fn msync(_addr: *mut ::c_void, _len: ::size_t, _flags: ::c_int) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int{
+pub extern "C" fn munlock(_addr: *const ::c_void, _len: ::size_t) -> ::c_int{
 	unimplemented!()
 }
 
@@ -329,7 +329,7 @@ pub extern "C" fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int{
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn pte_clone(stack: *mut usize) -> ::pid_t{
+pub unsafe extern "C" fn pte_clone(_stack: *mut usize) -> ::pid_t{
     unimplemented!()    
 }
 
@@ -338,12 +338,12 @@ pub extern "C" fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ss
 	e(unsafe { syscall!(SYS_READ, fd, buf, count) }) as ::ssize_t
 }
 
-pub extern "C" fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t{
+pub extern "C" fn readlink(_path: *const c_char, _buf: *mut c_char, _bufsz: ::size_t) -> ::ssize_t{
     unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn rename(oldname: *const ::c_char, newname: *const ::c_char) -> ::c_int{
+pub extern "C" fn rename(_oldname: *const ::c_char, _newname: *const ::c_char) -> ::c_int{
 	unimplemented!()
 }
 
@@ -358,32 +358,32 @@ pub extern "C" fn sched_yield() -> ::c_int{
 }
 
 #[no_mangle]
-pub extern "C" fn setpgid(pid: ::pid_t, pgid: ::pid_t) -> ::c_int{
+pub extern "C" fn setpgid(_pid: ::pid_t, _pgid: ::pid_t) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn setregid(rgid: gid_t, egid: gid_t) -> ::c_int{
+pub extern "C" fn setregid(_rgid: gid_t, _egid: gid_t) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn setreuid(ruid: uid_t, euid: uid_t) -> ::c_int{
+pub extern "C" fn setreuid(_ruid: uid_t, _euid: uid_t) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int{
+pub extern "C" fn symlink(_path1: *const ::c_char, _path2: *const ::c_char) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn umask(mask: mode_t) -> mode_t{
+pub extern "C" fn umask(_mask: mode_t) -> mode_t{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn uname(buf: *mut ::utsname) -> ::c_int{
+pub extern "C" fn uname(_buf: *mut ::utsname) -> ::c_int{
 	unimplemented!()
 }
 

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

@@ -1,24 +1,24 @@
-use crate::unix::platform::pal::{e,errno};
-use crate::unix::*;
-use dsc::syscall;
+
+
+
 #[no_mangle]
-pub extern "C" fn epoll_create1(flags: ::c_int) -> ::c_int{
+pub extern "C" fn epoll_create1(_flags: ::c_int) -> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event)
+pub extern "C" fn epoll_ctl(_epfd: ::c_int, _op: ::c_int, _fd: ::c_int, _event: *mut ::epoll_event)
 	-> ::c_int{
 	unimplemented!()
 }
 
 #[no_mangle]
 pub extern "C" fn epoll_pwait(
-	epfd: ::c_int,
-	events: *mut ::epoll_event,
-	maxevents: ::c_int,
-	timeout: ::c_int,
-	sigmask: *const ::sigset_t,
+	_epfd: ::c_int,
+	_events: *mut ::epoll_event,
+	_maxevents: ::c_int,
+	_timeout: ::c_int,
+	_sigmask: *const ::sigset_t,
 ) -> ::c_int{
 	unimplemented!()
 }

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

@@ -1,4 +1,4 @@
-use crate::unix::platform::pal::{e,errno};
+use crate::unix::platform::pal::{e};
 use mem;
 use crate::unix::*;
 use dsc::syscall;
@@ -6,7 +6,7 @@ use dsc::syscall;
 use stack_t;
 
 #[no_mangle]
-pub extern "C" fn getitimer(which: ::c_int, out: *mut ::itimerval) -> ::c_int {
+pub extern "C" fn getitimer(_which: ::c_int, _out: *mut ::itimerval) -> ::c_int {
 	// e(unsafe { syscall!(GETITIMER, which, out) }) as ::c_int
 	unimplemented!()
 }
@@ -33,12 +33,12 @@ pub extern "C" fn raise(sig: ::c_int) -> ::c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn setitimer(which: ::c_int, new: *const ::itimerval, old: *mut ::itimerval) -> ::c_int {
+pub extern "C" fn setitimer(_which: ::c_int, _new: *const ::itimerval, _old: *mut ::itimerval) -> ::c_int {
 	// e(unsafe { syscall!(SETITIMER, which, new, old) }) as ::c_int
 	unimplemented!()
 }
 
-use crate::unix::header::signal;
+
 #[no_mangle]
 pub extern "C" fn sigaction(
 	signum: ::c_int,
@@ -57,13 +57,13 @@ pub extern "C" fn sigaction(
 }
 
 #[no_mangle]
-pub extern "C" fn sigaltstack(ss: *const stack_t, old_ss: *mut stack_t) -> ::c_int {
+pub extern "C" fn sigaltstack(_ss: *const stack_t, _old_ss: *mut stack_t) -> ::c_int {
 	// e(unsafe { syscall!(SIGALTSTACK, ss, old_ss) }) as ::c_int
 	unimplemented!()
 }
 
 #[no_mangle]
-pub extern "C" fn sigprocmask(how: ::c_int, set: *const sigset_t, oset: *mut sigset_t) -> ::c_int {
+pub extern "C" fn sigprocmask(_how: ::c_int, _set: *const sigset_t, _oset: *mut sigset_t) -> ::c_int {
 	// e(unsafe { syscall!(RT_SIGPROCMASK, how, set, oset, mem::size_of::<sigset_t>()) }) as ::c_int
 	unimplemented!()
 }

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

@@ -1,6 +1,6 @@
 use crate::unix::*;
 use dsc::syscall;
-use crate::unix::platform::pal::{e,errno};
+use crate::unix::platform::pal::{e};
 use sockaddr;
 #[no_mangle]
 pub unsafe extern "C" fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int{
@@ -131,10 +131,10 @@ pub extern "C" fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c
 
 #[no_mangle]
 pub extern "C" fn socketpair(
-    domain: ::c_int,
-    type_: ::c_int,
-    protocol: ::c_int,
-    socket_vector: *mut ::c_int,
+    _domain: ::c_int,
+    _type_: ::c_int,
+    _protocol: ::c_int,
+    _socket_vector: *mut ::c_int,
 ) -> ::c_int{
 	unimplemented!()
 }

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

@@ -1,8 +1,8 @@
-use crate::unix::*;
-use dsc::syscall;
-use crate::unix::platform::pal::{e,errno};
+
+
+
 
 #[no_mangle]
-pub extern "C" fn ptrace(request: ::c_int) -> ::c_long{
+pub extern "C" fn ptrace(_request: ::c_int) -> ::c_long{
 	unimplemented!()
 }

+ 1 - 1
dlibc/src/unix/platform/mod.rs

@@ -2235,5 +2235,5 @@ pub fn init(auxvs: Box<[[usize; 2]]>) {
     }
 }
 #[cfg(not(target_os = "redox"))]
-pub fn init(auxvs: Box<[[usize; 2]]>) {}
+pub fn init(_auxvs: Box<[[usize; 2]]>) {}
 

+ 3 - 4
dlibc/src/unix/start.rs

@@ -2,12 +2,11 @@ use alloc::{boxed::Box, vec::Vec};
 use core::{fmt::Debug, intrinsics, ptr};
 use unix::platform::allocator::new_mspace;
 use crate::unix::{
-    header::{libgen, stdio, stdlib},
-    ld_so::{self, linker::Linker,init},
+    header::{libgen},
+    ld_so::{self, linker::Linker},
     platform::{self, get_auxvs},
     sync::mutex::Mutex,
     allocator::ALLOCATOR,
-    alloc,
 };
 
 #[repr(C)]
@@ -192,7 +191,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
 
     // Ensure correct host system before executing more system calls
     relibc_verify_host();
-    use core::arch::asm;
+    
 
     // Initialize TLS, if necessary
     ld_so::init(sp);

+ 1 - 1
dlibc/src/unix/sync/once.rs

@@ -30,7 +30,7 @@ impl<T> Once<T> {
         {
             UNINITIALIZED => {
                 // We now have a lock, let's initiate things!
-                let ret = unsafe { &mut *self.data.get() }.write(f());
+                let _ret = unsafe { &mut *self.data.get() }.write(f());
 
                 // Mark the data as initialized
                 if self.status.swap(INITIALIZED, SeqCst) == WAITING {

+ 3 - 0
src/lib.rs

@@ -97,6 +97,9 @@ extern crate memoffset;
 #[macro_use]
 extern crate dsc;
 
+#[macro_use]
+extern crate dlibc;
+
 pub mod std;
 pub use self::std::*;
 

+ 4 - 4
src/std/backtrace.rs

@@ -224,7 +224,7 @@ impl fmt::Debug for BacktraceSymbol {
 }
 
 impl fmt::Debug for BytesOrWide {
-    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
+    fn fmt(&self, _fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         // output_filename(
         //     fmt,
         //     match self {
@@ -313,7 +313,7 @@ impl Backtrace {
 
     // Capture a backtrace which start just before the function addressed by
     // `ip`
-    fn create(ip: usize) -> Backtrace {
+    fn create(_ip: usize) -> Backtrace {
         // let _lock = lock();
         // let mut frames = Vec::new();
         // let mut actual_start = None;
@@ -373,7 +373,7 @@ impl<'a> Backtrace {
 }
 
 impl fmt::Display for Backtrace {
-    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
+    fn fmt(&self, _fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         // let capture = match &self.inner {
         //     Inner::Unsupported => return fmt.write_str("unsupported backtrace"),
         //     Inner::Disabled => return fmt.write_str("disabled backtrace"),
@@ -423,7 +423,7 @@ impl fmt::Display for Backtrace {
 
 type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync + UnwindSafe;
 
-fn lazy_resolve(mut capture: Capture) -> LazyResolve {
+fn lazy_resolve(capture: Capture) -> LazyResolve {
     move || {
         // Use the global backtrace lock to synchronize this as it's a
         // requirement of the `backtrace` crate, and then actually resolve

+ 2 - 2
src/std/collections/hash/map.rs

@@ -2986,9 +2986,9 @@ impl DefaultHasher {
     /// This hasher is not guaranteed to be the same as all other
     /// `DefaultHasher` instances, but is the same as all other `DefaultHasher`
     /// instances created through `new` or `default`.
-        #[inline]
+    #[inline]
     #[allow(deprecated)]
-        #[must_use]
+    #[must_use]
     pub const fn new() -> DefaultHasher {
         DefaultHasher(SipHasher13::new_with_keys(0, 0))
     }

+ 0 - 1
src/std/io/impls.rs

@@ -1,4 +1,3 @@
-
 use crate::std::cmp;
 use crate::std::collections::VecDeque;
 use crate::std::fmt;

+ 1 - 2
src/std/os/fd/raw.rs

@@ -8,8 +8,7 @@ use crate::std::os::hermit::io::OwnedFd;
 use crate::std::os::raw;
 #[cfg(all(doc, not(target_arch = "wasm32")))]
 use crate::std::os::unix::io::AsFd;
-#[cfg(target_os = "dragonos")]
-use crate::std::os::unix::io::OwnedFd;
+
 #[cfg(unix)]
 use crate::std::os::unix::io::OwnedFd;
 #[cfg(target_os = "wasi")]

+ 1 - 1
src/std/os/linux/raw.rs

@@ -10,7 +10,7 @@
 #![allow(deprecated)]
 
 use crate::std::os::raw::c_ulong;
-use dlibc;
+
 
 pub type dev_t = u64;
 pub type mode_t = u32;

+ 7 - 8
src/std/os/mod.rs

@@ -142,16 +142,15 @@ pub mod vxworks;
 #[cfg(target_os = "watchos")]
 pub(crate) mod watchos;
 
-#[cfg(any(unix, target_os = "wasi", doc))]
+#[cfg(any(unix, target_os = "wasi", doc, target_os = "dragonos"))]
 pub mod fd;
-#[cfg(any(target_os = "linux", target_os = "android", doc))]
+#[cfg(any(
+    target_os = "linux",
+    target_os = "android",
+    target_os = "dragonos",
+    doc
+))]
 mod net;
 
-#[cfg(target_os = "dragonos")]
-pub mod fd;
 #[cfg(target_os = "dragonos")]
 pub mod linux;
-#[cfg(target_os = "dragonos")]
-mod net;
-#[cfg(target_os = "dragonos")]
-pub mod unix;

+ 1 - 1
src/std/os/unix/process.rs

@@ -9,7 +9,7 @@ use crate::std::process;
 use crate::std::sealed::Sealed;
 use crate::std::sys;
 use crate::std::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
-use dlibc;
+
 
 use cfg_if::cfg_if;
 

+ 1 - 1
src/std/panic.rs

@@ -1,7 +1,7 @@
 //! Panic support in the standard library.
 
 use crate::std::any::Any;
-use crate::std::collections;
+
 use crate::std::panicking;
 use crate::std::sync::atomic::{AtomicUsize, Ordering};
 use crate::std::sync::{Mutex, RwLock};

+ 11 - 12
src/std/panicking.rs

@@ -9,7 +9,7 @@
 
 #![deny(unsafe_op_in_unsafe_fn)]
 
-use crate::std::panic::BacktraceStyle;
+
 use core::panic::{BoxMeUp, Location, PanicInfo};
 
 use crate::std::any::Any;
@@ -17,15 +17,14 @@ use crate::std::fmt;
 use crate::std::intrinsics;
 use crate::std::mem::{self, ManuallyDrop};
 use crate::std::process;
-use crate::std::sync::atomic::{AtomicBool, Ordering};
+
 use crate::std::sync::{PoisonError, RwLock};
-use crate::std::sys::stdio::panic_output;
-use crate::std::sys_common::backtrace;
-use crate::std::sys_common::thread_info;
+
+
+
 use crate::std::thread;
 
-#[cfg(not(test))]
-use crate::std::io::set_output_capture;
+
 // make sure to use the stderr output configured
 // by libtest in the real copy of std
 #[cfg(test)]
@@ -239,7 +238,7 @@ fn default_hook(info: &PanicInfo<'_>) {
 /// The implementation of the default panic handler.
 ///
 /// It can also write the backtrace to a given `path`. This functionality is used only by `rustc`.
-pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::std::path::Path>) {
+pub fn panic_hook_with_disk_dump(_info: &PanicInfo<'_>, _path: Option<&crate::std::path::Path>) {
     // If this is a double panic, make sure that we print a backtrace
     // for this panic. Otherwise only print it if logging is enabled.
     // let backtrace = if info.force_no_backtrace() {
@@ -704,10 +703,10 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
 /// abort or unwind.
 fn rust_panic_with_hook(
     payload: &mut dyn BoxMeUp,
-    message: Option<&fmt::Arguments<'_>>,
-    location: &Location<'_>,
-    can_unwind: bool,
-    force_no_backtrace: bool,
+    _message: Option<&fmt::Arguments<'_>>,
+    _location: &Location<'_>,
+    _can_unwind: bool,
+    _force_no_backtrace: bool,
 ) -> ! {
     // let must_abort = panic_count::increase(true);
 

+ 3 - 1
src/std/path.rs

@@ -2125,7 +2125,9 @@ impl Path {
             // FIXME: Allow Redox prefixes
             self.has_root() || has_redox_scheme(self.as_u8_slice())
         } else {
-            self.has_root() && (cfg!(any(unix, target_os = "wasi", target_os = "dragonos")) || self.prefix().is_some())
+            self.has_root()
+                && (cfg!(any(unix, target_os = "wasi", target_os = "dragonos"))
+                    || self.prefix().is_some())
         }
     }
 

+ 1 - 1
src/std/sys/personality/mod.rs

@@ -29,7 +29,7 @@ cfg_if::cfg_if! {
         all(target_family = "windows", target_env = "gnu"),
         target_os = "psp",
         target_os = "solid_asp3",
-        all(target_family = "unix", not(target_os = "espidf"), not(target_os = "l4re")),
+        all(target_family = "unix", not(target_os = "espidf"), not(target_os = "l4re"), not(target_os = "dragonos")),
         all(target_vendor = "fortanix", target_env = "sgx"),
     ))] {
         mod gcc;

+ 1 - 1
src/std/sys/unix/args.rs

@@ -8,7 +8,7 @@
 use crate::std::ffi::OsString;
 use crate::std::fmt;
 use crate::std::vec;
-use dlibc;
+
 
 /// One-time global initialization.
 pub unsafe fn init(argc: isize, argv: *const *const u8) {

+ 4 - 4
src/std/sys/unix/process/process_unix.rs

@@ -1,6 +1,6 @@
 use crate::std::fmt;
-use crate::std::io::{self, Error, ErrorKind};
-use crate::std::mem;
+use crate::std::io::{self, ErrorKind};
+
 use crate::std::num::NonZeroI32;
 use crate::std::sys;
 use crate::std::sys::cvt;
@@ -70,8 +70,8 @@ cfg_if::cfg_if! {
 impl Command {
     pub fn spawn(
         &mut self,
-        default: Stdio,
-        needs_stdin: bool,
+        _default: Stdio,
+        _needs_stdin: bool,
     ) -> io::Result<(Process, StdioPipes)> {
         // const CLOEXEC_MSG_FOOTER: [u8; 4] = *b"NOEX";
 

+ 6 - 138
src/std/sys/unix/rand.rs

@@ -9,140 +9,6 @@ pub fn hashmap_random_keys() -> (u64, u64) {
 
     (u64::from_ne_bytes(key1), u64::from_ne_bytes(key2))
 }
-#[cfg(target_os = "dragonos")]
-mod imp {
-    use crate::std::fs::File;
-    use crate::std::io::Read;
-    use dlibc;
-
-    #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonos"))]
-    use crate::std::sys::weak::syscall;
-
-    #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonos"))]
-    fn getrandom(buf: &mut [u8]) -> dlibc::ssize_t {
-        use crate::std::sync::atomic::{AtomicBool, Ordering};
-        use crate::std::sys::os::errno;
-
-        // A weak symbol allows interposition, e.g. for perf measurements that want to
-        // disable randomness for consistency. Otherwise, we'll try a raw syscall.
-        // (`getrandom` was added in glibc 2.25, musl 1.1.20, android API level 28)
-        syscall! {
-            fn getrandom(
-                buffer: *mut dlibc::c_void,
-                length: dlibc::size_t,
-                flags: dlibc::c_uint
-            ) -> dlibc::ssize_t
-        }
-
-        // This provides the best quality random numbers available at the given moment
-        // without ever blocking, and is preferable to falling back to /dev/urandom.
-        static GRND_INSECURE_AVAILABLE: AtomicBool = AtomicBool::new(true);
-        if GRND_INSECURE_AVAILABLE.load(Ordering::Relaxed) {
-            let ret =
-                unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), dlibc::GRND_INSECURE) };
-            if ret == -1 && errno() as dlibc::c_int == dlibc::EINVAL {
-                GRND_INSECURE_AVAILABLE.store(false, Ordering::Relaxed);
-            } else {
-                return ret;
-            }
-        }
-
-        unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), dlibc::GRND_NONBLOCK) }
-    }
-
-    #[cfg(any(target_os = "espidf", target_os = "horizon"))]
-    fn getrandom(buf: &mut [u8]) -> dlibc::ssize_t {
-        unsafe { dlibc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
-    }
-
-    #[cfg(target_os = "freebsd")]
-    fn getrandom(buf: &mut [u8]) -> dlibc::ssize_t {
-        // FIXME: using the above when libary std's libc is updated
-        extern "C" {
-            fn getrandom(
-                buffer: *mut dlibc::c_void,
-                length: dlibc::size_t,
-                flags: dlibc::c_uint,
-            ) -> dlibc::ssize_t;
-        }
-        unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
-    }
-
-    #[cfg(not(any(
-        target_os = "linux",
-        target_os = "android",
-        target_os = "espidf",
-        target_os = "horizon",
-        target_os = "freebsd",
-        target_os = "dragonos"
-    )))]
-    fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
-        false
-    }
-
-    #[cfg(any(
-        target_os = "linux",
-        target_os = "android",
-        target_os = "espidf",
-        target_os = "horizon",
-        target_os = "freebsd",
-        target_os = "dragonos"
-    ))]
-    fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
-        use crate::std::sync::atomic::{AtomicBool, Ordering};
-        use crate::std::sys::os::errno;
-
-        static GETRANDOM_UNAVAILABLE: AtomicBool = AtomicBool::new(false);
-        if GETRANDOM_UNAVAILABLE.load(Ordering::Relaxed) {
-            return false;
-        }
-
-        let mut read = 0;
-        while read < v.len() {
-            let result = getrandom(&mut v[read..]);
-            if result == -1 {
-                let err = errno() as dlibc::c_int;
-                if err == dlibc::EINTR {
-                    continue;
-                } else if err == dlibc::ENOSYS || err == dlibc::EPERM {
-                    // Fall back to reading /dev/urandom if `getrandom` is not
-                    // supported on the current kernel.
-                    //
-                    // Also fall back in case it is disabled by something like
-                    // seccomp or inside of virtual machines.
-                    GETRANDOM_UNAVAILABLE.store(true, Ordering::Relaxed);
-                    return false;
-                } else if err == dlibc::EAGAIN {
-                    return false;
-                } else {
-                    panic!("unexpected getrandom error: {err}");
-                }
-            } else {
-                read += result as usize;
-            }
-        }
-        true
-    }
-
-    pub fn fill_bytes(v: &mut [u8]) {
-        // getrandom_fill_bytes here can fail if getrandom() returns EAGAIN,
-        // meaning it would have blocked because the non-blocking pool (urandom)
-        // has not initialized in the kernel yet due to a lack of entropy. The
-        // fallback we do here is to avoid blocking applications which could
-        // depend on this call without ever knowing they do and don't have a
-        // work around. The PRNG of /dev/urandom will still be used but over a
-        // possibly predictable entropy pool.
-        if getrandom_fill_bytes(v) {
-            return;
-        }
-
-        // getrandom failed because it is permanently or temporarily (because
-        // of missing entropy) unavailable. Open /dev/urandom, read from it,
-        // and close it again.
-        let mut file = File::open("/dev/urandom").expect("failed to open /dev/urandom");
-        file.read_exact(v).expect("failed to read /dev/urandom")
-    }
-}
 
 #[cfg(all(
     unix,
@@ -163,10 +29,10 @@ mod imp {
     use crate::std::io::Read;
     use dlibc;
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
+    #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonos"))]
     use crate::std::sys::weak::syscall;
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
+    #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonos"))]
     fn getrandom(buf: &mut [u8]) -> dlibc::ssize_t {
         use crate::std::sync::atomic::{AtomicBool, Ordering};
         use crate::std::sys::os::errno;
@@ -221,7 +87,8 @@ mod imp {
         target_os = "android",
         target_os = "espidf",
         target_os = "horizon",
-        target_os = "freebsd"
+        target_os = "freebsd",
+        target_os = "dragonos"
     )))]
     fn getrandom_fill_bytes(_buf: &mut [u8]) -> bool {
         false
@@ -232,7 +99,8 @@ mod imp {
         target_os = "android",
         target_os = "espidf",
         target_os = "horizon",
-        target_os = "freebsd"
+        target_os = "freebsd",
+        target_os = "dragonos"
     ))]
     fn getrandom_fill_bytes(v: &mut [u8]) -> bool {
         use crate::std::sync::atomic::{AtomicBool, Ordering};

+ 7 - 9
src/std/sys_common/backtrace.rs

@@ -1,14 +1,12 @@
 //use crate::std::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt};
-use crate::std::borrow::Cow;
-/// Common code for printing the backtrace in the same way across the different
-/// supported platforms.
-use crate::std::env;
-use crate::std::fmt;
-use crate::std::io;
-use crate::std::io::prelude::*;
-use crate::std::path::{self, Path, PathBuf};
+
+
+
+
+
+
 use crate::std::sync::{Mutex, PoisonError};
-use dlibc;
+
 
 /// Max number of frames to print.
 const MAX_NB_FRAMES: usize = 100;

+ 1 - 1
src/std/sys_common/thread_local_key.rs

@@ -52,7 +52,7 @@ mod tests;
 
 use crate::std::sync::atomic::{self, AtomicUsize, Ordering};
 use crate::std::sys::thread_local_key as imp;
-use dlibc;
+
 
 /// A type for TLS keys that are statically allocated.
 ///