This file is indexed.

/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/BSD/Archs/SPARC.pm is in fusioninventory-agent 1:2.3.10.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package FusionInventory::Agent::Task::Inventory::BSD::Archs::SPARC;

use strict;
use warnings;

use Config;

use FusionInventory::Agent::Tools;

sub isEnabled {
    return $Config{archname} =~ /^sun4/;
}

sub doInventory {
    my (%params) = @_;

    my $inventory = $params{inventory};

    my $bios = {
        SMANUFACTURER => 'SUN',
    };

    # sysctl infos

    # it gives only the CPU on OpenBSD/sparc64
    $bios->{SMODEL} = getFirstLine(command => 'sysctl -n hw.model');

    # example on NetBSD: 0x807b65c
    # example on OpenBSD: 2155570635
    $bios->{SSN} = getFirstLine(command => 'sysctl -n kern.hostid');
    # force hexadecimal, but remove 0x to make it appear as in the firmware
    $bios->{SSN} = dec2hex($bios->{SSN});
    $bios->{SSN} =~ s/^0x//;

    my $count = getFirstLine(command => 'sysctl -n hw.ncpu');

    # dmesg infos

    # I) SPARC
    # NetBSD:
    # mainbus0 (root): SUNW,SPARCstation-20: hostid 72362bb1
    # cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU
    # OpenBSD:
    # mainbus0 (root): SUNW,SPARCstation-20
    # cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU
    #
    # II) SPARC64
    # NetBSD:
    # mainbus0 (root): SUNW,Ultra-1: hostid 807b65cb
    # cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU
    # OpenBSD:
    # mainbus0 (root): Sun Ultra 1 SBus (UltraSPARC 167MHz)
    # cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU
    # FreeBSD:
    # cpu0: Sun Microsystems UltraSparc-I Processor (167.00 MHz CPU)

    my $cpu;
    foreach my $line (getAllLines(command => 'dmesg')) {
        if ($line=~ /^mainbus0 \(root\):\s*(.*)$/) { $bios->{SMODEL} = $1; }
        if ($line =~ /^cpu[^:]*:\s*(.*)$/i)        { $cpu->{NAME}    = $1; }
    }

    $bios->{SMODEL} =~ s/SUNW,//;
    $bios->{SMODEL} =~ s/[:\(].*$//;
    $bios->{SMODEL} =~ s/^\s*//;
    $bios->{SMODEL} =~ s/\s*$//;

    $cpu->{NAME} =~ s/SUNW,//;
    $cpu->{NAME} =~ s/^\s*//;
    $cpu->{NAME} =~ s/\s*$//;

    # XXX quick and dirty _attempt_ to get proc speed
    if ($cpu->{NAME} =~ /(\d+)(\.\d+|)\s*mhz/i ) { # possible decimal point
        $cpu->{SPEED} = sprintf("%.0f", "$1$2"); # round number
    }

    $inventory->setBios($bios);

    while ($count--) {
        $inventory->addEntry(
            section => 'CPUS',
            entry   => $cpu
        );
    }

}


1;