| 1 | package Sys::Detect::Virtualization::freebsd; | ||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use base qw( Sys::Detect::Virtualization ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Sys::Detect::Virtualization::freebsd - Detection of virtualization under a FreeBSD system | ||
| 10 | |||
| 11 | =head1 DESCRIPTION | ||
| 12 | |||
| 13 | See L<Sys::Detect::Virtualization> for usage information. | ||
| 14 | |||
| 15 | =head1 METHODS | ||
| 16 | |||
| 17 | =head2 Internal Methods | ||
| 18 | |||
| 19 | =over 4 | ||
| 20 | |||
| 21 | =item new ( ) | ||
| 22 | |||
| 23 | Constructor. You should not invoke this directly. Instead, use L<Sys::Detect::Virtualization>. | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | sub new | ||
| 28 | 0 | ▶ | { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 29 | 0 | my ($class) = @_; | |
| 30 | 0 | my $self = {}; | |
| 31 | 0 | bless $self, $class; | |
| 32 | 0 | return $self; | |
| 33 | } | ||
| 34 | |||
| 35 | =item detect_ps ( ) | ||
| 36 | |||
| 37 | 'ps' output on FreeBSD will show 'J' for jailed processes. | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | sub detect_ps | ||
| 42 | 0 | ▶ | { |
|
Subroutine
detect_ps: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 43 | 0 | my ($self) = @_; | |
| 44 | |||
| 45 | 0 | return $self->_check_command_output( | |
| 46 | 'ps -o stat', | ||
| 47 | [ | ||
| 48 | # FreeBSD jail | ||
| 49 | qr/J/ => [ $self->VIRT_FREEBSD_JAIL ], | ||
| 50 | ], | ||
| 51 | ); | ||
| 52 | } | ||
| 53 | |||
| 54 | =item detect_dmesg ( ) | ||
| 55 | |||
| 56 | Check the output of the 'dmesg' command for telltales. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub detect_dmesg | ||
| 61 | 0 | ▶ | { |
|
Subroutine
detect_dmesg: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 62 | 0 | my ($self) = @_; | |
| 63 | |||
| 64 | 0 | return $self->_check_command_output( | |
| 65 | $self->_find_bin('dmesg'), | ||
| 66 | [ | ||
| 67 | # Qemu / KVM | ||
| 68 | qr/qemu harddisk/i => [ $self->VIRT_KVM, $self->VIRT_QEMU ], | ||
| 69 | qr/qemu dvd-rom/i => [ $self->VIRT_KVM, $self->VIRT_QEMU ], | ||
| 70 | ], | ||
| 71 | ); | ||
| 72 | |||
| 73 | } | ||
| 74 | |||
| 75 | =back | ||
| 76 | |||
| 77 | =head1 LICENSE AND COPYRIGHT | ||
| 78 | |||
| 79 | Copyright (C) 2009 Roaring Penguin Software Inc. | ||
| 80 | |||
| 81 | This program is free software; you can redistribute it and/or modify it | ||
| 82 | under the terms of either: the GNU General Public License as published | ||
| 83 | by the Free Software Foundation; or the Artistic License. | ||
| 84 | |||
| 85 | See http://dev.perl.org/licenses/ for more information. | ||
| 86 | |||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | 1 | 1; | |