line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::SPARC; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
82612020
|
use strict; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
84
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
9
|
use Config; |
|
1
|
|
|
|
|
41
|
|
|
1
|
|
|
|
|
80
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
499
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
474
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub isEnabled { |
11
|
0
|
|
|
0
|
0
|
|
return $Config{archname} =~ /^sparc/; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub doInventory { |
15
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $bios = { |
20
|
|
|
|
|
|
|
SMANUFACTURER => 'SUN', |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# sysctl infos |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# it gives only the CPU on OpenBSD/sparc64 |
26
|
0
|
|
|
|
|
|
$bios->{SMODEL} = getFirstLine(command => 'sysctl -n hw.model'); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# example on NetBSD: 0x807b65c |
29
|
|
|
|
|
|
|
# example on OpenBSD: 2155570635 |
30
|
0
|
|
|
|
|
|
$bios->{SSN} = getFirstLine(command => 'sysctl -n kern.hostid'); |
31
|
|
|
|
|
|
|
# force hexadecimal, but remove 0x to make it appear as in the firmware |
32
|
0
|
|
|
|
|
|
$bios->{SSN} = dec2hex($bios->{SSN}); |
33
|
0
|
|
|
|
|
|
$bios->{SSN} =~ s/^0x//; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $count = getFirstLine(command => 'sysctl -n hw.ncpu'); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# dmesg infos |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# I) SPARC |
40
|
|
|
|
|
|
|
# NetBSD: |
41
|
|
|
|
|
|
|
# mainbus0 (root): SUNW,SPARCstation-20: hostid 72362bb1 |
42
|
|
|
|
|
|
|
# cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU |
43
|
|
|
|
|
|
|
# OpenBSD: |
44
|
|
|
|
|
|
|
# mainbus0 (root): SUNW,SPARCstation-20 |
45
|
|
|
|
|
|
|
# cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
# II) SPARC64 |
48
|
|
|
|
|
|
|
# NetBSD: |
49
|
|
|
|
|
|
|
# mainbus0 (root): SUNW,Ultra-1: hostid 807b65cb |
50
|
|
|
|
|
|
|
# cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU |
51
|
|
|
|
|
|
|
# OpenBSD: |
52
|
|
|
|
|
|
|
# mainbus0 (root): Sun Ultra 1 SBus (UltraSPARC 167MHz) |
53
|
|
|
|
|
|
|
# cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU |
54
|
|
|
|
|
|
|
# FreeBSD: |
55
|
|
|
|
|
|
|
# cpu0: Sun Microsystems UltraSparc-I Processor (167.00 MHz CPU) |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $cpu; |
58
|
0
|
|
|
|
|
|
foreach my $line (getAllLines(command => 'dmesg')) { |
59
|
0
|
0
|
|
|
|
|
if ($line=~ /^mainbus0 \(root\):\s*(.*)$/) { $bios->{SMODEL} = $1; } |
|
0
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if ($line =~ /^cpu[^:]*:\s*(.*)$/i) { $cpu->{NAME} = $1; } |
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$bios->{SMODEL} =~ s/SUNW,//; |
64
|
0
|
|
|
|
|
|
$bios->{SMODEL} =~ s/[:\(].*$//; |
65
|
0
|
|
|
|
|
|
$bios->{SMODEL} =~ s/^\s*//; |
66
|
0
|
|
|
|
|
|
$bios->{SMODEL} =~ s/\s*$//; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$cpu->{NAME} =~ s/SUNW,//; |
69
|
0
|
|
|
|
|
|
$cpu->{NAME} =~ s/^\s*//; |
70
|
0
|
|
|
|
|
|
$cpu->{NAME} =~ s/\s*$//; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# XXX quick and dirty _attempt_ to get proc speed |
73
|
0
|
0
|
|
|
|
|
if ($cpu->{NAME} =~ /(\d+)(\.\d+|)\s*mhz/i ) { # possible decimal point |
74
|
0
|
|
|
|
|
|
$cpu->{SPEED} = sprintf("%.0f", "$1$2"); # round number |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$inventory->setBios($bios); |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
return if $params{no_category}->{cpu}; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
while ($count--) { |
82
|
0
|
|
|
|
|
|
$inventory->addEntry( |
83
|
|
|
|
|
|
|
section => 'CPUS', |
84
|
|
|
|
|
|
|
entry => $cpu |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |