mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Polish getrandom()
backwards compatibility shim (#10757)
* Add changelog entry for the `getrandom()` backwards compatibility shim * Comment message pragma of the `getrandom()` backwards compatibility shim
This commit is contained in:
parent
40ffbb3641
commit
4ea5c352da
2 changed files with 19 additions and 1 deletions
19
changelog/emulate_getrandom.dd
Normal file
19
changelog/emulate_getrandom.dd
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
`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.
|
|
@ -1782,7 +1782,6 @@ version (linux)
|
||||||
|
|
||||||
`getrandom()` was added to the GNU C Library in v2.25.
|
`getrandom()` was added to the GNU C Library in v2.25.
|
||||||
+/
|
+/
|
||||||
pragma(msg, "`getrandom()` emulation for legacy Linux targets is enabled.");
|
|
||||||
|
|
||||||
/+
|
/+
|
||||||
On modern kernels (5.6+), `/dev/random` would behave more similar
|
On modern kernels (5.6+), `/dev/random` would behave more similar
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue