diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-04-06 16:40:03 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-04-06 16:40:03 +0600 |
commit | 29a9fc9af63a4c897ac718894f8f01bb50a38104 (patch) | |
tree | 7f08887e689aecb4ae99a1dd29220e47fded88a1 | |
parent | 74c860906f9ae73f194341feda41436f959521d5 (diff) | |
download | hvinfo-29a9fc9af63a4c897ac718894f8f01bb50a38104.tar.gz hvinfo-29a9fc9af63a4c897ac718894f8f01bb50a38104.zip |
Add VirtualBox PCI detection on FreeBSD.
-rw-r--r-- | src/hvinfo.adb | 2 | ||||
-rw-r--r-- | src/hypervisor_check.adb | 18 | ||||
-rw-r--r-- | src/hypervisor_check.ads | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/hvinfo.adb b/src/hvinfo.adb index e9729a5..e15c75d 100644 --- a/src/hvinfo.adb +++ b/src/hvinfo.adb @@ -73,6 +73,8 @@ begin IO.Put_Line(IO.Standard_Error, "No hypervisor detected"); CL.Set_Exit_Status (1); end if; + elsif VirtualBox_PCI_Present then + IO.Put_Line (VirtualBox); end if; end if; diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index 30bccf3..df8391b 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -191,4 +191,22 @@ package body Hypervisor_Check is end if; end Known_DMI_HV_Vendor; + function VirtualBox_PCI_Present return Boolean is + begin + if Config.FreeBSD then + if Command_Succeeds ("/sbin/sysctl dev.vgapci | grep vendor=0x80ee") then + return True; + else + return False; + end if; + elsif Config.Linux then + -- Can be done, but on Linux VirtualBox is covered by DMI checks, + -- so I cut the corners here + -- XXX: maybe it's relevant on some UEFI machines + return False; + else + return False; + end if; + end; + end Hypervisor_Check; diff --git a/src/hypervisor_check.ads b/src/hypervisor_check.ads index f4b1eef..3941f8f 100644 --- a/src/hypervisor_check.ads +++ b/src/hypervisor_check.ads @@ -30,6 +30,8 @@ package Hypervisor_Check is function Command_Succeeds (Command : Interfaces.C.Char_Array) return Boolean; + function VirtualBox_PCI_Present return Boolean; + -- Vendor names for human consumption VMWare : constant String := "VMWare"; Xen_HVM : constant String := "Xen HVM"; |