Re: Determine if other process is running 32 or 64 bits
Re: Determine if other process is running 32 or 64 bits
- Subject: Re: Determine if other process is running 32 or 64 bits
- From: Jerry Krinock <email@hidden>
- Date: Wed, 16 Feb 2011 15:59:31 -0800
On 2011 Feb 16, at 12:05, Ken Thomases wrote:
> If it's actually an application, and you can target 10.6, use -[NSRunningApplication executableArchitecture].
Thanks, but need 10.5 support.
> Otherwise, you can use sysctl() as illustrated in this Tech Q&A <http://developer.apple.com/library/mac/#qa/qa2001/qa1123.html>. Somewhere in the kinfo_proc is the flag you're looking for.
Maybe, but if so it's not documented:
struct kinfo_proc {
struct extern_proc kp_proc; /* proc structure */
struct eproc {
struct proc *e_paddr; /* address of proc */
struct session *e_sess; /* session pointer */
struct _pcred e_pcred; /* process credentials */
struct _ucred e_ucred; /* current credentials */
struct vmspace e_vm; /* address space */
pid_t e_ppid; /* parent process id */
pid_t e_pgid; /* process group id */
short e_jobc; /* job control counter */
dev_t e_tdev; /* controlling tty dev */
pid_t e_tpgid; /* tty process group id */
struct session *e_tsess; /* tty session pointer */
#define WMESGLEN 7
char e_wmesg[WMESGLEN+1]; /* wchan message */
segsz_t e_xsize; /* text size */
short e_xrssize; /* text rss */
short e_xccount; /* text references */
short e_xswrss;
int32_t e_flag;
#define EPROC_CTTY 0x01 /* controlling tty vnode active */
#define EPROC_SLEADER 0x02 /* session leader */
#define COMAPT_MAXLOGNAME 12
char e_login[COMAPT_MAXLOGNAME]; /* short setlogin() name */
#if CONFIG_LCTX
pid_t e_lcid;
int32_t e_spare[3];
#else
int32_t e_spare[4];
#endif
} kp_eproc;
};
> This came up previously on Apple's mailing lists, so search the archives.
Couldn't find anything in there. I found several people using kinfo_proc to get all kinds of process info, like this:
http://www.nightproductions.net/dsprocessesinfo_m.html
but nobody comes up with the running architecture.
I suppose I could spend hours searching all three of Apple's open-source sites:
http://opensource.apple.com/
http://www.apple.com/opensource/
http://www.macosforge.org/
to see if I could find the some code that fills in a kinfo_proc, but since the answer may in the end be "no", I'm going to forget this and use 'ps -ax -o flags' as I originally suggested. At least I have a proof-of-concept demo with that.
Thanks for the ideas, guys.
Jerry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden