+
Skip to content

Change recv_fds to use OwnedFd instead of RawFd #27

@rukai

Description

@rukai

From my reading of from_raw_fd and the IO safety rules we should be able to change UnixSeqPacketConn::recv_fds to return an OwnedFd instead of RawFd.

The IO safety rules specifically calls out: "Note that exclusive ownership of a file descriptor does not imply exclusive ownership of the underlying kernel object that the file descriptor references".
And when using SCM_RIGHTS ancillary data, the kernel assigns the receiving process a new FD pointing to the same kernel object as the original processes FD.

Making this change would allow users to make use of the received FDs without needing to call unsafe functions.

I am happy to provide a PR if you agree with this change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载