summaryrefslogtreecommitdiff
path: root/src/hypervisor_check.ads
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-04-04 19:23:10 +0600
committerDaniil Baturin <daniil@baturin.org>2015-04-04 19:23:10 +0600
commitf1743bd1e8ea014b515dd2d442625fdf6bf3946f (patch)
tree37c19cac6a0597a9f21d4e61023d697dd320142d /src/hypervisor_check.ads
parente4a567a9b0fe33fe0bab23d57c5deefbfbbe29bd (diff)
downloadhvinfo-f1743bd1e8ea014b515dd2d442625fdf6bf3946f.tar.gz
hvinfo-f1743bd1e8ea014b515dd2d442625fdf6bf3946f.zip
Add Xen detection support for FreeBSD.
Diffstat (limited to 'src/hypervisor_check.ads')
-rw-r--r--src/hypervisor_check.ads9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hypervisor_check.ads b/src/hypervisor_check.ads
index b19bf70..ea08d90 100644
--- a/src/hypervisor_check.ads
+++ b/src/hypervisor_check.ads
@@ -1,4 +1,5 @@
with Interfaces; use Interfaces;
+with Interfaces.C;
with System.Machine_Code; use System.Machine_Code;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
@@ -27,6 +28,8 @@ package Hypervisor_Check is
function Known_DMI_HV_Vendor (Name : US.Unbounded_String) return Boolean;
+ function Command_Succeeds (Command : Interfaces.C.Char_Array) return Boolean;
+
-- Vendor names for human consumption
VMWare : constant String := "VMWare";
Xen_HVM : constant String := "Xen HVM";
@@ -45,6 +48,12 @@ private
Linux_Sys_Vendor_File : constant String := "/sys/class/dmi/id/sys_vendor";
Linux_Sys_HV_Type_File : constant String := "/sys/hypervisor/type";
+ -- FreeBSD-specific file names, commands etc.
+
+ -- sysctl read commands are available to unprivileged users, but sysctl binary
+ -- may not be in the $PATH, hence the absolute path
+ FreeBSD_Xen_Present_Command : constant String := "/sbin/sysctl kern.vm_guest | grep xen";
+
-- SMBIOS vendor strings
VMWare_DMI_Pattern : constant String := "VMware, Inc.";
HyperV_DMI_Pattern : constant String := "Microsoft Corporation";