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

2017-09-14 Thread Eduardo Horvath
On Thu, 14 Sep 2017, Martin Husemann wrote: > On Thu, Sep 14, 2017 at 02:31:29PM +0200, Thomas Klausner wrote: > > kp = kvm_getproc2(kvmp, KERN_PROC_PID, pid, sizeof(*kp), &res); > > if (res != 1) > > exit(1); > > if (kp->p_flag & P_32) > printf("it is a 32

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

2017-09-14 Thread Martin Husemann
On Thu, Sep 14, 2017 at 02:31:29PM +0200, Thomas Klausner wrote: > kp = kvm_getproc2(kvmp, KERN_PROC_PID, pid, sizeof(*kp), &res); > if (res != 1) > exit(1); if (kp->p_flag & P_32) printf("it is a 32bit process\n"); Unless you are running with a 3

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

2017-09-14 Thread Thomas Klausner
On Sat, Sep 09, 2017 at 05:58:53AM +1000, Matthew Green wrote: > > In a cross-platform process utility tool the question came up how to > > decide if a process is 64-bit. > > > > https://github.com/giampaolo/psutil/issues/1102 > > > > What's the best answer for NetBSD? > > in C: > > internally,

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

2017-09-10 Thread matthew green
Thor Lancelot Simon writes: > On Sun, Sep 10, 2017 at 03:29:22PM +, paul.kon...@dell.com wrote: > > > > MIPS has four ABIs, if you include "O64". Whether a particular OS allows > > all four concurrently is another matter; it isn't clear that would make > > sense. Mixing "O" and "N" ABIs is r

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

2017-09-10 Thread Thor Lancelot Simon
On Sun, Sep 10, 2017 at 03:29:22PM +, paul.kon...@dell.com wrote: > > MIPS has four ABIs, if you include "O64". Whether a particular OS allows > all four concurrently is another matter; it isn't clear that would make > sense. Mixing "O" and "N" ABIs is rather messy. > > Would you call N32 a

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

2017-09-10 Thread Paul.Koning
> On Sep 10, 2017, at 10:31 AM, Thor Lancelot Simon wrote: > > On Fri, Sep 08, 2017 at 07:38:24AM -0400, Mouse wrote: >>> In a cross-platform process utility tool the question came up how to >>> decide if a process is 64-bit. >> >> First, I have to ask: what does it mean to say that a particula

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

2017-09-10 Thread Kamil Rytarowski
On 10.09.2017 16:31, Thor Lancelot Simon wrote: > On Fri, Sep 08, 2017 at 07:38:24AM -0400, Mouse wrote: >>> In a cross-platform process utility tool the question came up how to >>> decide if a process is 64-bit. >> >> First, I have to ask: what does it mean to say that a particular >> process is -

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

2017-09-10 Thread Thor Lancelot Simon
On Fri, Sep 08, 2017 at 07:38:24AM -0400, Mouse wrote: > > In a cross-platform process utility tool the question came up how to > > decide if a process is 64-bit. > > First, I have to ask: what does it mean to say that a particular > process is - or isn't - 64-bit? I think the only simple answer

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

2017-09-09 Thread Martin Husemann
On Sat, Sep 09, 2017 at 07:41:55AM +1000, matthew green wrote: > eeh - matt@ fixed mount compat a few years ago, as well as a lot > of the remaining edge cases we'd never gotten to. it was necessary > to run full n32 userland on n64 kernel (we still build all the > kvm-on-running-kernel-using prog

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

2017-09-08 Thread Terry Moore
Hi, > In a cross-platform process utility tool the question came up how to decide if a process is 64-bit. > > https://github.com/giampaolo/psutil/issues/1102 > > What's the best answer for NetBSD? If I understand correctly, you want psutil-based scripts -- which seem to be written in Python -- t

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

2017-09-08 Thread matthew green
> > In addition to amd64/i386, it occurs to me that sparc64/sparc32 is > > another case; IIRC it's possible to take sparc64 hardware and build a > > (special? not sure) kernel that runs sparc32 userland. I've never > > tried it; I don't know whether sparc32 and sparc64 are as freely > > mixable at

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

2017-09-08 Thread Mouse
> That's why I asked "what does 'is 64-bit' mean". Your previous reference to$ Any particular reason for the paragraph-length line? Manually repairing it (and trimming to the part I'm replying to), > [...] the question "does this program use 64 bit addresses". There > are at least two other po

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

