Browse Source

Add dirfd

Jeremy Soller 4 years ago
parent
commit
d1ee653b5c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/header/dirent/mod.rs

+ 5 - 0
src/header/dirent/mod.rs

@@ -68,6 +68,11 @@ pub unsafe extern "C" fn closedir(dir: *mut DIR) -> c_int {
     ret
 }
 
+#[no_mangle]
+pub unsafe extern "C" fn dirfd(dir: *mut DIR) -> c_int {
+    *((*dir).file)
+}
+
 #[no_mangle]
 pub unsafe extern "C" fn readdir(dir: *mut DIR) -> *mut dirent {
     if (*dir).index >= (*dir).len {