Re: Determining architecture type at run time
Re: Determining architecture type at run time
- Subject: Re: Determining architecture type at run time
- From: Brian Bergstrand <email@hidden>
- Date: Mon, 27 Apr 2009 14:20:17 +0300
ENOENT is "no such file or directory". That would mean there's no name
mapping for hw.machine_arch, so use sysctl() instead with
HW_MACHINE_ARCH as the MIB ID.
On Apr 27, 2009, at 2:02 PM, rohan a wrote:
Hi,
Thanks for this.
I tried the following :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
extern int errno;
int main(void)
{
int len;
char cpuarch[64];
len = sizeof(cpuarch);
if (sysctlbyname("hw.machine_arch", cpuarch, &len, NULL,
NULL) == -1)
{
perror("sysctlbyname()");
return -1;
}
return 0;
}
However, sysctlbyname fails with the error
sysctlbyname(): No such file or directory
What needs to be done?
On 4/27/09, Brian Bergstrand <email@hidden> wrote:
#include <sys/sysctl.h>
$ man 3 sysctl
On Apr 27, 2009, at 12:11 PM, rohan a wrote:
Hello,
I need to determine at program run time, the architecture
type(x86, ppc or x86_64) of the Mac OS X machine. Is it possible to
do this? Does Mac OS provide any API for this?
Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden