Skip to content

Introduce mmap_nofd to work around <F: AsFd>? #2126

Closed
@newpavlov

Description

@newpavlov

Today when I use nix's mmap for creating anonymous mappings I have to use mmap::<BorrowedFd>(...), which feels... quite awkward. It would be nice to have a variant of mmap with the following signature:

pub unsafe fn mmap_nofd(
    addr: Option<NonZeroUsize>,
    length: NonZeroUsize,
    prot: ProtFlags,
    flags: MapFlags,
) -> Result<*mut c_void>

The offset argument has meaning only for file-backed mappings, so we can remove it as well.

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