Skip to content

Commit 441a2c6

Browse files
authored
Unrolled build for rust-lang#131774
Rollup merge of rust-lang#131774 - thesummer:rtems-add-getentropy, r=joboet Add getentropy for RTEMS RTEMS provides the `getentropy` function. Use this for providing random data. This PR enables the `getentropy` function for the RTEMS operating system to get random data. It is exposed via libc (see rust-lang/libc#3975).
2 parents acfdb8d + e20636a commit 441a2c6

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

library/std/src/random.rs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use crate::sys::random as sys;
4040
/// Horizon | `getrandom` shim
4141
/// Hurd, L4Re, QNX | `/dev/urandom`
4242
/// Redox | `/scheme/rand`
43+
/// RTEMS | [`arc4random_buf`](https://docs.rtems.org/branches/master/bsp-howto/getentropy.html)
4344
/// SGX | [`rdrand`](https://en.wikipedia.org/wiki/RDRAND)
4445
/// SOLID | `SOLID_RNG_SampleRandomBytes`
4546
/// TEEOS | `TEE_GenerateRandom`

library/std/src/sys/random/arc4random.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#[cfg(not(any(
1313
target_os = "haiku",
1414
target_os = "illumos",
15+
target_os = "rtems",
1516
target_os = "solaris",
1617
target_os = "vita",
1718
)))]
@@ -21,6 +22,7 @@ use libc::arc4random_buf;
2122
#[cfg(any(
2223
target_os = "haiku", // See https://git.haiku-os.org/haiku/tree/headers/compatibility/bsd/stdlib.h
2324
target_os = "illumos", // See https://www.illumos.org/man/3C/arc4random
25+
target_os = "rtems", // See https://docs.rtems.org/branches/master/bsp-howto/getentropy.html
2426
target_os = "solaris", // See https://docs.oracle.com/cd/E88353_01/html/E37843/arc4random-3c.html
2527
target_os = "vita", // See https://github.com/vitasdk/newlib/blob/b89e5bc183b516945f9ee07eef483ecb916e45ff/newlib/libc/include/stdlib.h#L74
2628
))]

library/std/src/sys/random/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cfg_if::cfg_if! {
1717
target_os = "illumos",
1818
target_os = "netbsd",
1919
target_os = "openbsd",
20+
target_os = "rtems",
2021
target_os = "solaris",
2122
target_os = "vita",
2223
))] {

0 commit comments

Comments
 (0)