phobos/changelog/emulate_getrandom.dd
Elias Batek 4ea5c352da
Polish getrandom() backwards compatibility shim (#10757)
* Add changelog entry for the `getrandom()` backwards compatibility shim

* Comment message pragma of the `getrandom()` backwards compatibility shim
2025-04-22 06:32:45 +08:00

19 lines
767 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

`getrandom()` backwards compatibility shim
To restore compatibility with older Linux platforms where `getrandom()` is
unavailable either due to an outdated kernel or a legacy C library, Phobos now
ships with a shim that emulates a limited subset of `getrandom()`s behavior
by reading random bytes from `/dev/urandom`.
To enable the shim, build DMD and Phobos with the environment variable
`LINUX_LEGACY_EMULATE_GETRANDOM` set to `1`.
```
cd phobos
LINUX_LEGACY_EMULATE_GETRANDOM=1 make
```
This functionality is a temporary fix and expected to be removed again soon
by an upcoming release (approx. v2.112.0 or v2.113.0).
The expected change is to replace the current “binding or shim” solution with
a syscall wrapper and automatic `/dev/urandom` fallback.