File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -62,17 +62,23 @@ mod imp {
6262 unsafe { getrandom ( buf. as_mut_ptr ( ) . cast ( ) , buf. len ( ) , libc:: GRND_NONBLOCK ) }
6363 }
6464
65- #[ cfg( any(
66- target_os = "espidf" ,
67- target_os = "horizon" ,
68- target_os = "freebsd" ,
69- target_os = "dragonfly" ,
70- netbsd10
71- ) ) ]
65+ #[ cfg( any( target_os = "espidf" , target_os = "horizon" , target_os = "freebsd" , netbsd10) ) ]
7266 fn getrandom ( buf : & mut [ u8 ] ) -> libc:: ssize_t {
7367 unsafe { libc:: getrandom ( buf. as_mut_ptr ( ) . cast ( ) , buf. len ( ) , 0 ) }
7468 }
7569
70+ #[ cfg( target_os = "dragonfly" ) ]
71+ fn getrandom ( buf : & mut [ u8 ] ) -> libc:: ssize_t {
72+ extern "C" {
73+ fn getrandom (
74+ buf : * mut libc:: c_void ,
75+ buflen : libc:: size_t ,
76+ flags : libc:: c_uint ,
77+ ) -> libc:: ssize_t ;
78+ }
79+ unsafe { getrandom ( buf. as_mut_ptr ( ) . cast ( ) , buf. len ( ) , 0 ) }
80+ }
81+
7682 #[ cfg( not( any(
7783 target_os = "linux" ,
7884 target_os = "android" ,
You can’t perform that action at this time.
0 commit comments