Browse Source

api: add kernel version for linux

master
Tanguy Pruvot 10 years ago
parent
commit
5cbf239d8a
  1. 11
      api.cpp

11
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
return "linux"; FILE *fd = fopen("/proc/version", "r");
if (!fd || !fscanf(fd, "Linux version %48s", &os_version[6]))
return "linux";
fclose(fd);
os_version[48] = '\0';
return (const char*) os_version;
#endif #endif
} }

Loading…
Cancel
Save