Re: Determining how the app is run (intel/ppc/rosetta/os version)?
Re: Determining how the app is run (intel/ppc/rosetta/os version)?
- Subject: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
- From: Gerben Wierda <email@hidden>
- Date: Fri, 26 May 2006 14:42:22 +0200
I still want to keep my app from running on some versions of the OS or
some situations because there are known OS bugs there. E.g. my app on
10.4.6 under Rosetta is one of the apps (like MatLab) triggering the OS
bug. So I started looking for ways to determine the way the app is run.
I tried doing some stuff through sysctl, but failed. Below is an
example. The CTL_KERN/KERN_VERSION works, but CTL_HW/HW_MACHINE_ARG
does not.
Is OS X broken here or am I doing something boneheaded?
Thanks,
Gerben
#include <stdio.h>
#include <sys/sysctl.h>
#include <stdlib.h>
main()
{
char *hw_machine_arg;
int mib[2];
size_t len;
/*
mib[0] = CTL_HW;
mib[1] = HW_MACHINE_ARCH;
*/
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) {
perror("sysctl");
}
else {
if (len > 0) {
hw_machine_arg = malloc( len);
if (sysctl(mib, 2, hw_machine_arg, &len, NULL, 0) == -1) {
perror("sysctl");
}
printf( "HW_MACHINE_ARG: %s\n", hw_machine_arg);
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden