Skip to content

Implement libstd HashMap seeding on OS X #686

Closed
rust-lang/rust
#60156
@Aaron1011

Description

@Aaron1011

PR #683 implemented support for random number generation on Windows and (relatively recent) Linux. This was accomplished by implementing RtlGenRandom and getrandom for Windows and Linux respectively.

For OS X (and other Unix systems without getrandom), implementing random number generation is significantly more complicated. We need to implement the following:

  • Calling open/openat with /dev/random and /dev/urandom
  • Calling read and close on the 'file descriptor' created above.

On Linux, file descriptors appear to be assigned sequentially. However, I don't believe that anything actually guarantees this - in other words, this could potentially be considered a source of non-determinism.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macArea: Affects only macOS targetsA-shimsArea: This affects the external function shimsC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions