Release 951226
[wine/gsoc-2012-control.git] / miscemu / cpu.c
blob436c35b44e999970caf174944a107b2e247ac1e9
1 /*
2 * What processor?
4 * Copyright 1995 Morten Welinder
5 */
7 #include <stdio.h>
8 #include <ctype.h>
9 #include <string.h>
11 int runtime_cpu (void)
13 static int cache = 0;
15 #ifdef linux
16 if (!cache)
18 FILE *f = fopen ("/proc/cpuinfo", "r");
20 cache = 3; /* Default. */
22 if (f)
24 char info[5], value[5];
25 while (fscanf (f, " %4s%*s : %4s%*s", info, value) == 2)
26 if (!strcasecmp (info, "cpu"))
28 if (isdigit (value[0]) && value[1] == '8'
29 && value[2] == '6' && value[3] == 0)
31 cache = value[0] - '0';
32 break;
35 fclose (f);
38 return cache;
39 #else
40 /* FIXME: how do we do this on other systems? */
41 return 3;
42 #endif