tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: how to tell if a process is 64-bit



In article <20170908115647.GA29135%mail.duskware.de@localhost>,
Martin Husemann  <martin%duskware.de@localhost> wrote:
>On Fri, Sep 08, 2017 at 12:55:37PM +0200, Thomas Klausner wrote:
>> What's the best answer for NetBSD?
>
>If the kernel is 64bit:
>kvm_getproc2() and check the process flags for P_32.
>
>If not: all of them ;-}
>
>I would find it more interesting to answer "what is the emulation it runs
>under", so you have, say: netbsd native x86_64 processes, netbsd_compat32 
>i386 processes, 32 bit linux, 64 bit linux, .... (but I don't know an
>easy answer for that).

If you can attach to it with ktrace, the first record is an emul record.
If you have procfs cat /proc/<pid>/emul

christos



Home | Main Index | Thread Index | Old Index