From e5997cf828e22a3cacb0cd50bde8680ad9f114ec Mon Sep 17 00:00:00 2001 From: Connor-GH Date: Fri, 23 Jan 2026 15:52:54 -0600 Subject: [PATCH] unistd/mod.rs: implement posix_close This is a valid implementation according to POSIX, as long as we do not support `POSIX_CLOSE_RESTART`. --- src/header/unistd/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs index 861f373fa8..f014f4d632 100644 --- a/src/header/unistd/mod.rs +++ b/src/header/unistd/mod.rs @@ -812,10 +812,14 @@ pub unsafe extern "C" fn pipe2(fildes: *mut c_int, flags: c_int) -> c_int { .or_minus_one_errno() } -/// See . -// #[unsafe(no_mangle)] +/// See . +#[unsafe(no_mangle)] pub extern "C" fn posix_close(fildes: c_int, flag: c_int) -> c_int { - unimplemented!(); + // Since we do not define `POSIX_CLOSE_RESTART`, this function is + // equivalent to `close`. In the future when we move file descriptors + // to userspace, it would only make sense to define `POSIX_CLOSE_RESTART` + // if `close` is not atomic. + close(fildes) } /// See .