File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
use super :: mystd:: env;
2
2
use super :: mystd:: ffi:: OsStr ;
3
- use super :: mystd:: io:: Error ;
4
3
use super :: mystd:: os:: unix:: ffi:: OsStrExt ;
5
4
use super :: xcoff;
6
5
use super :: { Library , LibrarySegment , Vec } ;
7
6
use alloc:: borrow:: ToOwned ;
8
7
use alloc:: vec;
9
- use core:: ffi:: CStr ;
8
+ use core:: ffi:: { c_int , CStr } ;
10
9
use core:: mem;
11
10
12
11
const EXE_IMAGE_BASE : u64 = 0x100000000 ;
13
12
13
+ extern "C" {
14
+ #[ link_name = "_Errno" ]
15
+ fn errno_location ( ) -> * mut c_int ;
16
+ }
17
+
18
+ fn errno ( ) -> i32 {
19
+ unsafe { ( * errno_location ( ) ) as i32 }
20
+ }
21
+
14
22
/// On AIX, we use `loadquery` with `L_GETINFO` flag to query libraries mmapped.
15
23
/// See https://www.ibm.com/docs/en/aix/7.2?topic=l-loadquery-subroutine for
16
24
/// detailed information of `loadquery`.
@@ -27,15 +35,14 @@ pub(super) fn native_libraries() -> Vec<Library> {
27
35
{
28
36
break ;
29
37
} else {
30
- match Error :: last_os_error ( ) . raw_os_error ( ) {
31
- Some ( libc:: ENOMEM ) => {
38
+ match errno ( ) {
39
+ libc:: ENOMEM => {
32
40
buffer. resize ( buffer. len ( ) * 2 , mem:: zeroed :: < libc:: ld_info > ( ) ) ;
33
41
}
34
- Some ( _ ) => {
42
+ _ => {
35
43
// If other error occurs, return empty libraries.
36
44
return Vec :: new ( ) ;
37
45
}
38
- _ => unreachable ! ( ) ,
39
46
}
40
47
}
41
48
}
You can’t perform that action at this time.
0 commit comments