File tree 2 files changed +8
-17
lines changed
2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ mod imp {
29
29
// A weak symbol allows interposition, e.g. for perf measurements that want to
30
30
// disable randomness for consistency. Otherwise, we'll try a raw syscall.
31
31
// (`getrandom` was added in glibc 2.25, musl 1.1.20, android API level 28)
32
- weak_syscall ! {
32
+ syscall ! {
33
33
fn getrandom(
34
34
buffer: * mut libc:: c_void,
35
35
length: libc:: size_t,
Original file line number Diff line number Diff line change @@ -92,26 +92,17 @@ macro_rules! syscall {
92
92
// (not paths).
93
93
use libc:: * ;
94
94
95
- syscall(
96
- concat_idents!( SYS_ , $name) ,
97
- $( $arg_name as c_long) ,*
98
- ) as $ret
99
- }
100
- )
101
- }
102
-
103
- /// Use a weak symbol from libc when possible, allowing `LD_PRELOAD` interposition,
104
- /// but if it's not found just use a raw syscall.
105
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
106
- macro_rules! weak_syscall {
107
- ( fn $name: ident( $( $arg_name: ident: $t: ty) ,* ) -> $ret: ty) => (
108
- unsafe fn $name( $( $arg_name: $t) ,* ) -> $ret {
109
95
weak! { fn $name( $( $t) ,* ) -> $ret }
96
+
97
+ // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
98
+ // interposition, but if it's not found just use a raw syscall.
110
99
if let Some ( fun) = $name. get( ) {
111
100
fun( $( $arg_name) ,* )
112
101
} else {
113
- syscall! { fn $name( $( $arg_name: $t) ,* ) -> $ret }
114
- $name( $( $arg_name) ,* )
102
+ syscall(
103
+ concat_idents!( SYS_ , $name) ,
104
+ $( $arg_name as c_long) ,*
105
+ ) as $ret
115
106
}
116
107
}
117
108
)
You can’t perform that action at this time.
0 commit comments