mirror of
https://github.com/reactos/wine.git
synced 2025-02-03 02:32:41 +00:00
44 lines
705 B
C
44 lines
705 B
C
|
/*
|
||
|
* What processor?
|
||
|
*
|
||
|
* Copyright 1995 Morten Welinder
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <ctype.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
int runtime_cpu (void)
|
||
|
{
|
||
|
static int cache = 0;
|
||
|
|
||
|
#ifdef linux
|
||
|
if (!cache)
|
||
|
{
|
||
|
FILE *f = fopen ("/proc/cpuinfo", "r");
|
||
|
|
||
|
cache = 3; /* Default. */
|
||
|
|
||
|
if (f)
|
||
|
{
|
||
|
char info[5], value[5];
|
||
|
while (fscanf (f, " %4s%*s : %4s%*s", info, value) == 2)
|
||
|
if (!strcasecmp (info, "cpu"))
|
||
|
{
|
||
|
if (isdigit (value[0]) && value[1] == '8'
|
||
|
&& value[2] == '6' && value[3] == 0)
|
||
|
{
|
||
|
cache = value[0] - '0';
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
fclose (f);
|
||
|
}
|
||
|
}
|
||
|
return cache;
|
||
|
#else
|
||
|
/* FIXME: how do we do this on other systems? */
|
||
|
return 3;
|
||
|
#endif
|
||
|
}
|