/usr/share/perl5/System/Info/HPUX.pm is in libsystem-info-perl 0.057-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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | package System::Info::HPUX;
use strict;
use warnings;
use base "System::Info::Base";
our $VERSION = "0.051";
=head1 NAME
System::Info::HPUX - Object for specific HP-UX info.
=head1 DESCRIPTION
=head2 $si->prepare_sysinfo
Use os-specific tools to find out more about the system.
=cut
sub prepare_sysinfo {
my $self = shift;
$self->SUPER::prepare_sysinfo;
$self->{__os} =~ s/hp-ux/HP-UX/;
chomp (my $k64 = `/usr/bin/getconf KERNEL_BITS 2>/dev/null`);
length $k64 and $self->{__os} .= "/$k64";
# ioscan is always available
$self->{__cpu_count} = grep m/^processor/ => `/usr/sbin/ioscan -knfCprocessor`;
$self->_prepare_cpu_type;
return $self;
} # prepare_sysinfo
sub _prepare_cpu_type {
my $self = shift;
my $parisc = 0;
# For now, unknown cpu_types are set as the Generic
chomp (my $cv = `/usr/bin/getconf CPU_VERSION 2>/dev/null`);
# see /usr/include/sys/unistd.h for hex values
if ($cv < 0x20B) {
# $self->{__cpu_type} = sprintf("Unknown CPU_VERSION 0x%x", $cv);
}
elsif ($cv >= 0x20C && $cv <= 0x20E) {
$self->{__cpu_type} = "Motorola"; # You have an antique
}
elsif ($cv <= 0x2FF) {
$self->{__cpu_type} = "PA-RISC";
$self->{__cpu_type} = "PA-RISC1.0" if $cv == 0x20B;
$self->{__cpu_type} = "PA-RISC1.1" if $cv == 0x210;
$self->{__cpu_type} = "PA-RISC1.2" if $cv == 0x211;
$self->{__cpu_type} = "PA-RISC2.0" if $cv == 0x214;
$parisc++;
}
elsif ($cv == 0x300) {
$self->{__cpu_type} = "ia64";
}
else {
# $self->{__cpu_type} = sprintf("Unknown CPU_VERSION 0x%x", $cv);
}
if ($parisc) {
my (@cpu, $lst);
chomp (my $model = `model`);
(my $m = $model) =~ s{.*/}{};
foreach my $f (qw( /usr/sam/lib/mo/sched.models
/opt/langtools/lib/sched.models )) {
if (open my $fh, "<", $f) {
@cpu = grep m/$m/i => <$fh>;
close $fh;
@cpu and last;
}
}
if (@cpu == 0 && open my $lst,
"echo 'sc product cpu;il' | /usr/sbin/cstm |") {
while (<$lst>) {
s/^\s*(PA)\s*(\d+)\s+CPU Module.*/$m 1.1 $1$2/ or next;
$2 =~ m/^8/ and s/ 1.1 / 2.0 /;
push @cpu, $_;
}
}
if (@cpu and $cpu[0] =~ m/^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/) {
my ($arch, $cpu) = ("PA-RISC$1", $2);
$self->{__cpu} = $cpu;
chomp (my $hw3264 =
`/usr/bin/getconf HW_32_64_CAPABLE 2>/dev/null`);
(my $osvers = $self->{__os}) =~ s/.*[AB]\.//;
$osvers =~ s{/.*}{};
$osvers <= 10.20 and $hw3264 = 0;
if ($hw3264 == 1) {
$self->{__cpu_type} = $arch . "/64";
}
elsif ($hw3264 == 0) {
$self->{__cpu_type} = $arch . "/32";
}
}
}
else {
my $machinfo = `/usr/contrib/bin/machinfo`;
if ($machinfo =~ m/processor model:\s+(\d+)\s+(.*)/) {
$self->{__cpu} = $2;
}
elsif ($machinfo =~ m{\s*[0-9]+\s+(intel.r.*processor)\s*\(([0-9.]+)\s*([GM])Hz.*}mi) {
my ($m, $s, $h) = ($1, $2, $3);
$m =~ s{ series processor}{};
$h eq "G" and $s = int ($s * 1024);
$self->{__cpu} = "$m/$s";
}
$machinfo =~ m/Clock\s+speed\s+=\s+(.*)/ and
$self->{__cpu} .= "/$1";
}
(my $v = $self->{__osvers}) =~ s/^[A-Z]+\.//;
$self->{__distro} = "HP-UX $v";
} # _prepare_cpu_type
1;
__END__
=head1 COPYRIGHT AND LICENSE
(c) 2016-2018, Abe Timmerman & H.Merijn Brand, All rights reserved.
With contributions from Jarkko Hietaniemi, Merijn Brand, Campo
Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop,
Rich Rauenzahn, David Cantrell.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
See:
=over 4
=item * L<http://www.perl.com/perl/misc/Artistic.html>
=item * L<http://www.gnu.org/copyleft/gpl.html>
=back
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
|