Reputation: 161
I have to work with the address size of 32-bit and 64-bit processes inside the Linux kernel on x86_64. The possibility to treat with this that I'm currently using is checking task-specific flags. But I was wondering if there is an easier way to determine the address size of a process.
So, what's the proper and easiest way to retrieve the address size of a process within the Linux kernel?
Upvotes: 2
Views: 338
Reputation: 25119
Open /proc/self/maps
and parse for the [vsyscall]
entry. A 64 bit process will have a 64 bit address, e.g.:
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
A 32 bit process won't. I don't have a 32 bit process on hand to provide an example, but it won't have a 64 bit address.
Upvotes: 1