# Function rustix::io::close

source · [−]

    pub unsafe fn close(raw_fd: RawFd)

Expand description

`close(raw_fd)`—Closes a `RawFd` directly.

Most users won’t need to use this, as `OwnedFd` automatically closes its file descriptor on `Drop`.

This function does not return a `Result`, as it is the responsibility of filesystem designers to not return errors from `close`. Users who chose to use NFS or similar filesystems should take care to monitor for problems externally.

## References

- POSIX
- Linux
- Apple
- Winsock2

## Safety

This function takes a `RawFd`, which must be valid before the call, and is not valid after the call.