File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
//@only-target: android # prctl is currently supported for Android only
2
2
use std:: ffi:: CStr ;
3
3
use std:: ffi:: CString ;
4
+ use libc:: c_char;
4
5
5
6
fn main ( ) {
6
7
let long_name = CString :: new (
@@ -24,7 +25,7 @@ fn main() {
24
25
fn set_thread_name ( name : & CStr ) -> i32 {
25
26
cfg_if:: cfg_if! {
26
27
if #[ cfg( any( target_os = "android" ) ) ] {
27
- unsafe { libc:: prctl( libc:: PR_SET_NAME , name. as_ptr( ) . cast( ) ) }
28
+ unsafe { libc:: prctl( libc:: PR_SET_NAME , name. as_ptr( ) . cast:: < * const c_char> ( ) ) }
28
29
} else {
29
30
compile_error!( "set_thread_name not supported for this OS" )
30
31
}
@@ -37,7 +38,7 @@ fn get_thread_name(name: &mut [u8]) -> i32 {
37
38
target_os = "android" ,
38
39
) ) ] {
39
40
unsafe {
40
- libc:: prctl( libc:: PR_GET_NAME , name. as_mut_ptr( ) . cast( ) )
41
+ libc:: prctl( libc:: PR_GET_NAME , name. as_mut_ptr( ) . cast:: < * mut c_char> ( ) )
41
42
}
42
43
} else {
43
44
compile_error!( "get_thread_name not supported for this OS" )
You can’t perform that action at this time.
0 commit comments