blob: e212501e6dbea1d7db2e9af6186e576d8687fc26 [file] [log] [blame]
Jim Cownie5e8470a2013-09-27 10:38:44 +00001#
2# This is not a runnable script, it is a Perl module, a collection of variables, subroutines, etc.
3# To get help about exported variables and subroutines, execute the following command:
4#
5# perldoc Uname.pm
6#
7# or see POD (Plain Old Documentation) embedded to the source...
8#
9#
10#//===----------------------------------------------------------------------===//
11#//
12#// The LLVM Compiler Infrastructure
13#//
14#// This file is dual licensed under the MIT and the University of Illinois Open
15#// Source Licenses. See LICENSE.txt for details.
16#//
17#//===----------------------------------------------------------------------===//
18#
19
20package Uname;
21
22use strict;
23use warnings;
24use warnings::register;
25use Exporter;
26
27use POSIX;
28use File::Glob ":glob";
29use Net::Domain qw{};
30
31# Following code does not work with Perl 5.6 on Linux* OS and Windows* OS:
32#
33# use if $^O eq "darwin", tools => qw{};
34#
35# The workaround for Perl 5.6:
36#
37BEGIN {
38 if ( $^O eq "darwin" or $^O eq "linux" ) {
39 require tools;
40 import tools;
41 }; # if
42 if ( $^O eq "MSWin32" ) {
43 require Win32;
44 }; # if
45}; # BEGIN
46
47my $mswin = qr{\A(?:MSWin32|Windows_NT)\z};
48
49my @posix = qw{ kernel_name fqdn kernel_release kernel_version machine };
50 # Properties supported by POSIX::uname().
51my @linux =
52 qw{ processor hardware_platform operating_system };
53 # Properties reported by uname in Linux* OS.
54my @base = ( @posix, @linux );
55 # Base properties.
56my @aux =
57 (
58 qw{ host_name domain_name },
59 map( "operating_system_$_", qw{ name release codename description } )
60 );
Alp Toker8f2d3f02014-02-24 10:40:15 +000061 # Auxiliary properties.
Jim Cownie5e8470a2013-09-27 10:38:44 +000062my @all = ( @base, @aux );
63 # All the properties.
64my @meta = qw{ base_names all_names value };
65 # Meta functions.
66
67our $VERSION = "0.07";
68our @ISA = qw{ Exporter };
69our @EXPORT = qw{};
70our @EXPORT_OK = ( @all, @meta );
71our %EXPORT_TAGS =
72 (
73 base => [ @base ],
74 all => [ @all ],
75 meta => [ @meta ],
76 );
77
78my %values;
79 # Hash of values. Some values are strings, some may be references to code which should be
80 # evaluated to get real value. This trick is implemented because call to Net::Domain::hostfqdn()
81 # is relatively slow.
82
83# Get values from POSIX::uname().
84@values{ @posix } = POSIX::uname();
85
86# On some systems POSIX::uname() returns "short" node name (without domain name). To be consistent
87# on all systems, we will get node name from alternative source.
88if ( $^O =~ m/cygwin/i ) {
89 # Function from Net::Domain module works well, but on Cygwin it prints to
90 # stderr "domainname: not found". So we will use environment variables for now.
91 $values{ fqdn } = lc( $ENV{ COMPUTERNAME } . "." . $ENV{ USERDNSDOMAIN } );
92} else {
93 # On systems other than Cygwin, let us use Net::Domain::hostfqdn(), but do it only node name
94 # is really requested.
95 $values{ fqdn } =
96 sub {
97 my $fqdn = Net::Domain::hostfqdn(); # "fqdn" stands for "fully qualified doamain name".
98 # On some systems POSIX::uname() and Net::Domain::hostfqdn() reports different names.
99 # Let us issue a warning if they significantly different. Names are insignificantly
100 # different if POSIX::uname() matches the beginning of Net::Domain::hostfqdn().
101 if (
102 $fqdn eq substr( $fqdn, 0, length( $fqdn ) )
103 &&
104 (
105 length( $fqdn ) == length( $fqdn )
106 ||
107 substr( $fqdn, length( $fqdn ), 1 ) eq "."
108 )
109 ) {
110 # Ok.
111 } else {
112 warnings::warnif(
113 "POSIX::uname() and Net::Domain::hostfqdn() reported different names: " .
114 "\"$values{ fqdn }\" and \"$fqdn\" respectively\n"
115 );
116 }; # if
117 return $fqdn;
118 }; # sub
119}; # if
120
121if ( $^O =~ $mswin ) {
122 if (
123 $values{ machine } =~ m{\A(?:x86|[56]86)\z}
124 and
125 exists( $ENV{ PROCESSOR_ARCHITECTURE } ) and $ENV{ PROCESSOR_ARCHITECTURE } eq "x86"
126 and
127 exists( $ENV{ PROCESSOR_ARCHITEW6432 } )
128 ) {
129 if ( $ENV{ PROCESSOR_ARCHITEW6432 } eq "AMD64" ) {
130 $values{ machine } = "x86_64";
131 }; # if
132 }; # if
133}; # if
134
135# Some values are not returned by POSIX::uname(), let us compute them.
136
137# processor.
138$values{ processor } = $values{ machine };
139
140# hardware_platform.
141if ( 0 ) {
Alp Toker763b9392014-02-28 09:42:41 +0000142} elsif ( $^O eq "linux" or $^O eq "freebsd" ) {
Jim Cownie5e8470a2013-09-27 10:38:44 +0000143 if ( 0 ) {
144 } elsif ( $values{ machine } =~ m{\Ai[3456]86\z} ) {
145 $values{ hardware_platform } = "i386";
Alp Toker763b9392014-02-28 09:42:41 +0000146 } elsif ( $values{ machine } =~ m{\A(x86_64|amd64)\z} ) {
Jim Cownie5e8470a2013-09-27 10:38:44 +0000147 $values{ hardware_platform } = "x86_64";
Jim Cownie181b4bb2013-12-23 17:28:57 +0000148 } elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) {
149 $values{ hardware_platform } = "arm";
Jim Cownie5e8470a2013-09-27 10:38:44 +0000150 } else {
151 die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
152 }; # if
153} elsif ( $^O eq "darwin" ) {
154 if ( 0 ) {
155 } elsif ( $values{ machine } eq "x86" or $values{ machine } eq "i386" ) {
156 $values{ hardware_platform } =
157 sub {
158 my $platform = "i386";
159 # Some OSes on Intel(R) 64 still reports "i386" machine. Verify it by using
160 # the value returned by 'sysctl -n hw.optional.x86_64'. On Intel(R) 64-bit systems the
161 # value == 1; on 32-bit systems the 'hw.optional.x86_64' property either does not exist
162 # or the value == 0. The path variable does not contain a path to sysctl when
163 # started by crontab.
164 my $sysctl = ( which( "sysctl" ) or "/usr/sbin/sysctl" );
165 my $output;
166 debug( "Executing $sysctl..." );
167 execute( [ $sysctl, "-n", "hw.optional.x86_64" ], -stdout => \$output, -stderr => undef );
168 chomp( $output );
169 if ( 0 ) {
170 } elsif ( "$output" eq "" or "$output" eq "0" ) {
171 $platform = "i386";
172 } elsif ( "$output" eq "1" ) {
173 $platform = "x86_64";
174 } else {
175 die "Unsupported value (\"$output\") returned by \"$sysctl -n hw.optional.x86_64\"; stopped";
176 }; # if
177 return $platform;
178 }; # sub {
179 } elsif ( $values{ machine } eq "x86_64" ) {
180 # Some OS X* versions report "x86_64".
181 $values{ hardware_platform } = "x86_64";
182 } else {
183 die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
184 }; # if
185} elsif ( $^O =~ $mswin ) {
186 if ( 0 ) {
187 } elsif ( $values{ machine } =~ m{\A(?:x86|[56]86)\z} ) {
188 $values{ hardware_platform } = "i386";
189 } elsif ( $values{ machine } eq "x86_64" or $values{ machine } eq "amd64" ) {
190 # ActivePerl for IA-32 architecture returns "x86_64", while ActivePerl for Intel(R) 64 returns "amd64".
191 $values{ hardware_platform } = "x86_64";
192 } else {
193 die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
194 }; # if
195} elsif ( $^O eq "cygwin" ) {
196 if ( 0 ) {
197 } elsif ( $values{ machine } =~ m{\Ai[3456]86\z} ) {
198 $values{ hardware_platform } = "i386";
199 } elsif ( $values{ machine } eq "x86_64" ) {
200 $values{ hardware_platform } = "x86_64";
201 } else {
202 die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
203 }; # if
204} else {
205 die "Unsupported OS (\"$^O\"); stopped";
206}; # if
207
208# operating_system.
209if ( 0 ) {
210} elsif ( $values{ kernel_name } eq "Linux" ) {
211 $values{ operating_system } = "GNU/Linux";
Alp Toker8f2d3f02014-02-24 10:40:15 +0000212 my $release; # Name of chosen "*-release" file.
Jim Cownie5e8470a2013-09-27 10:38:44 +0000213 my $bulk; # Content of release file.
214 # On Ubuntu, lsb-release is quite informative, e. g.:
215 # DISTRIB_ID=Ubuntu
216 # DISTRIB_RELEASE=9.04
217 # DISTRIB_CODENAME=jaunty
218 # DISTRIB_DESCRIPTION="Ubuntu 9.04"
219 # Try lsb-release first. But on some older systems lsb-release is not informative.
220 # It may contain just one line:
221 # LSB_VERSION="1.3"
222 $release = "/etc/lsb-release";
223 if ( -e $release ) {
224 $bulk = read_file( $release );
225 } else {
226 $bulk = "";
227 }; # if
228 if ( $bulk =~ m{^DISTRIB_} ) {
229 # Ok, this lsb-release is informative.
230 $bulk =~ m{^DISTRIB_ID\s*=\s*(.*?)\s*$}m
231 or runtime_error( "$release: There is no DISTRIB_ID:", $bulk, "(eof)" );
232 $values{ operating_system_name } = $1;
233 $bulk =~ m{^DISTRIB_RELEASE\s*=\s*(.*?)\s*$}m
234 or runtime_error( "$release: There is no DISTRIB_RELEASE:", $bulk, "(eof)" );
235 $values{ operating_system_release } = $1;
236 $bulk =~ m{^DISTRIB_CODENAME\s*=\s*(.*?)\s*$}m
237 or runtime_error( "$release: There is no DISTRIB_CODENAME:", $bulk, "(eof)" );
238 $values{ operating_system_codename } = $1;
239 $bulk =~ m{^DISTRIB_DESCRIPTION\s*="?\s*(.*?)"?\s*$}m
240 or runtime_error( "$release: There is no DISTRIB_DESCRIPTION:", $bulk, "(eof)" );
241 $values{ operating_system_description } = $1;
242 } else {
243 # Oops. lsb-release is missed or not informative. Try other *-release files.
244 $release = "/etc/system-release";
245 if ( not -e $release ) { # Use /etc/system-release" if such file exists.
246 # Otherwise try other "/etc/*-release" files, but ignore "/etc/lsb-release".
247 my @releases = grep( $_ ne "/etc/lsb-release", bsd_glob( "/etc/*-release" ) );
248 # On some Fedora systems there are two files: fedora-release and redhat-release
249 # with identical content. If fedora-release present, ignore redjat-release.
250 if ( grep( $_ eq "/etc/fedora-release", @releases ) ) {
251 @releases = grep( $_ ne "/etc/redhat-release", @releases );
252 }; # if
253 if ( @releases == 1 ) {
254 $release = $releases[ 0 ];
255 } else {
256 if ( @releases == 0 ) {
257 # No *-release files found, try debian_version.
258 $release = "/etc/debian_version";
259 if ( not -e $release ) {
260 $release = undef;
261 warning( "No release files found in \"/etc/\" directory." );
262 }; # if
263 } else {
264 $release = undef;
265 warning( "More than one release files found in \"/etc/\" directory:", @releases );
266 }; # if
267 }; # if
268 }; # if
269 if ( defined( $release ) ) {
270 $bulk = read_file( $release );
271 if ( $release =~ m{system|redhat|fedora} ) {
272 # Red Hat or Fedora. Parse the first line of file.
273 # Typical values of *-release (one of):
274 # Red Hat Enterprise Linux* OS Server release 5.2 (Tikanga)
275 # Red Hat Enterprise Linux* OS AS release 3 (Taroon Update 4)
276 # Fedora release 10 (Cambridge)
277 $bulk =~ m{\A(.*)$}m
278 or runtime_error( "$release: Cannot find the first line:", $bulk, "(eof)" );
279 my $first_line = $1;
280 $values{ operating_system_description } = $first_line;
Jim Cownie181b4bb2013-12-23 17:28:57 +0000281 $first_line =~ m{\A(.*?)\s+release\s+(.*?)(?:\s+\((.*?)(?:\s+Update\s+(.*?))?\))?\s*$}
Jim Cownie5e8470a2013-09-27 10:38:44 +0000282 or runtime_error( "$release:1: Cannot parse line:", $first_line );
283 $values{ operating_system_name } = $1;
284 $values{ operating_system_release } = $2 . ( defined( $4 ) ? ".$4" : "" );
285 $values{ operating_system_codename } = $3;
286 } elsif ( $release =~ m{SuSE} ) {
287 # Typical SuSE-release:
288 # SUSE Linux* OS Enterprise Server 10 (x86_64)
289 # VERSION = 10
290 # PATCHLEVEL = 2
291 $bulk =~ m{\A(.*)$}m
292 or runtime_error( "$release: Cannot find the first line:", $bulk, "(eof)" );
293 my $first_line = $1;
294 $values{ operating_system_description } = $first_line;
295 $first_line =~ m{^(.*?)\s*(\d+)\s*\(.*?\)\s*$}
296 or runtime_error( "$release:1: Cannot parse line:", $first_line );
297 $values{ operating_system_name } = $1;
298 $bulk =~ m{^VERSION\s*=\s*(.*)\s*$}m
299 or runtime_error( "$release: There is no VERSION:", $bulk, "(eof)" );
300 $values{ operating_system_release } = $1;
301 if ( $bulk =~ m{^PATCHLEVEL\s*=\s*(.*)\s*$}m ) {
302 $values{ operating_system_release } .= ".$1";
303 }; # if
304 } elsif ( $release =~ m{debian_version} ) {
305 # Debian. The file debian_version contains just version number, nothing more:
306 # 4.0
307 my $name = "Debian";
308 $bulk =~ m{\A(.*)$}m
309 or runtime_error( "$release: Cannot find the first line:", $bulk, "(eof)" );
310 my $version = $1;
311 $values{ operating_system_name } = $name;
312 $values{ operating_system_release } = $version;
313 $values{ operating_system_codename } = "unknown";
314 $values{ operating_system_description } = sprintf( "%s %s", $name, $version );
315 }; # if
316 }; # if
317 }; # if
318 if ( not defined( $values{ operating_system_name } ) ) {
319 $values{ operating_system_name } = "GNU/Linux";
320 }; # if
321} elsif ( $values{ kernel_name } eq "Darwin" ) {
322 my %codenames = (
323 10.4 => "Tiger",
324 10.5 => "Leopard",
325 10.6 => "Snow Leopard",
326 );
327 my $darwin;
328 my $get_os_info =
329 sub {
330 my ( $name ) = @_;
331 if ( not defined $darwin ) {
332 $darwin->{ operating_system } = "Darwin";
333 # sw_vers prints OS X* version to stdout:
334 # ProductName: OS X*
335 # ProductVersion: 10.4.11
336 # BuildVersion: 8S2167
337 # It does not print codename, so we code OS X* codenames here.
338 my $sw_vers = which( "sw_vers" ) || "/usr/bin/sw_vers";
339 my $output;
340 debug( "Executing $sw_vers..." );
341 execute( [ $sw_vers ], -stdout => \$output, -stderr => undef );
342 $output =~ m{^ProductName:\s*(.*)\s*$}m
343 or runtime_error( "There is no ProductName in sw_vers output:", $output, "(eof)" );
344 my $name = $1;
345 $output =~ m{^ProductVersion:\s*(.*)\s*$}m
346 or runtime_error( "There is no ProductVersion in sw_vers output:", $output, "(eof)" );
347 my $release = $1;
348 # Sometimes release reported as "10.4.11" (3 componentes), sometimes as "10.6".
349 # Handle both variants.
350 $release =~ m{^(\d+.\d+)(?:\.\d+)?(?=\s|$)}
351 or runtime_error( "Cannot parse OS X* version: $release" );
352 my $version = $1;
353 my $codename = ( $codenames{ $version } or "unknown" );
354 $darwin->{ operating_system_name } = $name;
355 $darwin->{ operating_system_release } = $release;
356 $darwin->{ operating_system_codename } = $codename;
357 $darwin->{ operating_system_description } = sprintf( "%s %s (%s)", $name, $release, $codename );
358 }; # if
359 return $darwin->{ $name };
360 }; # sub
361 $values{ operating_system } = sub { $get_os_info->( "operating_system" ); };
362 $values{ operating_system_name } = sub { $get_os_info->( "operating_system_name" ); };
363 $values{ operating_system_release } = sub { $get_os_info->( "operating_system_release" ); };
364 $values{ operating_system_codename } = sub { $get_os_info->( "operating_system_codename" ); };
365 $values{ operating_system_description } = sub { $get_os_info->( "operating_system_description" ); };
366} elsif ( $values{ kernel_name } =~ m{\AWindows[ _]NT\z} ) {
367 $values{ operating_system } = "MS Windows";
368 # my @os_name = Win32::GetOSName();
369 # $values{ operating_system_release } = $os_name[ 0 ];
370 # $values{ operating_system_update } = $os_name[ 1 ];
371} elsif ( $values{ kernel_name } =~ m{\ACYGWIN_NT-} ) {
372 $values{ operating_system } = "MS Windows";
Alp Toker763b9392014-02-28 09:42:41 +0000373} elsif ( $values{ kernel_name } =~ m{\AFreeBSD} ) {
374 $values{ operating_system } = "FreeBSD";
Jim Cownie5e8470a2013-09-27 10:38:44 +0000375} else {
Alp Toker763b9392014-02-28 09:42:41 +0000376 die "Unsupported kernel_name (\"$values{ kernel_name }\") returned by POSIX::uname(); stopped";
Jim Cownie5e8470a2013-09-27 10:38:44 +0000377}; # if
378
379# host_name and domain_name
380$values{ host_name } =
381 sub {
382 my $fqdn = value( "fqdn" );
383 $fqdn =~ m{\A([^.]*)(?:\.(.*))?\z};
384 my $host_name = $1;
385 if ( not defined( $host_name ) or $host_name eq "" ) {
386 die "Unexpected error: undefined or empty host name; stopped";
387 }; # if
388 return $host_name;
389 };
390$values{ domain_name } =
391 sub {
392 my $fqdn = value( "fqdn" );
393 $fqdn =~ m{\A([^.]*)(?:\.(.*))?\z};
394 my $domain_name = $2;
395 if ( not defined( $domain_name ) or $domain_name eq "" ) {
396 die "Unexpected error: undefined or empty domain name; stopped";
397 }; # if
398 return $domain_name;
399 };
400
401# Replace undefined values with "unknown".
402foreach my $name ( @all ) {
403 if ( not defined( $values{ $name } ) ) {
404 $values{ $name } = "unknown";
405 }; # if
406}; # foreach $name
407
408# Export functions reporting properties.
409foreach my $name ( @all ) {
410 no strict "refs";
411 *$name = sub { return value( $name ); };
412}; # foreach $name
413
414# This function returns base names.
415sub base_names {
416 return @base;
417}; # sub base_names
418
419# This function returns all the names.
420sub all_names {
421 return @all;
422}; # sub all_names
423
424# This function returns value by the specified name.
425sub value($) {
426 my $name = shift( @_ );
427 if ( ref( $values{ $name } ) ) {
428 my $value = $values{ $name }->();
429 $values{ $name } = $value;
430 }; # if
431 return $values{ $name };
432}; # sub value
433
434return 1;
435
436__END__
437
438=pod
439
440=head1 NAME
441
442B<Uname.pm> -- A few subroutines to get system information usually provided by
443C</bin/uname> and C<POSIX::uname()>.
444
445=head1 SYNOPSIS
446
447 use Uname;
448
449 # Base property functions.
450 $kernel_name = Uname::kernel_name();
451 $fqdn = Uname::fqdn();
452 $kernel_release = Uname::kernel_release();
453 $kernel_version = Uname::kernel_version();
454 $machine = Uname::machine();
455 $processor = Uname::processor();
456 $hardware_platform = Uname::hardware_platform();
457 $operating_system = Uname::operating_system();
458
Alp Toker8f2d3f02014-02-24 10:40:15 +0000459 # Auxiliary property functions.
Jim Cownie5e8470a2013-09-27 10:38:44 +0000460 $host_name = Uname::host_name();
461 $domain_name = Uname::domain_name();
462 $os_name = Uname::operating_system_name();
463 $os_release = Uname::operating_system_release();
464 $os_codename = Uname::operating_system_codename();
465 $os_description = Uname::operating_system_description();
466
467 # Meta functions.
468 @base_names = Uname::base_names();
469 @all_names = Uname::all_names();
470 $kernel_name = Uname::value( "kernel_name" );
471
472=head1 DESCRIPTION
473
474B<Uname.pm> resembles functionality found in C<POSIX::uname()> function or in C<uname> program.
475However, both C<POSIX::uname()> and C</bin/uname> have some disadvantages:
476
477=over
478
479=item *
480
481C<uname> may be not available in some environments, for example, in Windows* OS
482(C<uname> may be found in some third-party software packages, like MKS Toolkit or Cygwin, but it is
483not a part of OS).
484
485=item *
486
487There are many different versions of C<uname>. For example, C<uname> on OS X* does not
488recognize options C<-i>, C<-o>, and any long options.
489
490=item *
491
492Different versions of C<uname> may report the same property differently. For example,
493C<uname> on Linux* OS reports machine as C<i686>, while C<uname> on OS X* reports the same machine as
494C<x86>.
495
496=item *
497
498C<POSIX::uname()> returns list of values. I cannot recall what is the fourth element of the list.
499
500=back
501
502=head2 Base Functions
503
504Base property functions provide the information as C<uname> program.
505
506=over
507
508=item B<kernel_name()>
509
510Returns the kernel name, as reported by C<POSIX::uname()>.
511
512=item B<fqdn()>
513
514Returns the FQDN, fully qualified domain name. On some systems C<POSIX::uname()> reports short node
515name (with no domain name), on others C<POSIX::uname()> reports full node name. This
516function strive to return FQDN always (by refining C<POSIX::uname()> with
517C<Net::Domain::hostfqdn()>).
518
519=item B<kernel_release()>
520
521Returns the kernel release string, as reported by C<POSIX::uname()>. Usually the string consists of
522several numbers, separated by dots and dashes, but may also include some non-numeric substrings like
523"smp".
524
525=item B<kernel_version()>
526
527Returns the kernel version string, as reported by C<POSIX::uname()>. It is B<not> several
528dot-separated numbers but much longer string describing the kernel.
529For example, on Linux* OS it includes build date.
530If you look for something identifying the kernel, look at L<kernel_release>.
531
532=item B<machine()>
533
534Returns the machine hardware name, as reported by POSIX::uname(). Not reliable. Different OSes may
535report the same machine hardware name differently. For example, Linux* OS reports C<i686>, while OS X*
536reports C<x86> on the same machine.
537
538=item B<processor()>
539
540Returns the processor type. Not reliable. Usually the same as C<machine>.
541
542=item B<hardware_platform()>
543
544One of: C<i386> or C<x86_64>.
545
546=item B<operating_system()>
547
548One of: C<GNU/Linux>, C<OS X*>, or C<MS Windows>.
549
550=back
551
Alp Toker8f2d3f02014-02-24 10:40:15 +0000552=head2 Auxiliary Functions
Jim Cownie5e8470a2013-09-27 10:38:44 +0000553
Alp Toker8f2d3f02014-02-24 10:40:15 +0000554Auxiliary functions extends base functions with information not reported by C<uname> program.
Jim Cownie5e8470a2013-09-27 10:38:44 +0000555
Alp Toker8f2d3f02014-02-24 10:40:15 +0000556Auxiliary functions collect information from different sources. For example, on OS X*, they may
Jim Cownie5e8470a2013-09-27 10:38:44 +0000557call C<sw_vers> program to find out OS release; on Linux* OS they may parse C</etc/redhat-release> file,
558etc.
559
560=over
561
562=item B<host_name()>
563
564Returns host name (FQDN with dropped domain part).
565
566=item B<domain_name()>
567
568Returns domain name (FQDN with dropped host part).
569
570=item B<operating_system_name>
571
572Name of operating system or name of Linux* OS distribution, like "Fedora" or
573"Red Hat Enterprise Linux* OS Server".
574
575=item B<operating_system_release>
576
577Release (version) of operating system or Linux* OS distribution. Usually it is a series of
578dot-separated numbers.
579
580=item B<operating_system_codename>
581
582Codename of operating system release or Linux* OS distribution. For example, Fedora 10 is "Cambridge"
583while OS X* 10.4 is "Tiger".
584
585=item B<operating_system_description>
586
587Longer string. Usually it includes all the operating system properting mentioned above -- name,
588release, codename in parentheses.
589
590=back
591
592=head2 Meta Functions
593
594=over
595
596=item B<base_names()>
597
598This function returns the list of base property names.
599
600=item B<all_names()>
601
602This function returns the list of all property names.
603
604=item B<value(> I<name> B<)>
605
606This function returns the value of the property specified by I<name>.
607
608=back
609
610=head1 EXAMPLES
611
612 use Uname;
613
614 print( Uname::string(), "\n" );
615
616 foreach my $name ( Uname::all_names() ) {
617 print( "$name=\"" . Uname::value( $name ) . "\"\n" );
618 }; # foreach $name
619
620=head1 SEE ALSO
621
622L<POSIX::uname>, L<uname>.
623
624=cut
625
626# end of file #
627