Skip to content

Commit c271bff

Browse files
tamirdtgross35
authored andcommitted
musl: enable getrandom on all musl platforms
The existing bindings were added in rust-lang#1399 and limited to targets where rustc used musl version >= 1.1.20 which was not all musl targets at that time. Since rust-lang/rust#107129 all musl targets use musl 1.2.3. Hence, move the binding to the module root so it is available for all musl targets. (backport <rust-lang#4346>) (cherry picked from commit 77d3011)
1 parent 5a1f5f2 commit c271bff

File tree

5 files changed

+3
-16
lines changed

5 files changed

+3
-16
lines changed

src/unix/linux_like/linux/musl/b32/arm/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,3 @@ pub const SYS_process_mrelease: c_long = 448;
795795
pub const SYS_futex_waitv: c_long = 449;
796796
pub const SYS_set_mempolicy_home_node: c_long = 450;
797797
pub const SYS_mseal: c_long = 462;
798-
799-
extern "C" {
800-
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
801-
}

src/unix/linux_like/linux/musl/b32/powerpc.rs

-4
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,3 @@ pub const SYS_process_mrelease: c_long = 448;
745745
pub const SYS_futex_waitv: c_long = 449;
746746
pub const SYS_set_mempolicy_home_node: c_long = 450;
747747
pub const SYS_mseal: c_long = 462;
748-
749-
extern "C" {
750-
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
751-
}

src/unix/linux_like/linux/musl/b32/x86/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,3 @@ pub const CS: c_int = 13;
913913
pub const EFL: c_int = 14;
914914
pub const UESP: c_int = 15;
915915
pub const SS: c_int = 16;
916-
917-
extern "C" {
918-
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
919-
}

src/unix/linux_like/linux/musl/b64/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
8181
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
8282
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
8383

84-
extern "C" {
85-
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
86-
}
87-
8884
cfg_if! {
8985
if #[cfg(target_arch = "aarch64")] {
9086
mod aarch64;

src/unix/linux_like/linux/musl/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,9 @@ extern "C" {
971971
pub fn dirname(path: *mut c_char) -> *mut c_char;
972972
pub fn basename(path: *mut c_char) -> *mut c_char;
973973

974+
// Addded in `musl` 1.1.20
975+
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
976+
974977
// Added in `musl` 1.1.24
975978
pub fn posix_spawn_file_actions_addchdir_np(
976979
actions: *mut crate::posix_spawn_file_actions_t,

0 commit comments

Comments
 (0)