Skip to content

Want way to get BorrowedFd<'static> for 0 1 2 #90809

Closed
@ijackson

Description

@ijackson

Logically, stdin stdout and stderr are global static file descriptors. Everyone in the program is entitled to assume they exist (this is logically implied, for example, by the contract of io::stdin()). No-one can own (and therefore drop) them.

IOW there should be a safe way to do

  unsafe { BorrowedFd::borrow_raw_fd::<'static>(0) }

Relates to #87074 (IO safety tracking issue) and I am tripping over it in my #88561 (Command redirection) work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions