mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-06-16 06:25:23 +00:00
Added detection for non-DMI Linux hypervisors (Xen)
This commit is contained in:
parent
6b02504df2
commit
c6827aa9c5
|
@ -99,6 +99,7 @@
|
|||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_SENDFILE
|
||||
#include <sys/sendfile.h>
|
||||
|
|
11
platform.c
11
platform.c
|
@ -152,6 +152,17 @@ void platform(state *st)
|
|||
}
|
||||
}
|
||||
|
||||
/* No DMI? Get possible hypervisor name */
|
||||
if (!*st->server_description && (fp = fopen("/sys/hypervisor/type" , "r"))) {
|
||||
fgets(buf, sizeof(buf), fp);
|
||||
fclose(fp);
|
||||
|
||||
chomp(buf);
|
||||
ucfirst(buf);
|
||||
|
||||
if (*buf) snprintf(st->server_description, sizeof(st->server_description), "%s virtual machine", buf);
|
||||
}
|
||||
|
||||
/* Identify Gentoo */
|
||||
if (!*sysname && (fp = fopen("/etc/gentoo-release", "r"))) {
|
||||
fgets(sysname, sizeof(sysname), fp);
|
||||
|
|
Loading…
Reference in New Issue
Block a user