@@ -118,7 +118,7 @@ pub(crate) fn auxv() -> Result<AuxVec, ()> {
118
118
{
119
119
// If calling getauxval fails, try to read the auxiliary vector from
120
120
// its file:
121
- auxv_from_file ( "/proc/self/auxv" )
121
+ auxv_from_file ( "/proc/self/auxv" ) . map_err ( |_| ( ) )
122
122
}
123
123
#[ cfg( not( feature = "std_detect_file_io" ) ) ]
124
124
{
@@ -153,10 +153,13 @@ fn getauxval(key: usize) -> Result<usize, ()> {
153
153
Ok ( unsafe { ffi_getauxval ( key as libc:: c_ulong ) as usize } )
154
154
}
155
155
156
+ #[ cfg( feature = "std_detect_file_io" ) ]
157
+ use alloc:: string:: String ;
158
+
156
159
/// Tries to read the auxiliary vector from the `file`. If this fails, this
157
160
/// function returns `Err`.
158
161
#[ cfg( feature = "std_detect_file_io" ) ]
159
- pub ( super ) fn auxv_from_file ( file : & str ) -> Result < AuxVec , ( ) > {
162
+ pub ( super ) fn auxv_from_file ( file : & str ) -> Result < AuxVec , String > {
160
163
let file = super :: read_file ( file) ?;
161
164
162
165
// See <https://github.com/torvalds/linux/blob/v5.15/include/uapi/linux/auxvec.h>.
@@ -175,7 +178,7 @@ pub(super) fn auxv_from_file(file: &str) -> Result<AuxVec, ()> {
175
178
/// Tries to interpret the `buffer` as an auxiliary vector. If that fails, this
176
179
/// function returns `Err`.
177
180
#[ cfg( feature = "std_detect_file_io" ) ]
178
- fn auxv_from_buf ( buf : & [ usize ] ) -> Result < AuxVec , ( ) > {
181
+ fn auxv_from_buf ( buf : & [ usize ] ) -> Result < AuxVec , String > {
179
182
// Targets with only AT_HWCAP:
180
183
#[ cfg( any(
181
184
target_arch = "riscv32" ,
@@ -220,7 +223,7 @@ fn auxv_from_buf(buf: &[usize]) -> Result<AuxVec, ()> {
220
223
}
221
224
// Suppress unused variable
222
225
let _ = buf;
223
- Err ( ( ) )
226
+ Err ( String :: from ( "hwcap not found" ) )
224
227
}
225
228
226
229
#[ cfg( test) ]
0 commit comments