Hi,
This C program might help you.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/utsname.h>
int main()
{
struct utsname *buf = NULL;
buf = malloc(sizeof(struct utsname));
if (buf == NULL) {
fprintf(stderr,"Memory Allocation Error: %s \n", strerror(errno));
exit(-1);
}
if (uname(buf) < 0) {
fprintf(stderr,"UName Error: %s \n", strerror(errno));
exit(-1);
}
printf ("Processor arch =:>) %s \n", buf->machine);
return 0;
}
On Thu, Jan 27, 2011 at 4:45 PM, Henry Gebhardt <hsggebhardt@googlemail.com> wrote:
On Thu, Jan 27, 2011 at 03:23:28PM +0530, prabhu wrote:What about using the machine field of uname(2):
> Any C programming technique apart from using this /proc/cpuinfo detail?
$ man 2 uname
Quoting from that man page:
[...] the operating system presumably knows its name, release
and version. It also knows what hardware it runs on.
Perhaps a downside, it returns the machine type as a string. Does that
do what you want?
I also find "man linux32" rather interesting:
setarch - change reported architecture in new program environment
and set personality flags
Might be useful for testing.
Greetings,
Henry
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
Thanks & Regards,
---------PraviN---------
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies