Skip to content

Replacing RawFd with OwnedFd for compatibility with nix crate#26

Open
eesekaj wants to merge 14 commits intotormol:masterfrom
eesekaj:master
Open

Replacing RawFd with OwnedFd for compatibility with nix crate#26
eesekaj wants to merge 14 commits intotormol:masterfrom
eesekaj:master

Conversation

@eesekaj
Copy link

@eesekaj eesekaj commented Oct 28, 2024

Hello,

Please find attached a pull request where the following changes were made:

  1. RawFd was replaced in favor of OwnedFd. The nix crate is no longer accepts the RawFd as argument and requires the BorrowedFd to be passed as argument.
    OwnedFd is:

An owned file descriptor.

This closes the file descriptor on drop. It is guaranteed that nobody else will close the file descriptor.

This uses repr(transparent) and has the representation of a host file descriptor, so it can be used in FFI in places where a file descriptor is passed as a consumed argument or returned as an owned value, and it never has the value -1.

You can use AsFd::as_fd to obtain a BorrowedFd.

  1. Updated the crates versions. This is not necessary, but this crate forces to download additional dependencies.
  2. Added a function "send_flags" in "UnixSeqpacketConn". + impl AsFd and commented out the impl Drop (as OwnedFd should close the socket).
  3. Removed unused import.

Tested with default features on GNU/Linux.

2) Updated crates version.
3)Removed unused deps
…o stale status. Moved to Rust 2024 Added OwnedFd and BorrowedFd to comply with Rust specifications. Removed MIO and Tokio. Use AsyncFD and implement MIO for the type youself. (Maybe MIO will be readded later).
…: AncillaryBuf was left untouch, the FdSlice was removed, the AncillaryItem::Fds now returns OwnedFd. FreeBSD 15 does not pass some tests, the behaviour is different. Need investigation
…ates strange behaviour with message trancation and empty messages which

is not compatiable Linux and FreeBSD 14. send_ancillary() memory managment modified
…dFd. Functions which performs conversion from OwnedFd to Self perform check of the socket type. `NonblockingUnixSeqpacketListener` and `NonblockingUnixSeqpacketConn` is now have inside an instance of `UnixSeqpacketConn` and `UnixSeqpacketListener` respectivly which is set to non-blocking. Reorganised some functions
…gUnixSeqpacketListener`. Fixed `address already in use` problems in docs.
…te can be used on Windows to utilize the `UnixSocketAddr`. Added experimental support for unixstream in Windows i.e AF_UNIX SOCK_STREAM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant