Skip to content

Commit

Permalink
Process: Correct AUXV to support 64bit Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Doron <jond@wiz.io>
  • Loading branch information
arilou committed Jul 5, 2022
1 parent b9f32af commit 4d1f812
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ use std::ffi::OsStr;
use std::ffi::OsString;
use std::fs::read_link;
use std::io::{self, Read};
use std::mem;
use std::os::unix::ffi::OsStringExt;
use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;
Expand Down Expand Up @@ -1103,7 +1104,7 @@ impl Process {
/// Get the process's auxiliary vector
///
/// (since 2.6.0-test7)
pub fn auxv(&self) -> ProcResult<HashMap<u32, u32>> {
pub fn auxv(&self) -> ProcResult<HashMap<u64, u64>> {
use byteorder::{NativeEndian, ReadBytesExt};

let mut file = FileWrapper::open_at(&self.root, &self.fd, "auxv")?;
Expand All @@ -1119,8 +1120,8 @@ impl Process {
let mut file = std::io::Cursor::new(buf);

loop {
let key = file.read_u32::<NativeEndian>()?;
let value = file.read_u32::<NativeEndian>()?;
let key = file.read_uint::<NativeEndian>(mem::size_of::<usize>())? as u64;
let value = file.read_uint::<NativeEndian>(mem::size_of::<usize>())? as u64;
if key == 0 && value == 0 {
break;
}
Expand Down

0 comments on commit 4d1f812

Please sign in to comment.