line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sys::Detect::Virtualization::freebsd; |
2
|
1
|
|
|
1
|
|
3440
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use base qw( Sys::Detect::Virtualization ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
244
|
|
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 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. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
0
|
1
|
|
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; |