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:: prelude:: * ;
54use super :: xcoff;
65use super :: { Library , LibrarySegment } ;
76use alloc:: borrow:: ToOwned ;
87use alloc:: vec;
98use alloc:: vec:: Vec ;
10- use core:: ffi:: CStr ;
9+ use core:: ffi:: { c_int , CStr } ;
1110use core:: mem;
1211
1312const EXE_IMAGE_BASE : u64 = 0x100000000 ;
1413
14+ extern "C" {
15+ #[ link_name = "_Errno" ]
16+ fn errno_location ( ) -> * mut c_int ;
17+ }
18+
19+ fn errno ( ) -> i32 {
20+ unsafe { ( * errno_location ( ) ) as i32 }
21+ }
22+
1523/// On AIX, we use `loadquery` with `L_GETINFO` flag to query libraries mmapped.
1624/// See https://www.ibm.com/docs/en/aix/7.2?topic=l-loadquery-subroutine for
1725/// detailed information of `loadquery`.
@@ -28,15 +36,14 @@ pub(super) fn native_libraries() -> Vec<Library> {
2836 {
2937 break ;
3038 } else {
31- match Error :: last_os_error ( ) . raw_os_error ( ) {
32- Some ( libc:: ENOMEM ) => {
39+ match errno ( ) {
40+ libc:: ENOMEM => {
3341 buffer. resize ( buffer. len ( ) * 2 , mem:: zeroed :: < libc:: ld_info > ( ) ) ;
3442 }
35- Some ( _ ) => {
43+ _ => {
3644 // If other error occurs, return empty libraries.
3745 return Vec :: new ( ) ;
3846 }
39- _ => unreachable ! ( ) ,
4047 }
4148 }
4249 }
You can’t perform that action at this time.
0 commit comments