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 11use super :: mystd:: env;
22use super :: mystd:: ffi:: OsStr ;
3- use super :: mystd:: io:: Error ;
43use super :: mystd:: os:: unix:: ffi:: OsStrExt ;
54use super :: xcoff;
65use super :: { Library , LibrarySegment , Vec } ;
76use alloc:: borrow:: ToOwned ;
87use alloc:: vec;
9- use core:: ffi:: CStr ;
8+ use core:: ffi:: { c_int , CStr } ;
109use core:: mem;
1110
1211const EXE_IMAGE_BASE : u64 = 0x100000000 ;
1312
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+
1422/// On AIX, we use `loadquery` with `L_GETINFO` flag to query libraries mmapped.
1523/// See https://www.ibm.com/docs/en/aix/7.2?topic=l-loadquery-subroutine for
1624/// detailed information of `loadquery`.
@@ -27,15 +35,14 @@ pub(super) fn native_libraries() -> Vec<Library> {
2735 {
2836 break ;
2937 } else {
30- match Error :: last_os_error ( ) . raw_os_error ( ) {
31- Some ( libc:: ENOMEM ) => {
38+ match errno ( ) {
39+ libc:: ENOMEM => {
3240 buffer. resize ( buffer. len ( ) * 2 , mem:: zeroed :: < libc:: ld_info > ( ) ) ;
3341 }
34- Some ( _ ) => {
42+ _ => {
3543 // If other error occurs, return empty libraries.
3644 return Vec :: new ( ) ;
3745 }
38- _ => unreachable ! ( ) ,
3946 }
4047 }
4148 }
You can’t perform that action at this time.
0 commit comments