Browse Source

api: add kernel version for linux

2upstream
Tanguy Pruvot 10 years ago
parent
commit
5cbf239d8a
  1. 9
      api.cpp

9
api.cpp

@ -270,12 +270,21 @@ static void gpuhwinfos(int gpu_id)
strcat(buffer, buf); strcat(buffer, buf);
} }
#ifndef WIN32
static char os_version[64] = "linux ";
#endif
static const char* os_name() static const char* os_name()
{ {
#ifdef WIN32 #ifdef WIN32
return "windows"; return "windows";
#else #else
FILE *fd = fopen("/proc/version", "r");
if (!fd || !fscanf(fd, "Linux version %48s", &os_version[6]))
return "linux"; return "linux";
fclose(fd);
os_version[48] = '\0';
return (const char*) os_version;
#endif #endif
} }

Loading…
Cancel
Save