2017-09-08 Thread Eduardo Horvath
On Fri, 8 Sep 2017, Mouse wrote: > >> ([...] on most "64-bit" ports, a real question on amd64 (and others, > >> if any) which support 32-bit userland.) > > actually -- our mips64 ports largely use N32 userland, which is 64 > > bit registers and 32 bit addresses. > > Oh! Thank you. Yes, that's a

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

2017-09-08 Thread Mouse
>> ([...] on most "64-bit" ports, a real question on amd64 (and others, >> if any) which support 32-bit userland.) > actually -- our mips64 ports largely use N32 userland, which is 64 > bit registers and 32 bit addresses. Oh! Thank you. Yes, that's an interesting case. In addition to amd64/i386

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

2017-09-08 Thread Paul.Koning
> On Sep 8, 2017, at 4:00 PM, matthew green wrote: > >> Is the answer "it's using an ISA with 64-bit registers and addresses"? >> This actually can be broken down into the "registers" and "addresses" >> portion, but, in practice, the two tend to go together. (Always true >> on most "64-bit" por

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

2017-09-08 Thread matthew green
> Is the answer "it's using an ISA with 64-bit registers and addresses"? > This actually can be broken down into the "registers" and "addresses" > portion, but, in practice, the two tend to go together. (Always true > on most "64-bit" ports, a real question on amd64 (and others, if any) > which su

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

2017-09-08 Thread matthew green
> In a cross-platform process utility tool the question came up how to > decide if a process is 64-bit. > > https://github.com/giampaolo/psutil/issues/1102 > > What's the best answer for NetBSD? in C: internally, just check #ifdef _LP64. externally, kvm_getprocs() with KERN_PROC_PID. in other

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

2017-09-08 Thread Paul.Koning
> On Sep 8, 2017, at 6:55 AM, Thomas Klausner wrote: > > Hi! > > In a cross-platform process utility tool the question came up how to > decide if a process is 64-bit. > > https://github.com/giampaolo/psutil/issues/1102 I wonder: "in what sense"? 1. Capable of doing arithmetic on 64 bit value

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

2017-09-08 Thread Martin Husemann
On Fri, Sep 08, 2017 at 01:13:44PM +, Christos Zoulas wrote: > If you can attach to it with ktrace, the first record is an emul record. > If you have procfs cat /proc//emul Yeah, but it would be interesting to see in something like kprocinfo2 (easily fetchable via sysctl or the kvm wrapper).

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

2017-09-08 Thread Christos Zoulas
In article <20170908115647.ga29...@mail.duskware.de>, Martin Husemann 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 wou

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

2017-09-08 Thread Mouse
>> First, I have to ask: what does it mean to say that a particular >> process is - or isn't - 64-bit? > Many 64-bit ports support running 32-bit applications > (compat_netbsd32, compat_linux32). Exactly. Is the answer "it can do arithmetic on 64-bit values"? (Most - all, I think - NetBSD ports

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

2017-09-08 Thread Thomas Klausner
On Fri, Sep 08, 2017 at 07:38:24AM -0400, Mouse wrote: > First, I have to ask: what does it mean to say that a particular > process is - or isn't - 64-bit? Many 64-bit ports support running 32-bit applications (compat_netbsd32, compat_linux32). Thomas

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

2017-09-08 Thread Martin Husemann
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

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

2017-09-08 Thread coypu
At the risk of making people angry, this answer works for linux and netbsd: $ file -L /proc/self/exe /proc/self/exe: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 8.99.2, not stripped

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

2017-09-08 Thread Mouse
> In a cross-platform process utility tool the question came up how to > decide if a process is 64-bit. First, I have to ask: what does it mean to say that a particular process is - or isn't - 64-bit? I started to write that on most of the 64-bit-supporting ports there isn't even any question, bu

how to tell if a process is 64-bit

2017-09-08 Thread Thomas Klausner
Hi! In a cross-platform process utility tool the question came up how to decide if a process is 64-bit. https://github.com/giampaolo/psutil/issues/1102 What's the best answer for NetBSD? Thomas