1package System::Info::Solaris; 2 3use strict; 4use warnings; 5 6use base "System::Info::Base"; 7 8our $VERSION = "0.050"; 9 10=head1 NAME 11 12System::Info::Solaris - Object for specific Solaris/Sun-os info. 13 14=head1 DESCRIPTION 15 16=head2 $si->prepare_sysinfo 17 18Use os-specific tools to find out more about the system. 19 20=cut 21 22sub prepare_sysinfo { 23 my $self = shift; 24 $self->SUPER::prepare_sysinfo; 25 $self->prepare_os; 26 27 local $ENV{PATH} = "/usr/sbin:$ENV{PATH}"; 28 29 my @psrinfo = `psrinfo -v`; 30 my ($psrinfo) = grep m/the .* operates .* [gm]hz/ix => @psrinfo; 31 my ($type, $speed, $magnitude) = 32 $psrinfo =~ m/the (.+) processor.*at (.+?)\s*([GM]hz)/i; 33 $type =~ s/(v9)$/ $1 ? "64" : ""/e; 34 35 my $cpu = $self->_cpu; 36 37 if (-d "/usr/platform") { # Solaris but not OSF/1. 38 chomp (my $platform = `uname -i`); 39 my $pfpath = "/usr/platform/$platform/sbin/prtdiag"; 40 if (-x "$pfpath") { # Not on Solaris-x86 41 my $prtdiag = `$pfpath`; 42 ($cpu) = $prtdiag =~ m/^System .+\(([^\s\)]+)/; 43 unless ($cpu) { 44 my ($cpu_line) = grep m/\s+on-?line\s+/i => split /\n/ => $prtdiag; 45 ($cpu = (split " " => $cpu_line)[4]) =~ s/.*,//; 46 } 47 $cpu .= " ($speed$magnitude)"; 48 } 49 else { 50 $cpu .= " ($speed$magnitude)"; 51 } 52 } 53 elsif (-x "/usr/sbin/sizer") { # OSF/1. 54 $cpu = $type; 55 chomp ($type = `sizer -implver`); 56 } 57 58 my $ncpu = grep m/on-?line/ => `psrinfo`; 59 60 $self->{__cpu_type} = $type; 61 $self->{__cpu} = $cpu; 62 $self->{__cpu_count} = $ncpu; 63 return $self; 64 } # prepare_sysinfo 65 66=head2 $si->prepare_os 67 68Use os-specific tools to find out more about the operating system. 69 70=cut 71 72sub prepare_os { 73 my $self = shift; 74 75 my ($osn, $osv) = ($self->_osname, $self->_osvers); 76 if ($^O =~ /solaris|sunos/i && $osv > 5) { 77 $osn = "Solaris"; 78 $osv = "2." . (split m/\./ => $osv, 2)[1]; 79 } 80 $self->{__os} = join " - ", $osn, $osv; 81 } # prepare_os 82 831; 84 85__END__ 86 87=head1 COPYRIGHT AND LICENSE 88 89(c) 2016-2018, Abe Timmerman & H.Merijn Brand, All rights reserved. 90 91With contributions from Jarkko Hietaniemi, Campo Weijerman, Alan Burlison, 92Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn, David Cantrell. 93 94This library is free software; you can redistribute it and/or modify 95it under the same terms as Perl itself. 96 97See: 98 99=over 4 100 101=item * L<http://www.perl.com/perl/misc/Artistic.html> 102 103=item * L<http://www.gnu.org/copyleft/gpl.html> 104 105=back 106 107This program is distributed in the hope that it will be useful, 108but WITHOUT ANY WARRANTY; without even the implied warranty of 109MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 110 111=cut 112