extern depends

This commit is contained in:
Ryan Voots 2013-08-11 19:54:14 -07:00
parent d1277dec55
commit 830fd2af43
51 changed files with 7169 additions and 0 deletions

View file

@ -0,0 +1,45 @@
{
"abstract" : "POSIX::1003, alternative for POSIX in core",
"author" : [
"Mark Overmeer"
],
"dynamic_config" : 0,
"generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120630",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "POSIX-1003",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"Errno" : "0",
"File::Spec" : "0",
"POSIX" : "0",
"Test::More" : "0.47",
"XSLoader" : "0"
}
}
},
"release_status" : "stable",
"version" : "0.93"
}

View file

@ -0,0 +1 @@
{"provides":{"POSIX::1003":{"version":"0.93","file":"POSIX/1003.pm"},"POSIX::1003::Proc":{"version":"0.93","file":"POSIX/1003/Proc.pm"},"POSIX::1003::OS":{"version":"0.93","file":"POSIX/1003/OS.pm"},"POSIX::1003::Confstr":{"version":"0.93","file":"POSIX/1003/Confstr.pm"},"POSIX::1003::FdIO":{"version":"0.93","file":"POSIX/1003/FdIO.pm"},"POSIX::1003::Pathconf":{"version":"0.93","file":"POSIX/1003/Pathconf.pm"},"POSIX::1003::Events":{"version":"0.93","file":"POSIX/1003/Events.pm"},"POSIX::1003::Signals":{"version":"0.93","file":"POSIX/1003/Signals.pm"},"POSIX::1003::Locale":{"version":"0.93","file":"POSIX/1003/Locale.pm"},"POSIX::1003::Limit":{"version":"0.93","file":"POSIX/1003/Limit.pm"},"POSIX::1003::Time":{"version":"0.93","file":"POSIX/1003/Time.pm"},"POSIX::1003::Math":{"version":"0.93","file":"POSIX/1003/Math.pm"},"POSIX::1003::ReadOnlyTable":{"version":"0.93","file":"POSIX/1003/Module.pm"},"POSIX::1003::Termios":{"version":"0.93","file":"POSIX/1003/Termios.pm"},"POSIX::1003::Properties":{"version":"0.93","file":"POSIX/1003/Properties.pm"},"POSIX::1003::Module":{"version":"0.93","file":"POSIX/1003/Module.pm"},"POSIX::1003::FS":{"version":"0.93","file":"POSIX/1003/FS.pm"},"POSIX::1003::Sysconf":{"version":"0.93","file":"POSIX/1003/Sysconf.pm"}},"target":"POSIX::1003::FdIO","version":"0.93","name":"POSIX::1003","dist":"POSIX-1003-0.93","pathname":"M/MA/MARKOV/POSIX-1003-0.93.tar.gz"}

View file

@ -0,0 +1,196 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003;
use vars '$VERSION';
$VERSION = '0.93';
use Carp qw/croak/;
my %own_functions = map +($_ => 1), qw/
posix_1003_modules
posix_1003_names
show_posix_names
/;
our (%EXPORT_TAGS, %IMPORT_FROM);
my %tags =
( confstr => 'POSIX::1003::Confstr'
, cs => 'POSIX::1003::Confstr'
, events => 'POSIX::1003::Events'
, ev => 'POSIX::1003::Events'
, fdio => 'POSIX::1003::FdIO'
, fd => 'POSIX::1003::FdIO'
, filesystem => 'POSIX::1003::FS'
, fs => 'POSIX::1003::FS'
, limit => 'POSIX::1003::Limit'
, limits => 'POSIX::1003::Limit'
, locale => 'POSIX::1003::Locale'
, math => 'POSIX::1003::Math'
, os => 'POSIX::1003::OS'
, opsys => 'POSIX::1003::OS'
, pathconf => 'POSIX::1003::Pathconf'
, pc => 'POSIX::1003::Pathconf'
, processes => 'POSIX::1003::Proc'
, proc => 'POSIX::1003::Proc'
, properties => 'POSIX::1003::Properties'
, property => 'POSIX::1003::Properties'
, props => 'POSIX::1003::Properties'
, posix => 'POSIX::1003::Properties'
, sc => 'POSIX::1003::Sysconf'
, sigaction => 'POSIX::SigAction'
, signals => [qw/POSIX::1003::Signals POSIX::SigSet POSIX::SigAction/]
, sigset => 'POSIX::SigSet'
, sysconf => 'POSIX::1003::Sysconf'
, termio => 'POSIX::1003::Termios'
, termios => 'POSIX::1003::Termios'
, time => 'POSIX::1003::Time'
);
my %mod_tag;
while(my ($tag, $pkg) = each %tags)
{ $pkg = $pkg->[0] if ref $pkg eq 'ARRAY';
$mod_tag{$pkg} = $tag
if !$mod_tag{$pkg}
|| length $mod_tag{$pkg} < length $tag;
}
{ eval "require POSIX::1003::Symbols";
die $@ if $@;
}
while(my ($pkg, $tag) = each %mod_tag) # unique modules
{ $IMPORT_FROM{$_} = $tag for @{$EXPORT_TAGS{$tag}};
}
sub _tag2mods($)
{ my $tag = shift;
my $r = $tags{$tag} or croak "unknown tag '$tag'";
ref $r eq 'ARRAY' ? @$r : $r;
}
sub _mod2tag($) { $mod_tag{$_[0]} }
sub _tags() { keys %tags}
sub import(@)
{ my $class = shift;
my (%mods, %from);
my $level = @_ && $_[0] =~ /^\+(\d+)$/ ? shift : 0;
return if @_==1 && $_[0] eq ':none';
@_ = ':all' if !@_;
no strict 'refs';
no warnings 'once';
my $to = (caller $level)[0];
foreach (@_)
{ if($_ eq ':all')
{ $mods{$_}++ for values %mod_tag;
*{$to.'::'.$_} = \&$_ for keys %own_functions;
}
elsif(m/^\:(.*)/)
{ exists $tags{$1} or croak "unknown tag '$_'";
$mods{$_}++ for map $mod_tag{$_}, _tag2mods $1; # remove aliases
}
elsif($own_functions{$_})
{ *{$to.'::'.$_} = \&$_;
}
else
{ my $mod = $IMPORT_FROM{$_} or croak "unknown symbol '$_'";
push @{$from{$mod}}, $_;
}
}
# no need for separate symbols when we need all
delete $from{$_} for keys %mods;
# print "from $_ all\n" for keys %mods;
# print "from $_ @{$from{$_}}\n" for keys %from;
my $up = '+' . ($level+1);
foreach my $tag (keys %mods) # whole tags
{ foreach my $pkg (_tag2mods($tag))
{ eval "require $pkg"; die $@ if $@;
$pkg->import($up, ':all');
}
}
foreach my $tag (keys %from) # separate symbols
{ foreach my $pkg (_tag2mods($tag))
{ eval "require $pkg"; die $@ if $@;
$pkg->import($up, @{$from{$tag}});
}
}
}
sub posix_1003_modules()
{ my %mods;
foreach my $mods (values %tags)
{ $mods{$_}++ for ref $mods eq 'ARRAY' ? @$mods : $mods;
}
keys %mods;
}
sub posix_1003_names(@)
{ my %names;
my @modules;
if(@_)
{ my %mods;
foreach my $sel (@_)
{ $mods{$_}++ for $sel =~ m/^:(\w+)/ ? _tag2mods($1) : $sel;
}
@modules = keys %mods;
}
else
{ @modules = posix_1003_modules;
}
foreach my $pkg (@modules)
{ eval "require $pkg";
$@ && next; # die?
$pkg->can('import') or next;
$pkg->import(':none'); # create %EXPORT_OK
no strict 'refs';
my $exports = \%{"${pkg}::EXPORT_OK"};
$names{$_} = $pkg for keys %$exports;
}
wantarray ? keys %names : \%names;
}
sub show_posix_names(@)
{ my $pkg_of = posix_1003_names @_;
my %order = map {(my $n = lc $_) =~ s/[^A-Za-z0-9]//g; ($n => $_)}
keys %$pkg_of; # Swartzian transform
no strict 'refs';
foreach (sort keys %order)
{ my $name = $order{$_};
my $pkg = $pkg_of->{$name};
$pkg->import($name);
my $val = $pkg->exampleValue($name);
(my $abbrev = $pkg) =~ s/^POSIX\:\:1003\:\:/::/;
my $mod = $mod_tag{$pkg};
if(defined $val)
{ printf "%-12s :%-10s %-30s %s\n", $abbrev, $mod, $name, $val;
}
else
{ printf "%-12s :%-10s %s\n", $abbrev, $mod, $name;
}
}
print "*** ".(keys %$pkg_of)." symbols in total\n";
}
1;

View file

@ -0,0 +1,290 @@
=encoding utf8
=head1 NAME
POSIX::1003 - bulk-load POSIX::1003 symbols
=head1 SYNOPSIS
use POSIX::1003 qw(:termios :pc PATH_MAX);
# is short for all of these:
use POSIX::1003::Termios qw(:all);
use POSIX::1003::Pathconf qw(:all);
use POSIX::1003::FS qw(PATH_MAX);
# overview about all exported symbols (by a module)
show_posix_names 'POSIX::1003::Pathconf';
show_posix_names ':pc';
perl -MPOSIX::1003 'show_posix_names'
=head1 DESCRIPTION
The L<POSIX::1003|POSIX::1003> suite implements access to many POSIX functions. The
POSIX module in I<core> (distributed with Perl itself) is ancient, the
documentation is usually wrong, and it has too much unusable code in it.
C<POSIX::1003> tries to provide cleaner access to the operating system.
More about the choices made can be found in section L</Rationale>.
=head2 POSIX
The official POSIX standard is large, with over 1200 functions;
L<POSIX::Overview|POSIX::Overview> does list them all. This collection of C<POSIX::1003>
extension provides access to quite a number of those functions, when they
are not provided by "core". They also define as many system constants
as possible. More functions may get added in the future.
B<Start looking in POSIX::Overview>, to discover which module
provides certain functionality. You may also guess the location from
the module names listed in L</DETAILS>, below.
=head2 Bulk loading
It can be quite some work to work-out which modules define what symbols
and then write down all the explicit C<require> lines. Using bulk loading
via this C<POSIX::1003> will be slower during the import (because it needs
to load the location of each of the hundreds of symbols into memory),
but provides convenience: it loads the right modules automagically.
=head3 Exporter
This module uses nasty export tricks, so is not based in Exporter.
Some modules have more than one tag related to them, and one tag may
load multiple modules. When you do not specify symbol or tag, then B<all>
are loaded into your namespace(!), the same behavior as POSIX has.
If your import list starts with C<+1>, the symbols will not get into
your own namespace, but that of your caller. Just like
C<$Exporter::ExportLevel> (but a simpler syntax).
use POSIX::1003 ':pathconf';
use POSIX::1003 ':pc'; # same, abbreviated name
use POSIX::1003 qw(PATH_MAX :math sin);
sub MyModule::import(@) # your own tricky exporter
{ POSIX::1003->import('+1', @_);
}
=head3 EXPORT_TAGS
:all (all symbols, default)
:cs :confstr POSIX::1003::Confstr
:ev :events POSIX::1003::Events
:fd :fdio POSIX::1003::FdIO
:fs :filesystem POSIX::1003::FS
:limit :limits POSIX::1003::Limit
:locale POSIX::1003::Locale
:math POSIX::1003::Math
:none (nothing)
:os :opsys POSIX::1003::OS
:pc :pathconf POSIX::1003::Pathconf
:proc :processes POSIX::1003::Proc
:props :properties POSIX::1003::Properties
:posix :property POSIX::1003::Properties
:sc :sysconf POSIX::1003::Sysconf
:signals POSIX::1003::Signals
:signals :sigaction POSIX::SigAction
:signals :sigset POSIX::SigSet
:termio :termios POSIX::1003::Termios
:time POSIX::1003::Time
=head1 FUNCTIONS
=over 4
=item B<posix_1003_modules>()
Returns the names of all modules in the current release of POSIX::1003.
=item B<posix_1003_names>([MODULES|TAGS])
Returns all the names, when in LIST content. In SCALAR context,
it returns (a reference to) an HASH which contains exported names
to modules mappings. If no explicit MODULES are specified, then all
available modules are taken.
=item B<show_posix_names>([MODULES|TAGS])
Print all names defined by the POSIX::1003 suite in alphabetical
(case-insensitive) order. If no explicit MODULES are specified, then all
available modules are taken.
=back
=head1 DETAILS
=head2 Modules in this distribution
=over 4
=item L<POSIX::1003::Confstr|POSIX::1003::Confstr>
Provide access to the C<_CS_*> constants.
=item L<POSIX::1003::FdIO|POSIX::1003::FdIO>
Provides unbuffered IO handling; based on file-descriptors.
=item L<POSIX::1003::FS|POSIX::1003::FS>
Some generic file-system information. See also L<POSIX::1003::Pathconf|POSIX::1003::Pathconf>
for more precise info.
=item L<POSIX::1003::Locale|POSIX::1003::Locale>
Locales, see also L<perllocale>.
=item L<POSIX::1003::Math|POSIX::1003::Math>
Standard math functions of unknown precission.
=item L<POSIX::1003::OS|POSIX::1003::OS>
A few ways to get Operating system information.
See also L<POSIX::1003::Sysconf|POSIX::1003::Sysconf>, L<POSIX::1003::Confstr|POSIX::1003::Confstr>, and
L<POSIX::1003::Properties|POSIX::1003::Properties>,
=item L<POSIX::1003::Pathconf|POSIX::1003::Pathconf>
Provide access to the C<pathconf()> and its trillion C<_PC_*> constants.
=item L<POSIX::1003::Properties|POSIX::1003::Properties>
Provide access to the C<_POSIX_*> constants.
=item L<POSIX::1003::Signals|POSIX::1003::Signals>
With helper modules L<POSIX::SigSet|POSIX::SigSet> and L<POSIX::SigAction|POSIX::SigAction>.
=item L<POSIX::1003::Sysconf|POSIX::1003::Sysconf>
Provide access to the C<sysconf> and its zillion C<_SC_*> constants.
=item L<POSIX::1003::Termios|POSIX::1003::Termios>
Terminal IO
=item L<POSIX::1003::Time|POSIX::1003::Time>
Time-stamp processing
=item L<POSIX::1003::Limit|POSIX::1003::Limit>
For getting and setting resource limits.
=back
=head2 Other modules
=over 4
=item User::pwent
Provides an OO interface around C<getpw*()>
=item User::grent
Provides an OO interface around C<getgr*()>
=back
=head2 Rationale
The POSIX module as distributed with Perl itself is ancient (it dates
before Perl5) Although it proclaims that it provides access to all
POSIX functions, it only lists about 200 out of 1200. From that subset,
half of the functions with croak when you use them, complaining that
they cannot get implemented in Perl for some reason.
Many other functions provided by POSIX-in-Core simply forward the caller
to a function with the same name which is in basic perl (see perldoc).
With a few serious complications: the functions in POSIX do not use
prototypes, sometimes expect different arguments and sometimes return
different values.
Back to the basics: the L<POSIX::1003|POSIX::1003> provides access to the POSIX
libraries where they can be made compatible with Perl's way of doing
things. For instance, C<setuid> of POSIX is implemented with C<$)>,
whose exact behavior depends on compile-flags and OS: it's not the pure
C<setuid()> of the standard hence left-out. There is no C<isalpha()>
either: not compatible with Perl strings and implemented very different
interface from POSIX. And there is also no own C<exit()>, because we have
a C<CORE::exit()> with the same functionality.
=head2 POSIX::1003 compared to POSIX
This distribution does not add much functionality itself: it is
mainly core's POSIX.xs (which is always available and ported to
all platforms). You can access these routines via POSIX as
well.
When you are used to POSIX.pm but want to move to L<POSIX::1003|POSIX::1003>,
you must be aware about the following differences:
=over 4
=item *
the constants and functions are spread over many separate modules,
based on their purpose, where POSIX uses a header filename as
tag to group provided functionality.
=item *
functions provided by CORE are usually not exported again by
POSIX::1003 (unless to avoid confusion, for instance: is
C<atan2()> in core or ::Math?)
=item *
constants which are already provided via Fcntl or Errno are
not provided by this module as well. This should reduce the chance
for confusion.
=item *
functions which are also in CORE can be imported, but will silently
be ignored. In C<POSIX>, functions with the same name get exported
without prototype, which does have consequences for interpretation of
your program. This module uses prototypes on all exported functions,
like CORE does.
=item *
hundreds of C<_SC_*>, C<_CS_*>, C<_PC_*>, C<_POSIX_*>, C<UL_*>,
and C<RLIMIT_*> constants were collected from various sources, not just
a minimal subset. You get access to all defined on your system.
=item *
when an user program addresses a constant which is not defined by the
system, POSIX will croak. Modules in POSIX::1003 on the other hand,
will return C<undef>.
This simplifies code like this:
use POSIX::1003::FS 'PATH_MAX';
use POSIX::1003::PathConfig '_PC_PATH_MAX';
my $max_fn = _PC_PATH_MAX($fn) // PATH_MAX // 1024;
With the tranditional POSIX, you have to C<eval()> each use
of a constant.
=back
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,67 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Confstr;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
use Carp 'croak';
my @constants;
my @functions = qw/confstr confstr_names/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, tables => [ '%confstr' ]
);
my $confstr;
our %confstr;
sub confstr($);
BEGIN {
# initialize the :constants export tag
$confstr = confstr_table;
push @constants, keys %$confstr;
tie %confstr, 'POSIX::1003::ReadOnlyTable', $confstr;
}
sub exampleValue($)
{ my ($class, $name) = @_;
$name =~ m/^_CS_/ or return;
my $val = confstr $name;
defined $val ? "'$val'" : 'undef';
}
#-----------------------
sub confstr($)
{ my $key = shift // return;
$key =~ /^_CS_/
or croak "pass the constant name as string";
my $id = $confstr->{$key} // return;
_confstr($id);
}
sub _create_constant($)
{ my ($class, $name) = @_;
my $id = $confstr->{$name} // return sub() {undef};
sub() {_confstr($id)};
}
#--------------------------
sub confstr_names() { keys %$confstr }
#--------------------------
1;

View file

@ -0,0 +1,163 @@
=encoding utf8
=head1 NAME
POSIX::1003::Confstr - POSIX access to confstr()
=head1 SYNOPSIS
use POSIX::1003::Confstr; # import all
use POSIX::1003::Confstr 'confstr';
my $path = confstr('_CS_PATH');
use POSIX::1003::Confstr '_CS_PATH';
my $path = _CS_PATH;
use POSIX::1003::Confstr '%confstr';
my $key = $confstr{_CS_PATH};
$confstr{_CS_NEW_CONF} = $key;
=head1 DESCRIPTION
With C<confstr()> you can retreive string values from the operating
system. It is the counterpart of C<sysconf()> which can only return
numeric values.
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<confstr>(NAME)
Returns the confstr value related to the NAMEd constant. The NAME
must be a string. C<undef> will be returned when the NAME is not
known by the system.
example:
my $path = confstr('_CS_PATH') || '/bin:/usr/bin';
=back
=head2 Additional
=over 4
=item B<confstr_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%confstr>
This exported variable is a (tied) HASH which maps C<_CS_*>
names to the unique numbers to be used with the system's C<confstr()>
function.
=back
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned at that time.
=for comment
#TABLE_CONFSTR_START
_CS_GNU_LIBC_VERSION 'glibc 2.15'
_CS_GNU_LIBPTHREAD_VERSION 'NPTL 2.15'
_CS_LFS64_CFLAGS '-D_LARGEFILE64_SOURCE'
_CS_LFS64_LDFLAGS ''
_CS_LFS64_LIBS ''
_CS_LFS64_LINTFLAGS '-D_LARGEFILE64_SOURCE'
_CS_LFS_CFLAGS ''
_CS_LFS_LDFLAGS ''
_CS_LFS_LIBS ''
_CS_LFS_LINTFLAGS ''
_CS_PATH '/bin:/usr/bin'
_CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 'XBS5_LP64_OFF64'
_CS_POSIX_V6_ILP32_OFF32_CFLAGS ''
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS ''
_CS_POSIX_V6_ILP32_OFF32_LIBS ''
_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS ''
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS ''
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS ''
_CS_POSIX_V6_ILP32_OFFBIG_LIBS ''
_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS ''
_CS_POSIX_V6_LP64_OFF64_CFLAGS '-m64'
_CS_POSIX_V6_LP64_OFF64_LDFLAGS '-m64'
_CS_POSIX_V6_LP64_OFF64_LIBS ''
_CS_POSIX_V6_LP64_OFF64_LINTFLAGS ''
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS ''
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS ''
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS ''
_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS ''
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 'POSIX_V6_LP64_OFF64'
_CS_POSIX_V7_ILP32_OFF32_CFLAGS ''
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS ''
_CS_POSIX_V7_ILP32_OFF32_LIBS ''
_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS ''
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS ''
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS ''
_CS_POSIX_V7_ILP32_OFFBIG_LIBS ''
_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS ''
_CS_POSIX_V7_LP64_OFF64_CFLAGS '-m64'
_CS_POSIX_V7_LP64_OFF64_LDFLAGS '-m64'
_CS_POSIX_V7_LP64_OFF64_LIBS ''
_CS_POSIX_V7_LP64_OFF64_LINTFLAGS ''
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS ''
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS ''
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS ''
_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS ''
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 'POSIX_V7_LP64_OFF64'
_CS_V5_WIDTH_RESTRICTED_ENVS 'XBS5_LP64_OFF64'
_CS_V6_WIDTH_RESTRICTED_ENVS 'POSIX_V6_LP64_OFF64'
_CS_V7_WIDTH_RESTRICTED_ENVS 'POSIX_V7_LP64_OFF64'
_CS_XBS5_ILP32_OFF32_CFLAGS ''
_CS_XBS5_ILP32_OFF32_LDFLAGS ''
_CS_XBS5_ILP32_OFF32_LIBS ''
_CS_XBS5_ILP32_OFF32_LINTFLAGS ''
_CS_XBS5_ILP32_OFFBIG_CFLAGS ''
_CS_XBS5_ILP32_OFFBIG_LDFLAGS ''
_CS_XBS5_ILP32_OFFBIG_LIBS ''
_CS_XBS5_ILP32_OFFBIG_LINTFLAGS ''
_CS_XBS5_LP64_OFF64_CFLAGS '-m64'
_CS_XBS5_LP64_OFF64_LDFLAGS '-m64'
_CS_XBS5_LP64_OFF64_LIBS ''
_CS_XBS5_LP64_OFF64_LINTFLAGS ''
_CS_XBS5_LPBIG_OFFBIG_CFLAGS ''
_CS_XBS5_LPBIG_OFFBIG_LDFLAGS ''
_CS_XBS5_LPBIG_OFFBIG_LIBS ''
_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS ''
=for comment
#TABLE_CONFSTR_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,67 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Events;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
my @constants;
my @functions = qw/
FD_CLR FD_ISSET FD_SET FD_ZERO select
poll poll_names
/;
my @poll = qw(poll poll_names);
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
my $poll;
BEGIN {
$poll = poll_table;
push @constants, keys %$poll;
}
sub select($$$;$)
{ push @_, undef if @_==3;
goto &select;
}
sub FD_CLR($$) {vec($_[1],$_[0],1) = 0}
sub FD_ISSET($$) {vec($_[1],$_[0],1) ==1}
sub FD_SET($$) {vec($_[1],$_[0],1) = 1}
sub FD_ZERO($) {$_[0] = 0}
sub poll($;$)
{ my ($data, $timeout) = @_;
defined $timeout or $timeout = -1;
_poll($data, $timeout);
}
#----------------------
sub poll_names() { keys %$poll }
sub _create_constant($)
{ my ($class, $name) = @_;
$name =~ m/^POLL/
or die "constants expected to start with POLL, not $name\n";
my $val = $poll->{$name} // return sub() {undef};
sub() {$val};
}
#----------------------
1;

View file

@ -0,0 +1,112 @@
=encoding utf8
=head1 NAME
POSIX::1003::Events - POSIX for the file-system
=head1 SYNOPSIS
use POSIX::1003::Events;
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<FD_CLR>(FD, SET)
Remove the file descriptor FD from the SET. If FD is not a member of
this set, there shall be no effect on the set, nor will an error be
returned.
=item B<FD_ISSET>(FD, SET)
Returns true if the file descriptor FD is a member of the SET
=item B<FD_SET>(FD, SET)
Add the file descriptor FD to the SET
If the file descriptor FD is already in this set, there
is no effect on the set, nor will an error be returned.
=item B<FD_ZERO>(SET)
Clear the set
=item B<poll>(HASH, [TIMEOUT])
If TIMEOUT is not defined, the poll will wait until something
happend. When C<undef> is returned, then there is an error.
With an empy HASH returned, then the poll timed out. Otherwise,
the returned HASH contains the FDs where something happened.
=item B<select>(RBITS, WBITS, EBITS, [TIMEOUT])
Perl core contains two functions named C<select>. The second is the
one we need here. Without TIMEOUT, the select will wait until an event
emerges (or an interrupt).
In the example below, C<$rin> is a bit-set indicating on which
file-descriptors should be listed for read events (I<data available>)
and C<$rout> is a sub-set of that. The bit-sets can be manipulated
with the C<FD_*> functions also exported by this module.
my ($nfound, $timeleft) =
select($rout=$rin, $wout=$win, $eout=$ein, $timeout);
my $nfound = select($rout=$rin, $wout=$win, $eout=$ein);
The C<select> interface is inefficient when used with many filehandles.
You can better use L<poll()|POSIX::1003::Events/"Standard POSIX">.
=back
=head2 Additional
=over 4
=item B<poll_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned at that time.
=for comment
#TABLE_POLL_START
POLLERR 8 POLLOUT 4 POLLWRBAND 512
POLLHUP 16 POLLPRI 2 POLLWRNORM 256
POLLIN 1 POLLRDBAND 128
POLLNVAL 32 POLLRDNORM 64
=for comment
#TABLE_POLL_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,84 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::FS;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks resp from unistd.h, stdio.h, limits.h
my @constants;
my @access = qw/access/;
my @stat_checks = qw/S_ISDIR S_ISCHR S_ISBLK S_ISREG S_ISFIFO
S_ISLNK S_ISSOCK S_ISWHT/;
my @stat = (qw/stat lstat/, @stat_checks);
sub S_ISDIR($) { ($_[0] & S_IFMT()) == S_IFDIR()}
sub S_ISCHR($) { ($_[0] & S_IFMT()) == S_IFCHR()}
sub S_ISBLK($) { ($_[0] & S_IFMT()) == S_IFBLK()}
sub S_ISREG($) { ($_[0] & S_IFMT()) == S_IFREG()}
sub S_ISFIFO($) { ($_[0] & S_IFMT()) == S_IFIFO()}
sub S_ISLNK($) { ($_[0] & S_IFMT()) == S_IFLNK()}
sub S_ISSOCK($) { ($_[0] & S_IFMT()) == S_IFSOCK()}
sub S_ISWHT($) { ($_[0] & S_IFMT()) == S_IFWHT()} # FreeBSD
# POSIX.xs defines L_ctermid L_cuserid L_tmpname: useless!
# Blocks resp from sys/stat.h, unistd.h, utime.h, sys/types
my @functions = qw/
mkfifo mknod stat lstat rename
access lchown
utime
major minor makedev
/;
our @IN_CORE = qw(utime mkdir stat lstat rename);
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, access => \@access
, stat => \@stat
, tables => [ qw/%access %stat/ ]
);
my ($fsys, %access, %stat);
BEGIN {
$fsys = fsys_table;
push @constants, keys %$fsys;
# initialize the :access export tag
push @access, grep /_OK$/, keys %$fsys;
my %access_subset;
@access_subset{@access} = @{$fsys}{@access};
tie %access, 'POSIX::1003::ReadOnlyTable', \%access_subset;
# initialize the :fsys export tag
push @stat, grep /^S_/, keys %$fsys;
my %stat_subset;
@stat_subset{@stat} = @{$fsys}{@stat};
tie %stat, 'POSIX::1003::ReadOnlyTable', \%stat_subset;
}
sub lchown($$@)
{ my ($uid, $gid) = (shift, shift);
my $successes = 0;
POSIX::lchown($uid, $gid, $_) && $successes++ for @_;
$successes;
}
sub _create_constant($)
{ my ($class, $name) = @_;
my $val = $fsys->{$name};
sub() {$val};
}
1;

View file

@ -0,0 +1,177 @@
=encoding utf8
=head1 NAME
POSIX::1003::FS - POSIX for the file-system
=head1 SYNOPSIS
use POSIX::1003::FS ':access';
if(access $fn, R_OK) # $fn is readible?
use POSIX::1003::FS qw(mkfifo :stat);
mkfifo($path, S_IRUSR|S_IWUSR) or die $!;
# Absorbed from Unix::Mknod
use POSIX::1003::FS qw(mknod major minor makedev);
use File::stat
my $st = stat '/dev/null';
my $major = major $st->rdev;
my $minor = minor $st->rdev;
mknod '/tmp/special', S_IFCHR|0600, makedev($major,$minor+1);
=head1 DESCRIPTION
You may also need L<POSIX::1003::Pathconf|POSIX::1003::Pathconf>.
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<access>(FILENAME, FLAGS)
Read C<man filetest> before you start using this function!
Use the C<*_OK> constants for FLAGS.
=item B<lchown>(UID, GID, FILENAMES)
Like C<chown()>, but does not follow symlinks when encountered. Returns
the number of files successfully changed.
B<Warning>, POSIX uses different parameter order:
# POSIX specification:
# int lchown(const char *path, uid_t owner, gid_t group);
# Perl core implementation:
my $successes = chown($uid, $gid, @filenames);
use POSIX;
POSIX::lchown($uid, $gid, $filename) or die $!;
use POSIX::1003::FS 'lchown';
my @successes = lchown($uid, $gid, @filenames);
=item B<mkdir>([FILENAME [MASK]])
Simple C<CORE::mkdir()>
=item B<mkfifo>(FILENAME, MODE)
=item B<mknod>(PATH, MODE, DEVICE)
Create a special device node on PATH. Useful symbols for MODE can be
collected from Fcntl (import tag C<:mode>). The DEVICE number is
a combination from the type (I<major> number), a sequence number and
usage information (combined in a I<minor> number).
=item B<rename>(OLDNAME, NEWNAME)
[0.93] This will use C<CORE::rename()>. Be warned that Window's C<rename>
implementation will fail when NEWNAME exists, which is not POSIX compliant.
On many platforms, C<rename> between different partitions is not allowed.
=item B<utime>(ATIME, MTIME, FILENAMES)
Simply C<CORE::utime()>
B<Warning,> C<POSIX.pm> uses a different parameter order than core.
POSIX::utime($filename, $atime, $mtime);
CORE::utime($atime, $mtime, @filenames);
=back
=head2 Additional
=over 4
=item B<S_ISBLK>(MODE)
=item B<S_ISCHR>(MODE)
=item B<S_ISDIR>(MODE)
example:
use File::stat 'stat';
if(S_ISDIR(stat($fn)->mode)) ...
if(S_ISDIR((lstat $fn)[2])) ...
=item B<S_ISFIFO>(MODE)
=item B<S_ISLNK>(MODE)
=item B<S_ISREG>(MODE)
=item B<S_ISSOCK>(MODE)
=item B<S_ISWHT>(MODE)
=item B<major>(DEVICE)
=item B<makedev>(MAJOR, MINOR)
Combine MAJOR and MINOR into a single DEVICE number.
my $device = (stat $filename)[6];
my $device_type = major $device;
my $sequence_nr = minor $device;
my $device = makedev $major, $minor;
mknod $specialfile, $mode, $device;
=item B<minor>(DEVICE)
=back
=head1 CONSTANTS
The following constants are exported, shown here with the values
discovered during installation of this module:
=for comment
#TABLE_FSYS_START
F_OK 0 S_IFLNK 40960 S_ISVTX 512
FILENAME_MAX 4096 S_IFMT 61440 S_IWGRP 16
MAX_CANON 255 S_IFREG 32768 S_IWOTH 2
NAME_MAX 255 S_IFSOCK 49152 S_IWUSR 128
PATH_MAX 4096 S_IRGRP 32 S_IXGRP 8
R_OK 4 S_IROTH 4 S_IXOTH 1
S_IFBLK 24576 S_IRUSR 256 S_IXUSR 64
S_IFCHR 8192 S_IRWXG 56 W_OK 2
S_IFDIR 16384 S_IRWXO 7 X_OK 1
S_IFIFO 4096 S_IRWXU 448
=for comment
#TABLE_FSYS_END
All functions and constants which start with C<S_*> can be imported
using the C<:stat> tag, including all related C<S_IF*> functions.
The C<*_OK> tags can be imported with C<:access> =cut
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,70 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::FdIO;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks resp from unistd.h, limits.h, and stdio.h
my (@constants, @seek, @mode);
my @functions = qw/closefd creatfd dupfd dup2fd openfd pipefd
readfd seekfd writefd tellfd/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, seek => \@seek
, mode => \@mode
, tables => [ qw/%seek %mode/ ]
);
my $fdio;
our (%fdio, %seek, %mode);
BEGIN {
$fdio = fdio_table;
push @constants, keys %$fdio;
# initialize the :seek export tag
push @seek, grep /^SEEK_/, keys %$fdio;
my %seek_subset;
@seek_subset{@seek} = @{$fdio}{@seek};
tie %seek, 'POSIX::1003::ReadOnlyTable', \%seek_subset;
# initialize the :mode export tag
push @mode, grep /^O_/, keys %$fdio;
my %mode_subset;
@mode_subset{@mode} = @{$fdio}{@mode};
tie %mode, 'POSIX::1003::ReadOnlyTable', \%mode_subset;
}
sub seekfd($$$) { goto &POSIX::lseek }
sub openfd($$;$) { goto &POSIX::open }
sub closefd($) { goto &POSIX::close }
sub readfd($$;$) { push @_, SSIZE_MAX() if @_==2; goto &POSIX::read }
sub writefd($$;$) { push @_, length $_[1] if @_==2; goto &POSIX::write }
sub pipefd() { goto &POSIX::pipe }
sub dupfd($) { goto &POSIX::dup }
sub dup2fd($$) { goto &POSIX::dup2 }
sub statfd($) { goto &POSIX::fstat }
sub creatfd($$) { openfd $_[0], O_WRONLY()|O_CREAT()|O_TRUNC(), $_[1] }
sub tellfd($) {seekfd $_[0], 0, SEEK_CUR() }
sub rewindfd() {seekfd $_[0], 0, SEEK_SET() }
sub _create_constant($)
{ my ($class, $name) = @_;
my $val = $fdio->{$name};
sub() {$val};
}
1;

View file

@ -0,0 +1,244 @@
=encoding utf8
=head1 NAME
POSIX::1003::FdIO - POSIX handling file descriptors
=head1 SYNOPSIS
use POSIX::1003::FdIO;
$fd = openfd($fn, O_RDWR);
defined $fd or die $!; # $fd==0 is valid value! (STDIN)
$fd = openfd($fn, O_WRONLY|O_TRUNC);
$fd = openfd($fn, O_CREAT|O_WRONLY, 0640);
# Permission bit constants in POSIX::1003::FS
my $buf;
$bytes_read = readfd($fd, $buf, BUFSIZ);
$bytes_written = writefd($fd, $buf, 5);
$off_t = seekfd($fd, 0, SEEK_SET); # rewind!
$fd2 = dupfd($fd);
closefd($fd) or die $!;
my ($r, $w) = pipefd();
writefd($w, "hello", 5);
readfd($r, $buf, 5);
closefd($r) && closefd($w) or die $!;
=head1 DESCRIPTION
Most people believe that the C<sys*> commands in Perl-Core are not
capable of doing unbuffered IO. For those people, we have this module.
Whether C<sysread()> or L<readfd()|POSIX::1003::FdIO/"Standard POSIX"> is meassurable faster cannot be
answered.
=head1 FUNCTIONS
=head2 Overview
Perl defaults to use file-handles avoiding file descriptors. For
that reason, the C<fread> of POSIX is the C<read> of Perl; that's
confusing. The POSIX-in-Core implementation makes you write
C<CORE::read()> and C<POSIX::read()> explicitly. However,
C<POSIX::read()> is the same as C<CORE::sysread()>!
For all people who do not trust the C<sys*> commands (and there are
many), we provide the implementation of POSIX-in-Core with a less
confusing name to avoid accidents.
POSIX Perl-Core POSIX.pm POSIX::1003::FdIO
FH fseek seek
FD lseek sysseek lseek seekfd
FH fopen open
FD open sysopen openfd # sysopen is clumpsy
FD fdopen # IO::Handle->new_from_fd
FH fclose close
FD close close close closefd
FH fread read
FD read sysread read readfd
FH fwrite print
FD write syswrite write writefd
FH pipe,open # buffered unless $|=0
FD pipe pipe pipefd
FH stat stat
FD fstat fstat statfd
FN lstat lstat
FH ftell tell
FD tellfd # tell on fd not in POSIX
FH rewind rewind
FD rewindfd # idem
FD creat creat creatfd
FD dup dupfd
Works on: FH=file handle, FD=file descriptor, FN=file name
=head2 Standard POSIX
=over 4
=item B<closefd>(FD)
Always check the return code: C<undef> on error, cause in C<$!>.
closefd $fd or die $!;
There is no C<sysclose()> in core, because C<sysopen()> does unbuffered
IO via its perl-style file-handle: when you open with C<CORE::sysopen()>,
you must close with C<CORE::close()>.
=item B<creatfd>(FILENAME, MODE)
Implemented via L<openfd()|POSIX::1003::FdIO/"Standard POSIX">, which is true by definition of POSIX.
=item B<dup2fd>(FD, NEWFD)
Copy file-descriptor FD to an explicit NEWFD number. When already
in use, the file at NEWFD will be closed first. Returns undef on
failure.
=item B<dupfd>(FD)
Copy the file-descriptor FD into the lowest-numbered unused descriptor.
The new fd is returned, undef on failure.
=item B<openfd>(FILENAME, FLAGS, MODE)
Returned is an integer file descriptor (FD). Returns C<undef> on
failure (and '0' is a valid FD!)
FLAGS are composed from the C<O_*> constants defined by this module (import
tag C<:mode>) The MODE field combines C<S_I*> constants defined by
L<POSIX::1003::FS|POSIX::1003::FS> (import tag C<:stat>).
=item B<pipefd>()
Returns the reader and writer file descriptors.
my ($r, $w) = pipefd;
writefd($w, "hello", 5 );
readfd($r, $buf, 5 );
=item B<readfd>(FD, SCALAR, [LENGTH])
Read the maximum of LENGTH bytes from FD into the SCALAR. Returned is
the actual number of bytes read. The value C<-1> tells you there is
an error, reported in C<$!>
B<Be warned> that a returned value smaller than LENGTH does not mean
that the FD has nothing more to offer: the end is reached only when 0
(zero) is returned. Therefore, this reading is quite inconvenient.
You may want to use POSIX::Util subroutine readfd_all
=item B<seekfd>(FD, OFFSET, WHENCE)
The WHENCE is a C<SEEK_*> constant.
=item B<statfd>(FD)
Request file administration information about an open file. It returns
the same list of values as C<stat> on filenames.
=item B<writefd>(FD, BYTES, [LENGTH])
Attempt to write the first LENGTH bytes of STRING to FD. Returned is
the number of bytes actually written. You have an error only when C<-1>
is returned.
The number of bytes written can be less than LENGTH without an error
condition: you have to call write again with the remaining bytes. This
is quite inconvenient. You may want to use POSIX::Util subroutine readfd_all
=back
=head2 Additional
Zillions of Perl programs reimplement these functions. Let's simplify
code.
=over 4
=item B<rewindfd>(FD)
Seek to the beginning of the file
=item B<tellfd>(FD)
Reports the location in the file. This call does not exist (not in POSIX,
nor on other UNIXes), however is a logical counterpart of the C<tell()> on
filenames.
=back
=head1 CONSTANTS
The following constants are exported, shown here with the values
discovered during installation of this module.
=for comment
#TABLE_FDIO_START
BUFSIZ 8192
EOF -1
MAX_INPUT 255
O_APPEND 1024
O_ASYNC 8192
O_CLOEXEC 524288
O_CREAT 64
O_DIRECT 16384
O_DIRECTORY 65536
O_DSYNC 4096
O_EXCL 128
O_FSYNC 1052672
O_LARGEFILE 0
O_NDELAY 2048
O_NOATIME 262144
O_NOCTTY 256
O_NOFOLLOW 131072
O_NONBLOCK 2048
O_RDONLY 0
O_RDWR 2
O_RSYNC 1052672
O_SYNC 1052672
O_TRUNC 512
O_WRONLY 1
PIPE_BUF 4096
SEEK_CUR 1
SEEK_DATA 3
SEEK_END 2
SEEK_HOLE 4
SEEK_SET 0
SSIZE_MAX 9223372036854775807
STDERR_FILENO 2
STDIN_FILENO 0
STDOUT_FILENO 1
=for comment
#TABLE_FDIO_END
You can limit the import to the C<SEEK_*> constants by explicitly
using the C<:seek> import tag. Use the C<:mode> for all C<O_*>
constants, to be used with L<openfd()|POSIX::1003::FdIO/"Standard POSIX">.
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,140 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Limit;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
use Carp 'croak';
my (@ulimit, @rlimit, @constants, @functions);
our %EXPORT_TAGS =
( ulimit => \@ulimit
, rlimit => \@rlimit
, constants => \@constants
, functions => \@functions
, tables => [ qw/%ulimit %rlimit/ ]
);
my ($ulimit, $rlimit);
our (%ulimit, %rlimit);
my ($rlim_saved_max, $rlim_saved_cur, $rlim_infinity);
BEGIN {
# initialize the :constants export tag
my @ufuncs = qw/ulimit ulimit_names/;
my @rfuncs = qw/getrlimit setrlimit rlimit_names/;
my @rconst = qw/RLIM_SAVED_MAX RLIM_SAVED_CUR RLIM_INFINITY/;
$ulimit = ulimit_table;
@ulimit = (keys %$ulimit, @ufuncs, '%ulimit');
tie %ulimit, 'POSIX::1003::ReadOnlyTable', $ulimit;
$rlimit = rlimit_table;
@rlimit = (keys %$rlimit, @rfuncs, @rconst, '%rlimit');
tie %rlimit, 'POSIX::1003::ReadOnlyTable', $rlimit;
push @constants, keys %$ulimit, keys %$rlimit;
push @functions, @ufuncs, @rfuncs;
# Special meaning for
$rlim_saved_max = delete $rlimit->{RLIM_SAVED_MAX};
$rlim_saved_cur = delete $rlimit->{RLIM_SAVED_CUR};
$rlim_infinity = delete $rlimit->{RLIM_INFINITY};
}
sub RLIM_SAVED_MAX { $rlim_saved_max }
sub RLIM_SAVED_CUR { $rlim_saved_cur }
sub RLIM_INFINITY { $rlim_infinity }
sub getrlimit($);
sub setrlimit($$;$);
sub ulimit($;$);
sub exampleValue($)
{ my ($class, $name) = @_;
if($name =~ m/^RLIMIT_/)
{ my ($soft, $hard, $success) = getrlimit $name;
$soft //= 'undef';
$hard //= 'undef';
return "$soft, $hard";
}
elsif($name =~ m/^UL_GET|^GET_/)
{ my $val = ulimit $name;
return defined $val ? $val : 'undef';
}
elsif($name =~ m/^UL_SET|^SET_/)
{ return '(setter)';
}
else
{ $class->SUPER::exampleValue($name);
}
}
sub ulimit($;$)
{ my $key = shift // return;
if(@_)
{ $key =~ /^UL_SET|^SET_/
or croak "pass the constant name as string ($key)";
my $id = $ulimit->{$key} // return;
return _ulimit($id, shift);
}
else
{ $key =~ /^UL_GET|^GET_/
or croak "pass the constant name as string ($key)";
my $id = $ulimit->{$key} // return;
_ulimit($id, 0);
}
}
sub _create_constant($)
{ my ($class, $name) = @_;
if($name =~ m/^RLIMIT_/)
{ my $id = $rlimit->{$name} // return sub() {undef};
return sub(;$$) { @_ ? _setrlimit($id, $_[0], $_[1]) : (_getrlimit($id))[0] };
}
else
{ my $id = $ulimit->{$name} // return sub() {undef};
return $name =~ m/^UL_GET|^GET_/
? sub() {_ulimit($id, 0)} : sub($) {_ulimit($id, shift)};
}
}
sub getrlimit($)
{ my $key = shift // return;
$key =~ /^RLIMIT_/
or croak "pass the constant name as string ($key)";
my $id = $rlimit->{$key};
defined $id ? _getrlimit($id) : ();
}
sub setrlimit($$;$)
{ my ($key, $cur, $max) = @_;
$key =~ /^RLIMIT_/
or croak "pass the constant name as string ($key)";
my $id = $rlimit->{$key};
$max //= RLIM_INFINITY;
defined $id ? _setrlimit($id, $cur, $max) : ();
}
sub ulimit_names() { keys %$ulimit }
sub rlimit_names() { keys %$rlimit }
1;

View file

@ -0,0 +1,171 @@
=encoding utf8
=head1 NAME
POSIX::1003::Limit - POSIX access to ulimit and rlimit
=head1 SYNOPSIS
# ULIMIT support
use POSIX::1003::Limit; # load all names
use POSIX::1003::Limit qw(ulimit);
# keys are strings!
$size = ulimit('UL_GETFSIZE');
use POSIX::1003::Limit qw(ulimit UL_GETFSIZE);
$size = UL_GETFSIZE; # constants are subs
use POSIX::1003::Limit '%ulimit';
my $key = $ulimit{UL_GETFSIZE};
$ulimit{_SC_NEW_KEY} = $key_code;
$size = ulimit($key);
print "$_\n" for keys %ulimit;
# RLIMIT support
use POSIX::1003::Limit ':rlimit';
my ($cur, $max, $success) = getrlimit('RLIMIT_CORE');
my ($cur, $max) = getrlimit('RLIMIT_CORE');
my $cur = RLIMIT_CORE;
my $success = setrlimit('RLIMIT_CORE', 1e6, 1e8);
setrlimit('RLIMIT_CORE', 1e6) or die;
setrlimit('RLIMIT_CORE', RLIM_SAVED_MAX, RLIM_INFINITY);
RLIMIT_CORE(1e6, 1e8);
=head1 DESCRIPTION
This module provides access to the "ulimit" (user limit) and "rlimit"
(resource limit) handling. On most systems, C<ulimit()> is succeeded
by C<rlimit()> hence provides a very limited set of features.
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<getrlimit>(RESOURCE)
my ($cur, $max, $success) = getrlimit('RLIMIT_CORE');
my ($cur, $max) = getrlimit('RLIMIT_CORE');
=item B<setrlimit>(RESOURCE, CUR, [MAX])
my $success = setrlimit('RLIMIT_CORE', 1e6, 1e8);
=item B<ulimit>(NAME)
Returns the ulimit value related to the NAMEd constant. The NAME
must be a string. C<undef> will be returned when the NAME is not
known by the system.
my $filesize = ulimit('UL_GETFSIZE') || SSIZE_MAX;
=back
=head2 Additional
=over 4
=item B<rlimit_names>()
Returns a list with all known resource names, unsorted.
=item B<ulimit_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%ulimit>
This exported variable is a tied HASH which maps C<UL_*> names
on unique numbers, to be used with L<ulimit()|POSIX::1003::Limit/"Standard POSIX">.
=item B<%rlimit>
This exported variable is a tied HASH which maps C<RLIMIT_*> names
on unique numbers, to be used with L<getrlimit()|POSIX::1003::Limit/"Standard POSIX"> and L<setrlimit()|POSIX::1003::Limit/"Standard POSIX">.
=back
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned at that time.
For ulimit, with a value when it is a getter:
=for comment
#TABLE_ULIMIT_START
UL_GETFSIZE 9223372036854775807
UL_GETMAXBRK undef
UL_GETOPENMAX 1024
UL_SETFSIZE (setter)
=for comment
#TABLE_ULIMIT_END
The constant names for rlimit, with the soft and hard limits that
L<getrlimit()|POSIX::1003::Limit/"Standard POSIX"> returned during installation of the module.
=for comment
#TABLE_RLIMIT_START
RLIMIT_AS 18446744073709551615, 18446744073709551615
RLIMIT_CORE 0, 18446744073709551615
RLIMIT_CPU 18446744073709551615, 18446744073709551615
RLIMIT_DATA 18446744073709551615, 18446744073709551615
RLIMIT_FSIZE 18446744073709551615, 18446744073709551615
RLIMIT_LOCKS 18446744073709551615, 18446744073709551615
RLIMIT_MEMLOCK 65536, 65536
RLIMIT_MSGQUEUE 819200, 819200
RLIMIT_NICE 0, 0
RLIMIT_NLIMITS 0, 15
RLIMIT_NOFILE 1024, 4096
RLIMIT_NPROC 61461, 61461
RLIMIT_OFILE 1024, 4096
RLIMIT_RSS 18446744073709551615, 18446744073709551615
RLIMIT_RTPRIO 0, 0
RLIMIT_RTTIME 18446744073709551615, 18446744073709551615
RLIMIT_SIGPENDING 61461, 61461
RLIMIT_STACK 8388608, 18446744073709551615
=for comment
#TABLE_RLIMIT_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,30 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Locale;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks from resp. limits.h and local.h
my @constants = qw/
MB_LEN_MAX
LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC
LC_TIME
/;
my @functions = qw/localeconv setlocale/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
1;

View file

@ -0,0 +1,65 @@
=encoding utf8
=head1 NAME
POSIX::1003::Locale - POSIX handling locale settings
=head1 SYNOPSIS
use POSIX::1003::Locale;
my $location = setlocale(LC_ALL, 'de'); # German
my $info = localeconv(); # is HASH
print Dumper $info; # use Data::Dumper to inspect
=head1 DESCRIPTION
See L<perllocale> for the details.
=head1 FUNCTIONS
=over 4
=item B<localeconv>()
Get detailed information about the current locale
my $info = localeconv(); # is HASH
print Dumper $info; # use Data::Dumper to inspect
=item B<setlocale>()
Locales describe national and language specific facts. With
L<setlocale()|POSIX::1003::Locale/"FUNCTIONS"> you change the locale.
my $location = setlocale(LC_ALL, 'de'); # German
=back
=head1 CONSTANTS
=head2 Constants from limits.h
MB_LEN_MAX Max multi-byte length of a char across all locales
=head2 Constants from locale.h
LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC
LC_TIME
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,85 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Math;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Block respectively from float.h, math.h, stdlib.h, limits.h
my @constants = qw/
DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP
DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG FLT_EPSILON
FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP
FLT_MIN_EXP FLT_RADIX FLT_ROUNDS LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG
LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP
LDBL_MIN_EXP
HUGE_VAL
RAND_MAX
CHAR_BIT CHAR_MAX CHAR_MIN UCHAR_MAX SCHAR_MAX SCHAR_MIN
SHRT_MAX SHRT_MIN USHRT_MAX
INT_MAX INT_MIN UINT_MAX
LONG_MAX LONG_MIN ULONG_MAX
/;
# Only from math.h. The first block are defined in POSIX.xs, the
# second block present in Core. The last is from string.h
our @IN_CORE = qw/abs exp log sqrt sin cos atan2 rand srand int/;
my @functions = qw/
acos asin atan ceil cosh floor fmod frexp
ldexp log10 modf sinh tan tanh
div rint pow
strtod strtol strtoul
/;
push @functions, @IN_CORE;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
# the argument to be optional is important for expression priority!
sub acos(_) { goto &POSIX::acos }
sub asin(_) { goto &POSIX::asin }
sub atan(_) { goto &POSIX::atan }
sub ceil(_) { goto &POSIX::ceil }
sub cosh(_) { goto &POSIX::cosh }
sub floor(_) { goto &POSIX::floor }
sub frexp(_) { goto &POSIX::frexp }
sub ldexp(_) { goto &POSIX::ldexp }
sub log10(_) { goto &POSIX::log10 }
sub sinh(_) { goto &POSIX::sinh }
sub tan(_) { goto &POSIX::tan }
sub tanh(_) { goto &POSIX::tanh }
sub modf($$) { goto &POSIX::modf }
sub fmod($$) { goto &POSIX::fmod }
# All provided by POSIX.xs
sub div($$) { ( int($_[0]/$_[1]), ($_[0] % $_[1]) ) }
sub rint(;$) { my $v = @_ ? shift : $_; int($v + 0.5) }
sub pow($$) { $_[0] ** $_[1] }
#------------------------------
1;

View file

@ -0,0 +1,239 @@
=encoding utf8
=head1 NAME
POSIX::1003::Math - POSIX handling time
=head1 SYNOPSIS
use POSIX::1003::Math qw/ceil floor sqrt/;
print ceil 3.14;
print sqrt floor 4.9;
=head1 DESCRIPTION
B<Be aware> that math in Perl has unclear precission! Be aware that the
math library often provides many variations of these functions... it is
hard to determine which one is used. Probably, Math::Trig will serve
you better. Or PDL for real number crunchers.
B<Be warned> that these functions do not have an obligatory scalar
parameter, but only an optional parameter (defaults to C<$_>). This
means that they have the lowest (is list) priority.
=head1 FUNCTIONS
=head2 Standard POSIX via this module (via POSIX.xs)
Like the built-in sin, cos, and sqrt, the EXPR defaults to C<$_> and
there is a scalar context (missing from POSIX.pm).
=over 4
=item B<acos>(EXPR)
=item B<asin>(EXPR)
=item B<atan>(EXPR)
=item B<ceil>(EXPR)
=item B<cosh>(EXPR)
=item B<div>(NUMER, DENOM)
Devide NUMER by DENOminator. The result is a list of two: quotient and
remainder. Implemented in Perl for completeness, currently not with the
speed of XS.
my ($quotient, $remainder) = div($number, $denom);
=item B<floor>(EXPR)
=item B<fmod>(EXPR, EXPR)
=item B<frexp>(EXPR)
=item B<ldexp>(EXPR)
=item B<log10>(EXPR)
=item B<modf>(EXPR, EXPR)
=item B<pow>(EXPR1, EXPR2)
Returns C<EXPR1 ** EXPR2>
=item B<rint>(NUMBER)
Round to the closest integer. Implemented in Perl for completeness.
=item B<sinh>(EXPR)
=item B<tan>(EXPR)
=item B<tanh>(EXPR)
=back
=head2 Standard POSIX, using CORE
A small set of mathematical functions are available in Perl CORE,
without the need to load this module. But if you do import them,
it simply gets ignored.
=over 4
=item B<abs>([EXPR])
=item B<atan2>(EXPR, EXPR)
=item B<cos>([EXPR])
=item B<exp>([EXPR])
=item B<log>([EXPR])
=item B<rand>([EXPR])
=item B<sin>([EXPR])
=item B<sqrt>([EXPR])
=item B<srand>([EXPR])
=back
=head2 Numeric conversions
All C<strto*>, C<atof>, C<atoi> and friends functions are usually
not needed in Perl programs: the integer and float types are at their
largest size, so when a string is used in numeric context it will get
converted automatically. Still, POSIX.xs does provide a few of those
functions, which are sometimes more accurate in number parsing for
large numbers.
All three provided functions treat errors the same way. Truly
POSIX-compliant systems set C<$ERRNO> ($!) to indicate a translation
error, so clear C<$!> before calling strto*. Non-compliant systems
may not check for overflow, and therefore will never set C<$!>.
To parse a string C<$str> as a floating point number use
$! = 0;
($num, $n_unparsed) = strtod($str);
if($str eq '' || $n_unparsed != 0 || $!) {
die "Non-numeric input $str" . ($! ? ": $!\n" : "\n");
}
# When you do not care about handling errors, you can do
$num = strtod($str);
$num = $str + 0; # same: Perl auto-converts
=over 4
=item B<strtod>(STRING)
String to double translation. Returns the parsed number and the number
of characters in the unparsed portion of the string. When called in a
scalar context C<strtod> returns the parsed number.
=item B<strtol>(STRING, BASE)
String to integer translation. Returns the parsed number and
the number of characters in the unparsed portion of the string.
When called in a scalar context C<strtol> returns the parsed number.
The base should be zero or between 2 and 36, inclusive. When the base
is zero or omitted C<strtol> will use the string itself to determine the
base: a leading "0x" or "0X" means hexadecimal; a leading "0" means
octal; any other leading characters mean decimal. Thus, "1234" is
parsed as a decimal number, "01234" as an octal number, and "0x1234"
as a hexadecimal number.
=item B<strtoul>(STRING, BASE)
String to unsigned integer translation, which behaves like C<strtol>.
=back
=head1 CONSTANTS
The following constants are exported, shown here with the values
discovered during installation of this module:
=for comment
#TABLE_MATH_START
CHAR_BIT 8
CHAR_MAX 127
CHAR_MIN -128
DBL_DIG 15
DBL_EPSILON 2.22044604925031e-16
DBL_MANT_DIG 53
DBL_MAX 1.79769313486232e+308
DBL_MAX_10_EXP 308
DBL_MAX_EXP 1024
DBL_MIN 2.2250738585072e-308
DBL_MIN_10_EXP -307
DBL_MIN_EXP -1021
FLT_DIG 6
FLT_EPSILON 1.19209289550781e-07
FLT_MANT_DIG 24
FLT_MAX 3.40282346638529e+38
FLT_MAX_10_EXP 38
FLT_MAX_EXP 128
FLT_MIN 1.17549435082229e-38
FLT_MIN_10_EXP -37
FLT_MIN_EXP -125
FLT_RADIX 2
FLT_ROUNDS 1
HUGE_VAL inf
INT_MAX 2147483647
INT_MIN -2147483648
LDBL_DIG 18
LDBL_EPSILON undef
LDBL_MANT_DIG 64
LDBL_MAX undef
LDBL_MAX_10_EXP 4932
LDBL_MAX_EXP 16384
LDBL_MIN undef
LDBL_MIN_10_EXP -4931
LDBL_MIN_EXP -16381
LONG_MAX 9223372036854775807
LONG_MIN -9223372036854775808
RAND_MAX 2147483647
SCHAR_MAX 127
SCHAR_MIN -128
SHRT_MAX 32767
SHRT_MIN -32768
UCHAR_MAX 255
UINT_MAX 4294967295
ULONG_MAX 18446744073709551615
USHRT_MAX 65535
=for comment
#TABLE_MATH_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,148 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use strict;
use warnings;
package POSIX::1003::Module;
use vars '$VERSION';
$VERSION = '0.93';
our $VERSION = '0.93';
use Carp 'croak';
{ use XSLoader;
no warnings 'redefine';
XSLoader::load 'POSIX';
XSLoader::load 'POSIX::1003', $VERSION;
}
my $in_constant_table;
BEGIN { $in_constant_table = qr/
^_CS_ # confstr
| ^GET_ # rlimit
| ^O_ # fdio
| ^_PC_ # pathconf
| ^POLL # poll
| ^_POSIX # property
| ^RLIM # rlimit
| ^_SC_ # sysconf
| ^S_ # stat
| ^SEEK_ # fdio
| ^SET_ # rlimit aix
| ^SIG[^_] # signals
| ^UL_ # ulimit
| _OK$ # access
/x
};
sub import(@)
{ my $class = shift;
return if $class eq __PACKAGE__;
no strict 'refs';
no warnings 'once';
my $tags = \%{"${class}::EXPORT_TAGS"} or die;
# A hash-lookup is faster than an array lookup, so %EXPORT_OK
%{"${class}::EXPORT_OK"} = ();
my $ok = \%{"${class}::EXPORT_OK"};
unless(keys %$ok)
{ @{$ok}{@{$tags->{$_}}} = () for keys %$tags;
}
my $level = @_ && $_[0] =~ m/^\+(\d+)$/ ? shift : 0;
return if @_==1 && $_[0] eq ':none';
@_ = ':all' if !@_;
my %take;
foreach (@_)
{ if( $_ eq ':all')
{ @take{keys %$ok} = ();
}
elsif( m/^:(.*)/ )
{ my $tag = $tags->{$1} or croak "$class does not export $_";
@take{@$tag} = ();
}
else
{ $_ =~ $in_constant_table or exists $ok->{$_}
or croak "$class does not export $_";
undef $take{$_};
}
}
my $in_core = \@{$class.'::IN_CORE'} || [];
my $pkg = (caller $level)[0];
foreach my $f (sort keys %take)
{ my $export;
if(exists ${$class.'::'}{$f} && ($export = *{"${class}::$f"}{CODE}))
{ # reuse the already created function; might also be a function
# which is actually implemented in the $class namespace.
}
elsif($f =~ $in_constant_table)
{ *{$class.'::'.$f} = $export = $class->_create_constant($f);
}
elsif( $f !~ m/[^A-Z0-9_]/ ) # faster than: $f =~ m!^[A-Z0-9_]+$!
{ # other all-caps names are always from POSIX.xs
if(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE})
{ # POSIX.xs croaks on undefined constants, we will return undef
my $const = eval "POSIX::$f()";
*{$class.'::'.$f} = $export
= defined $const ? sub() {$const} : sub() {undef};
}
else
{ # ignore the missing value
# warn "missing constant in POSIX.pm $f" && next;
*{$class.'::'.$f} = $export = sub() {undef};
}
}
elsif(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE})
{ # normal functions implemented in POSIX.xs
*{"${class}::$f"} = $export = *{"POSIX::$f"}{CODE};
}
elsif($f =~ s/^%//)
{ $export = \%{"${class}::$f"};
}
elsif($in_core && grep {$f eq $_} @$in_core)
{ # function is in core, simply ignore the export
next;
}
else
{ croak "unable to load $f";
}
no warnings 'once';
*{"${pkg}::$f"} = $export;
}
}
sub exampleValue($)
{ my ($pkg, $name) = @_;
no strict 'refs';
my $tags = \%{"$pkg\::EXPORT_TAGS"} or die;
my $constants = $tags->{constants} || [];
grep {$_ eq $name} @$constants
or return undef;
my $val = &{"$pkg\::$name"};
defined $val ? $val : 'undef';
}
package POSIX::1003::ReadOnlyTable;
use vars '$VERSION';
$VERSION = '0.93';
sub TIEHASH($) { bless $_[1], $_[0] }
sub FETCH($) { $_[0]->{$_[1]} }
sub EXISTS($) { exists $_[0]->{$_[1]} }
sub FIRSTKEY() { scalar %{$_[0]}; scalar each %{$_[0]} }
sub NEXTKEY() { scalar each %{$_[0]} }
1;

View file

@ -0,0 +1,62 @@
=encoding utf8
=head1 NAME
POSIX::1003::Module - Base of POSIX::1003 components
=head1 SYNOPSIS
# use the specific extensions
# and see POSIX::Overview and POSIX::1003
=head1 DESCRIPTION
The POSIX functions and constants are provided via extensions of this
module. This module itself only facilitates those implementations.
=head1 METHODS
=over 4
=item POSIX::1003::Module-E<gt>B<exampleValue>(NAME)
Returns an example value for the NAMEd variable. Often, this is a
compile-time or runtime constant. For some extensions, like C<::Pathconf>,
that may not be the case.
=item $obj-E<gt>B<import>()
All modules provide a C<:constants> and a C<:functions> tag, sometimes
more. The default is C<:all>, which means: everthing. You may also
specify C<:none> (of course: nothing).
When the import list is preceeded by C<+1>, the symbols will get published
into the namespace of your caller namespace, not your own namespace.
use POSIX::1003::Pathconf;
use POSIX::1003::Pathconf ':all'; # same
use POSIX::1003 ':pc'; # same, for the lazy
use POSIX::1003 ':pathconf'; # same, less lazy
sub MyModule::import(@) # your own tricky exporter
{ POSIX::1003::Pathconf->import('+1', @_);
}
=back
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,28 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::OS;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks resp from limits.h
my @constants = qw/
ARG_MAX NGROUPS_MAX OPEN_MAX TMP_MAX
/;
# Blocks resp from sys/utsname.h
my @functions = qw/uname/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
1;

View file

@ -0,0 +1,62 @@
=encoding utf8
=head1 NAME
POSIX::1003::OS - POSIX for the file-system
=head1 SYNOPSIS
use POSIX::1003::OS qw(uname TMP_MAX);
my ($sys, $node, $rel, $version, $machine) = uname();
print TMP_MAX;
=head1 DESCRIPTION
You may also need L<POSIX::1003::Pathconf|POSIX::1003::Pathconf>.
=head1 FUNCTIONS
=over 4
=item B<uname>()
Get the name of current operating system.
my ($sysname, $node, $release, $version, $machine) = uname();
Note that the actual meanings of the various fields are not
that well standardized: do not expect any great portability.
The C<$sysname> might be the name of the operating system, the
C<$nodename> might be the name of the host, the C<$release> might be
the (major) release number of the operating system, the
C<$version> might be the (minor) release number of the operating
system, and C<$machine> might be a hardware identifier.
Maybe.
=back
=head1 CONSTANTS
=head2 Constants from limits.h
ARG_MAX Max bytes of args + env for exec
NGROUPS_MAX
OPEN_MAX Max # files that one process can have open
TMP_MAX Min # of unique filenames generated by tmpnam
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,76 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Pathconf;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
use Carp 'croak';
my @constants;
my @functions = qw/pathconf fpathconf pathconf_names/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, tables => [ '%pathconf' ]
);
my $pathconf;
our %pathconf;
BEGIN {
# initialize the :constants export tag
$pathconf = pathconf_table;
push @constants, keys %$pathconf;
tie %pathconf, 'POSIX::1003::ReadOnlyTable', $pathconf;
}
sub pathconf($$);
sub exampleValue($)
{ my ($class, $name) = @_;
$name =~ m/^_PC_/ or return;
my $val = pathconf __FILE__, $name;
defined $val ? $val : 'undef';
}
sub fpathconf($$)
{ my ($fd, $key) = @_;
$key =~ /^_PC_/
or croak "pass the constant name as string";
my $id = $pathconf{$key} // return;
my $v = POSIX::fpathconf($fd, $id);
defined $v && $v eq '0 but true' ? 0 : $v;
}
sub pathconf($$)
{ my ($fn, $key) = @_;
$key =~ /^_PC_/
or croak "pass the constant name as string";
my $id = $pathconf{$key} // return;
my $v = POSIX::pathconf($fn, $id);
defined $v ? $v+0 : undef; # remove 'but true' from '0'
}
sub _create_constant($)
{ my ($class, $name) = @_;
my $id = $pathconf->{$name} // return sub($) {undef};
sub($) { my $f = shift;
$f =~ m/\D/
? POSIX::pathconf($f, $id)
: POSIX::fpathconf($f, $id)
};
}
sub pathconf_names() { keys %$pathconf }

View file

@ -0,0 +1,116 @@
=encoding utf8
=head1 NAME
POSIX::1003::Pathconf - POSIX access to pathconf()
=head1 SYNOPSIS
use POSIX::1003::Pathconf; # import all
use POSIX::1003::Pathconf 'pathconf';
my $max = pathconf($filename, '_PC_PATH_MAX');
use POSIX::1003::Pathconf '_PC_PATH_MAX';
my $max = _PC_PATH_MAX($filename);
use POSIX::1003::Pathconf qw(pathconf %pathconf);
my $key = $pathconf{_PC_PATH_MAX};
$pathconf{_PC_NEW_KEY} = $value
foreach my $name (keys %pathconf) ...
use POSIX::1003::Pathconf qw(fpathconf);
use POSIX::1003::FdIO qw(openfd);
use Fcntl qw(O_RDONLY);
my $fd = openfd $fn, O_RDONLY;
my $max = fpathconf $fd, '_PC_PATH_MAX';
my $max = _PC_PATH_MAX($fd);
foreach my $pc (pathconf_names) ...
=head1 DESCRIPTION
With C<pathconf()> you query filesystem limits for a certain existing
location.
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<fpathconf>(FD, NAME)
Returns the numeric value related to the NAME or C<undef>.
=item B<pathconf>(FILENAME, NAME)
Returns the numeric value related to the NAME or C<undef>.
=back
=head2 Additional
=over 4
=item B<pathconf_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%pathconf>
This exported variable is a tied HASH which maps C<_PC_*> names
on unique numbers, to be used with the system's C<pathconf()>
and C<fpathconf()> functions.
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned for a random file at the time.
=back
=for comment
#TABLE_PATHCONF_START
_PC_2_SYMLINKS 1 _PC_PIPE_BUF 4096
_PC_ALLOC_SIZE_MIN 4096 _PC_PRIO_IO undef
_PC_ASYNC_IO 1 _PC_REC_INCR_XFER_SIZE undef
_PC_CHOWN_RESTRICTED 1 _PC_REC_MAX_XFER_SIZE undef
_PC_FILESIZEBITS 64 _PC_REC_MIN_XFER_SIZE 4096
_PC_LINK_MAX 65000 _PC_REC_XFER_ALIGN 4096
_PC_MAX_CANON 255 _PC_SOCK_MAXBUF undef
_PC_MAX_INPUT 255 _PC_SYMLINK_MAX undef
_PC_NAME_MAX 255 _PC_SYNC_IO undef
_PC_NO_TRUNC 1 _PC_VDISABLE 0
_PC_PATH_MAX 4096
=for comment
#TABLE_PATHCONF_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,53 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Proc;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks resp. in stdlib.h, limits.h
my @constants = qw/EXIT_FAILURE EXIT_SUCCESS CHILD_MAX /;
our @IN_CORE = qw/wait waitpid/;
# Blocks resp. in stdlib.h, sys/wait.h, unistd.h
my @functions = qw/
abort
WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED
WNOHANG WSTOPSIG WTERMSIG WUNTRACED
_exit pause setpgid setsid tcgetpgrp tcsetpgrp
ctermid cuserid getcwd nice
/;
push @functions, @IN_CORE;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
#-------------------------------------
sub cuserid() {goto &POSIX::cuserid}
sub ctermid() {goto &POSIX::ctermid}
sub _exit($) {goto &POSIX::_exit}
sub pause() {goto &POSIX::pause}
sub setpgid($$) {goto &POSIX::setpgid}
sub setsid() {goto &POSIX::setsid}
sub cgetpgrp($) {goto &POSIX::cgetpgrp}
sub tcsetpgrp($$) {goto &POSIX::tcsetpgrp}
sub nice($) {goto &POSIX::nice}
sub times5() {goto &POSIX::times}
1;

View file

@ -0,0 +1,154 @@
=encoding utf8
=head1 NAME
POSIX::1003::Proc - POSIX handling processes
=head1 SYNOPSIS
use POSIX::1003::Proc qw/abort setpgid/;
abort();
setpgid($pid, $pgid);
=head1 DESCRIPTION
Functions which are bound to each separate process.
=head1 FUNCTIONS
=head2 Standard POSIX functions from stdlib.h
=over 4
=item B<abort>()
Abnormal process exit.
=back
=head2 Standard POSIX functions from sys/wait.h
These functions have captial names because in C they are implemented
as macro's (which are capitalized by convension)
=over 4
=item B<WEXITSTATUS>($?)
Returns the normal exit status of the child process. Only meaningful
if C<WIFEXITED($?)> is true.
=item B<WIFEXITED>($?)
Returns true if the child process exited normally: "exit()" or by
falling off the end of "main()".
=item B<WIFSIGNALED>($?)
Returns true if the child process terminated because of a signal.
=item B<WIFSTOPPED>($?)
Returns true if the child process is currently stopped. Can happen only
if you specified the C<WUNTRACED> flag to waitpid().
=item B<WSTOPSIG>($?)
Returns the signal the child process was stopped for. Only meaningful
if C<WIFSTOPPED($?)> is true.
=item B<WTERMSIG>($?)
Returns the signal the child process terminated for. Only meaningful
if C<WIFSIGNALED($?)> is true.
=item B<wait>()
Simply L<perlfunc/wait>.
=item B<waitpid>(PID)
Simply L<perlfunc/waitpid>.
=back
=head2 Standard POSIX functions from unistd.h
=over 4
=item B<_exit>(CODE)
Leave the program without calling handlers registered with C<atexit>
(which is not available in Perl)
=item B<ctermid>()
Generates the path name for the controlling terminal of this process.
my $path = ctermid();
=item B<cuserid>()
Get the login name of the effective user of the current process.
See also C<perldoc -f getlogin>
my $name = cuserid();
=item B<getcwd>()
Returns the name of the current working directory. See also Cwd.
=item B<nice>(INTEGER)
use POSIX::1003::Proc 'nice';
$new_prio = nice($increment);
=item B<pause>()
=item B<setpgid>(PID, PPID)
=item B<setsid>()
=item B<tcgetpgrp>(FD)
=item B<tcsetpgrp>(FD, PID)
=item B<times5>()
The CORE C<times()> function returns four values, conveniently converted
into seconds (float). The POSIX C<times()> returns five values in
clocktics. To disambique those two, we offer the POSIX function under
a slightly different name.
($user, $sys, $cuser, $csys) = CORE::times();
($elapse, $user, $sys, $cuser, $csys) = POSIX::times();
($elapse, $user, $sys, $cuser, $csys) = times5();
=back
=head1 CONSTANTS
=head2 Constants from stdlib.h
EXIT_FAILURE
EXIT_SUCCESS
=head2 Constants from limits.h
CHILD_MAX
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,64 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Properties;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
use Carp 'croak';
my @constants;
my @functions = qw/property property_names/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, tables => [ '%property' ]
);
my $property;
our %property;
BEGIN {
# initialize the :constants export tag
$property = property_table;
push @constants, keys %$property;
tie %property, 'POSIX::1003::ReadOnlyTable', $property;
}
sub property($);
sub exampleValue($)
{ my ($class, $name) = @_;
$name =~ m/^_POSIX/ or return;
my $val = property $name;
defined $val ? $val : 'undef';
}
sub property($)
{ my $key = shift // return;
$key =~ /^_POSIX/
or croak "pass the constant name as string";
$property->{$key};
}
sub _create_constant($)
{ my ($class, $name) = @_;
my $value = $property->{$name};
sub() {$value};
}
sub property_names() { keys %$property }
1;

View file

@ -0,0 +1,194 @@
=encoding utf8
=head1 NAME
POSIX::1003::Properties - POSIX access to _POSIX_ constants
=head1 SYNOPSIS
use POSIX::1003::Properties; # import all
use POSIX::1003::Properties 'property';
$hasnt = property('_POSIX_NO_TRUNC');
use POSIX::1003::Properties '_POSIX_NO_TRUNC';
$hasnt = _POSIX_NO_TRUNC;
use POSIX::1003::Properties '%property';
my $key = $property{_POSIX_NO_TRUNC};
$property{_POSIX_NEW} = $value;
foreach my $prop (property_names) ...
=head1 DESCRIPTION
When you compile C/C++ programs, the header files provide you with
a long list of C<_POSIX> constants. This module pass these values
on to Perl.
=head1 FUNCTIONS
=head2 Standard POSIX
There is no system call to retrieve these values: they are defined
in the C sources only.
=head2 Additional
=over 4
=item B<property>(NAME)
Returns the property value related to NAME.
=item B<property_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%property>
This exported variable is a tie HASH which contains the
values related to the system property names.
=back
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned at that time.
=for comment
#TABLE_PROPERTY_START
_POSIX2_C_BIND 200809
_POSIX2_C_DEV 200809
_POSIX2_CHAR_TERM 200809
_POSIX2_LOCALEDEF 200809
_POSIX2_SW_DEV 200809
_POSIX2_VERSION 200809
_POSIX_ADVISORY_INFO 200809
_POSIX_AIO_LISTIO_MAX 2
_POSIX_AIO_MAX 1
_POSIX_ARG_MAX 4096
_POSIX_ASYNC_IO 1
_POSIX_ASYNCHRONOUS_IO 200809
_POSIX_BARRIERS 200809
_POSIX_C_SOURCE 200809
_POSIX_CHILD_MAX 25
_POSIX_CHOWN_RESTRICTED 0
_POSIX_CLOCK_SELECTION 200809
_POSIX_CLOCKRES_MIN 20000000
_POSIX_CPUTIME 0
_POSIX_DELAYTIMER_MAX 32
_POSIX_FD_SETSIZE 20
_POSIX_FSYNC 200809
_POSIX_HIWAT 512
_POSIX_HOST_NAME_MAX 255
_POSIX_IPV6 200809
_POSIX_JOB_CONTROL 1
_POSIX_LINK_MAX 8
_POSIX_LOGIN_NAME_MAX 9
_POSIX_MAPPED_FILES 200809
_POSIX_MAX_CANON 255
_POSIX_MAX_INPUT 255
_POSIX_MEMLOCK 200809
_POSIX_MEMLOCK_RANGE 200809
_POSIX_MEMORY_PROTECTION 200809
_POSIX_MESSAGE_PASSING 200809
_POSIX_MONOTONIC_CLOCK 0
_POSIX_MQ_OPEN_MAX 8
_POSIX_MQ_PRIO_MAX 32
_POSIX_NAME_MAX 14
_POSIX_NGROUPS_MAX 8
_POSIX_NO_TRUNC 1
_POSIX_OPEN_MAX 20
_POSIX_PATH_MAX 256
_POSIX_PIPE_BUF 512
_POSIX_PRIORITIZED_IO 200809
_POSIX_PRIORITY_SCHEDULING 200809
_POSIX_QLIMIT 1
_POSIX_RAW_SOCKETS 200809
_POSIX_RE_DUP_MAX 255
_POSIX_READER_WRITER_LOCKS 200809
_POSIX_REALTIME_SIGNALS 200809
_POSIX_REENTRANT_FUNCTIONS 1
_POSIX_REGEXP 1
_POSIX_RTSIG_MAX 8
_POSIX_SAVED_IDS 1
_POSIX_SEM_NSEMS_MAX 256
_POSIX_SEM_VALUE_MAX 32767
_POSIX_SEMAPHORES 200809
_POSIX_SHARED_MEMORY_OBJECTS 200809
_POSIX_SHELL 1
_POSIX_SIGQUEUE_MAX 32
_POSIX_SOURCE 1
_POSIX_SPAWN 200809
_POSIX_SPIN_LOCKS 200809
_POSIX_SPORADIC_SERVER -1
_POSIX_SSIZE_MAX 32767
_POSIX_STREAM_MAX 8
_POSIX_SYMLINK_MAX 255
_POSIX_SYMLOOP_MAX 8
_POSIX_SYNCHRONIZED_IO 200809
_POSIX_THREAD_ATTR_STACKADDR 200809
_POSIX_THREAD_ATTR_STACKSIZE 200809
_POSIX_THREAD_CPUTIME 0
_POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
_POSIX_THREAD_KEYS_MAX 128
_POSIX_THREAD_PRIO_INHERIT 200809
_POSIX_THREAD_PRIO_PROTECT 200809
_POSIX_THREAD_PRIORITY_SCHEDULING 200809
_POSIX_THREAD_PROCESS_SHARED 200809
_POSIX_THREAD_ROBUST_PRIO_INHERIT 200809
_POSIX_THREAD_ROBUST_PRIO_PROTECT -1
_POSIX_THREAD_SAFE_FUNCTIONS 200809
_POSIX_THREAD_SPORADIC_SERVER -1
_POSIX_THREAD_THREADS_MAX 64
_POSIX_THREADS 200809
_POSIX_TIMEOUTS 200809
_POSIX_TIMER_MAX 32
_POSIX_TIMERS 200809
_POSIX_TRACE -1
_POSIX_TRACE_EVENT_FILTER -1
_POSIX_TRACE_INHERIT -1
_POSIX_TRACE_LOG -1
_POSIX_TTY_NAME_MAX 9
_POSIX_TYPED_MEMORY_OBJECTS -1
_POSIX_TZNAME_MAX 6
_POSIX_UIO_MAXIOV 16
_POSIX_V6_LP64_OFF64 1
_POSIX_V6_LPBIG_OFFBIG -1
_POSIX_V7_LP64_OFF64 1
_POSIX_V7_LPBIG_OFFBIG -1
_POSIX_VDISABLE 0
_POSIX_VERSION 200809
=for comment
#TABLE_PROPERTY_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,80 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Signals;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
my @signals;
my @states = qw/
SIG_BLOCK SIG_DFL SIG_ERR
SIG_IGN SIG_SETMASK SIG_UNBLOCK
/;
my @actions = qw/
SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART
SA_SIGINFO
/;
my @functions = qw/
raise sigaction signal sigpending sigprocmask sigsuspend signal
signal_names strsignal
/;
my @constants = (@signals, @states, @actions);
our %EXPORT_TAGS =
( signals => \@signals
, actions => \@actions
, status => \@states
, constants => \@constants
, functions => \@functions
, tables => [ '%signals' ]
);
our @IN_CORE = qw/kill/;
my $signals;
our %signals;
BEGIN {
# initialize the :signals export tag
$signals = signals_table;
push @constants, keys %$signals;
push @signals, keys %$signals;
tie %signals, 'POSIX::1003::ReadOnlyTable', $signals;
}
# Perl does not support pthreads, so:
sub raise($) { CORE::kill $_[0], $$ }
sub sigaction($$;$) {goto &POSIX::sigaction }
sub sigpending($) {goto &POSIX::sigpending }
sub sigprocmask($$;$) {goto &POSIX::sigprocmask }
sub sigsuspend($) {goto &POSIX::sigsuspend }
sub signal($$) { $SIG{$_[0]} = $_[1] }
sub strsignal($) { _strsignal($_[0]) || "Unknown signal $_[0]" }
#--------------------------
sub signal_names() { keys %$signals }
#--------------------------
sub _create_constant($)
{ my ($class, $name) = @_;
my $val = $signals->{$name};
sub() {$val};
}
1;

View file

@ -0,0 +1,196 @@
=encoding utf8
=head1 NAME
POSIX::1003::Signals - POSIX using signals
=head1 SYNOPSIS
use POSIX::1003::Signals qw(:functions SIGPOLL SIGHUP);
sigaction($signal, $action, $oldaction);
sigpending($sigset);
sigprocmask($how, $sigset, $oldsigset)
sigsuspend($signal_mask);
kill SIGPOLL//SIGHUP, $$;
use POSIX::1003::Signals '%signals';
my $number = $signals{SIGHUP};
$signals{SIGNEW} = $number;
=head1 DESCRIPTION
This manual page explains the access to the POSIX C<sigaction>
functions and its relatives. This module uses two helper objects:
L<POSIX::SigSet|POSIX::SigSet> and L<POSIX::SigAction|POSIX::SigAction>.
=head1 FUNCTIONS
These functions are implemened in POSIX.xs
=head2 Standard POSIX
=over 4
=item B<kill>(SIGNAL, PROCESS)
Simply L<perlfunc/kill>.
B<Be warned> the order of parameters is reversed in the C<kill>
exported by POSIX!
CORE::kill($signal, $pid);
::Signals::kill($signal, $pid);
POSIX::kill($pid, $signal);
=item B<raise>(SIGNAL)
Send a signal to the executing process.
=item B<sigaction>(SIGNAL, ACTION, [OLDACTION])
Detailed signal management. The C<signal> must be a number (like SIGHUP),
not a string (like "SIGHUP"). The C<action> and C<oldaction> arguments
are C<POSIX::SigAction> objects. Returns C<undef> on failure.
If you use the C<SA_SIGINFO flag>, the signal handler will in addition to
the first argument (the signal name) also receive a second argument: a
hash reference, inside which are the following keys with the following
semantics, as defined by POSIX/SUSv3:
signo the signal number
errno the error number
code if this is zero or less, the signal was sent by
a user process and the uid and pid make sense,
otherwise the signal was sent by the kernel
The following are also defined by POSIX/SUSv3, but unfortunately
not very widely implemented:
pid the process id generating the signal
uid the uid of the process id generating the signal
status exit value or signal for SIGCHLD
band band event for SIGPOLL
A third argument is also passed to the handler, which contains a copy
of the raw binary contents of the siginfo structure: if a system has
some non-POSIX fields, this third argument is where to unpack() them
from.
Note that not all siginfo values make sense simultaneously (some are
valid only for certain signals, for example), and not all values make
sense from Perl perspective.
=item B<signal>(SIGNAL, (CODE|'IGNORE'|'DEFAULT'))
Set the CODE (subroutine reference) to be called when the SIGNAL appears.
See L<perlvar/%SIG>.
signal(SIGINT, \&handler);
$SIG{SIGINT} = \&handler; # same
=item B<sigpending>(SIGSET)
Examine signals that are blocked and pending. This uses C<POSIX::SigSet>
objects for the C<sigset> argument. Returns C<undef> on failure.
=item B<sigprocmask>(HOW, SIGSET, [OLDSIGSET])
Change and/or examine calling process's signal mask. This uses
C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments.
Returns C<undef> on failure.
Note that you can't reliably block or unblock a signal from its own signal
handler if you're using safe signals. Other signals can be blocked or
unblocked reliably.
=item B<sigsuspend>(SIGSET)
Install a signal mask and suspend process until signal arrives.
This uses C<POSIX::SigSet> objects for the C<signal_mask> argument.
Returns C<undef> on failure.
=item B<strsignal>(SIGNAL)
Returns a string reprentation of the SIGNAL. When the SIGNAL is unknown,
a standard string is returned (never undef)
=back
=head2 Additional
=over 4
=item B<signal_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%signals>
This exported variable is a (tied) HASH which maps C<SIG*> names
to their numbers.
=back
The following constants are exported, shown here with the values
discovered during installation of this module:
=for comment
#TABLE_SIGNALS_START
SA_NOCLDSTOP 1 SIGKILL 9
SA_NOCLDWAIT 2 SIGPIPE 13
SA_NODEFER 1073741824 SIGPOLL 29
SA_ONSTACK 134217728 SIGPROF 27
SA_RESETHAND 2147483648 SIGPWR 30
SA_RESTART 268435456 SIGQUIT 3
SA_SIGINFO 4 SIGRTMAX 64
SIG_BLOCK 0 SIGRTMIN 34
SIG_DFL 0 SIGSEGV 11
SIG_ERR -1 SIGSTKFLT 16
SIG_IGN 1 SIGSTOP 19
SIG_SETMASK 2 SIGSYS 31
SIG_UNBLOCK 1 SIGTERM 15
SIGABRT 6 SIGTRAP 5
SIGALRM 14 SIGTSTP 20
SIGBUS 7 SIGTTIN 21
SIGCHLD 17 SIGTTOU 22
SIGCLD 17 SIGURG 23
SIGCONT 18 SIGUSR1 10
SIGFPE 8 SIGUSR2 12
SIGHUP 1 SIGVTALRM 26
SIGILL 4 SIGWINCH 28
SIGINT 2 SIGXCPU 24
SIGIO 29 SIGXFSZ 25
SIGIOT 6
=for comment
#TABLE_SIGNALS_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,876 @@
# Warning: generated during module installation
# by ./symbols.PL
# at Sun Aug 11 17:26:50 2013
# do not edit by hand!
package POSIX::1003;
our %EXPORT_TAGS = (
sigaction => [ qw(
) ],
processes => [ qw(
_exit
abort
CHILD_MAX
ctermid
cuserid
EXIT_FAILURE
EXIT_SUCCESS
getcwd
nice
pause
setpgid
setsid
tcgetpgrp
tcsetpgrp
wait
waitpid
WEXITSTATUS
WIFEXITED
WIFSIGNALED
WIFSTOPPED
WNOHANG
WSTOPSIG
WTERMSIG
WUNTRACED
) ],
opsys => [ qw(
ARG_MAX
NGROUPS_MAX
OPEN_MAX
TMP_MAX
uname
) ],
confstr => [ qw(
%confstr
_CS_GNU_LIBC_VERSION
_CS_GNU_LIBPTHREAD_VERSION
_CS_LFS64_CFLAGS
_CS_LFS64_LDFLAGS
_CS_LFS64_LIBS
_CS_LFS64_LINTFLAGS
_CS_LFS_CFLAGS
_CS_LFS_LDFLAGS
_CS_LFS_LIBS
_CS_LFS_LINTFLAGS
_CS_PATH
_CS_POSIX_V5_WIDTH_RESTRICTED_ENVS
_CS_POSIX_V6_ILP32_OFF32_CFLAGS
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
_CS_POSIX_V6_ILP32_OFF32_LIBS
_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
_CS_POSIX_V6_ILP32_OFFBIG_LIBS
_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
_CS_POSIX_V6_LP64_OFF64_CFLAGS
_CS_POSIX_V6_LP64_OFF64_LDFLAGS
_CS_POSIX_V6_LP64_OFF64_LIBS
_CS_POSIX_V6_LP64_OFF64_LINTFLAGS
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
_CS_POSIX_V7_ILP32_OFF32_CFLAGS
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
_CS_POSIX_V7_ILP32_OFF32_LIBS
_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LIBS
_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
_CS_POSIX_V7_LP64_OFF64_CFLAGS
_CS_POSIX_V7_LP64_OFF64_LDFLAGS
_CS_POSIX_V7_LP64_OFF64_LIBS
_CS_POSIX_V7_LP64_OFF64_LINTFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
_CS_V5_WIDTH_RESTRICTED_ENVS
_CS_V6_WIDTH_RESTRICTED_ENVS
_CS_V7_WIDTH_RESTRICTED_ENVS
_CS_XBS5_ILP32_OFF32_CFLAGS
_CS_XBS5_ILP32_OFF32_LDFLAGS
_CS_XBS5_ILP32_OFF32_LIBS
_CS_XBS5_ILP32_OFF32_LINTFLAGS
_CS_XBS5_ILP32_OFFBIG_CFLAGS
_CS_XBS5_ILP32_OFFBIG_LDFLAGS
_CS_XBS5_ILP32_OFFBIG_LIBS
_CS_XBS5_ILP32_OFFBIG_LINTFLAGS
_CS_XBS5_LP64_OFF64_CFLAGS
_CS_XBS5_LP64_OFF64_LDFLAGS
_CS_XBS5_LP64_OFF64_LIBS
_CS_XBS5_LP64_OFF64_LINTFLAGS
_CS_XBS5_LPBIG_OFFBIG_CFLAGS
_CS_XBS5_LPBIG_OFFBIG_LDFLAGS
_CS_XBS5_LPBIG_OFFBIG_LIBS
_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
confstr
confstr_names
) ],
fdio => [ qw(
%mode
%seek
BUFSIZ
closefd
creatfd
dup2fd
dupfd
EOF
MAX_INPUT
O_APPEND
O_ASYNC
O_CLOEXEC
O_CREAT
O_DIRECT
O_DIRECTORY
O_DSYNC
O_EXCL
O_FSYNC
O_LARGEFILE
O_NDELAY
O_NOATIME
O_NOCTTY
O_NOFOLLOW
O_NONBLOCK
O_RDONLY
O_RDWR
O_RSYNC
O_SYNC
O_TRUNC
O_WRONLY
openfd
PIPE_BUF
pipefd
readfd
SEEK_CUR
SEEK_DATA
SEEK_END
SEEK_HOLE
SEEK_SET
seekfd
SSIZE_MAX
STDERR_FILENO
STDIN_FILENO
STDOUT_FILENO
tellfd
writefd
) ],
pathconf => [ qw(
%pathconf
_PC_2_SYMLINKS
_PC_ALLOC_SIZE_MIN
_PC_ASYNC_IO
_PC_CHOWN_RESTRICTED
_PC_FILESIZEBITS
_PC_LINK_MAX
_PC_MAX_CANON
_PC_MAX_INPUT
_PC_NAME_MAX
_PC_NO_TRUNC
_PC_PATH_MAX
_PC_PIPE_BUF
_PC_PRIO_IO
_PC_REC_INCR_XFER_SIZE
_PC_REC_MAX_XFER_SIZE
_PC_REC_MIN_XFER_SIZE
_PC_REC_XFER_ALIGN
_PC_SOCK_MAXBUF
_PC_SYMLINK_MAX
_PC_SYNC_IO
_PC_VDISABLE
fpathconf
pathconf
pathconf_names
) ],
events => [ qw(
FD_CLR
FD_ISSET
FD_SET
FD_ZERO
poll
poll_names
POLLERR
POLLHUP
POLLIN
POLLNVAL
POLLOUT
POLLPRI
POLLRDBAND
POLLRDNORM
POLLWRBAND
POLLWRNORM
select
) ],
signals => [ qw(
%signals
raise
SA_NOCLDSTOP
SA_NOCLDWAIT
SA_NODEFER
SA_ONSTACK
SA_RESETHAND
SA_RESTART
SA_SIGINFO
SIG_BLOCK
SIG_DFL
SIG_ERR
SIG_IGN
SIG_SETMASK
SIG_UNBLOCK
SIGABRT
sigaction
SIGALRM
SIGBUS
SIGCHLD
SIGCLD
SIGCONT
SIGFPE
SIGHUP
SIGILL
SIGINT
SIGIO
SIGIOT
SIGKILL
signal
signal_names
sigpending
SIGPIPE
SIGPOLL
sigprocmask
SIGPROF
SIGPWR
SIGQUIT
SIGRTMAX
SIGRTMIN
SIGSEGV
SIGSTKFLT
SIGSTOP
sigsuspend
SIGSYS
SIGTERM
SIGTRAP
SIGTSTP
SIGTTIN
SIGTTOU
SIGURG
SIGUSR1
SIGUSR2
SIGVTALRM
SIGWINCH
SIGXCPU
SIGXFSZ
strsignal
) ],
locale => [ qw(
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MESSAGES
LC_MONETARY
LC_NUMERIC
LC_TIME
localeconv
MB_LEN_MAX
setlocale
) ],
limits => [ qw(
%rlimit
%ulimit
getrlimit
RLIM_INFINITY
RLIM_SAVED_CUR
RLIM_SAVED_MAX
RLIMIT_AS
RLIMIT_CORE
RLIMIT_CPU
RLIMIT_DATA
RLIMIT_FSIZE
RLIMIT_LOCKS
RLIMIT_MEMLOCK
RLIMIT_MSGQUEUE
rlimit_names
RLIMIT_NICE
RLIMIT_NLIMITS
RLIMIT_NOFILE
RLIMIT_NPROC
RLIMIT_OFILE
RLIMIT_RSS
RLIMIT_RTPRIO
RLIMIT_RTTIME
RLIMIT_SIGPENDING
RLIMIT_STACK
setrlimit
UL_GETFSIZE
UL_GETMAXBRK
UL_GETOPENMAX
UL_SETFSIZE
ulimit
ulimit_names
) ],
time => [ qw(
asctime
CLK_TCK
clock
CLOCKS_PER_SEC
ctime
difftime
gmtime
localtime
mktime
NULL
strftime
tzname
TZNAME_MAX
tzset
) ],
math => [ qw(
abs
acos
asin
atan
atan2
ceil
CHAR_BIT
CHAR_MAX
CHAR_MIN
cos
cosh
DBL_DIG
DBL_EPSILON
DBL_MANT_DIG
DBL_MAX
DBL_MAX_10_EXP
DBL_MAX_EXP
DBL_MIN
DBL_MIN_10_EXP
DBL_MIN_EXP
div
exp
floor
FLT_DIG
FLT_EPSILON
FLT_MANT_DIG
FLT_MAX
FLT_MAX_10_EXP
FLT_MAX_EXP
FLT_MIN
FLT_MIN_10_EXP
FLT_MIN_EXP
FLT_RADIX
FLT_ROUNDS
fmod
frexp
HUGE_VAL
int
INT_MAX
INT_MIN
LDBL_DIG
LDBL_EPSILON
LDBL_MANT_DIG
LDBL_MAX
LDBL_MAX_10_EXP
LDBL_MAX_EXP
LDBL_MIN
LDBL_MIN_10_EXP
LDBL_MIN_EXP
ldexp
log
log10
LONG_MAX
LONG_MIN
modf
pow
rand
RAND_MAX
rint
SCHAR_MAX
SCHAR_MIN
SHRT_MAX
SHRT_MIN
sin
sinh
sqrt
srand
strtod
strtol
strtoul
tan
tanh
UCHAR_MAX
UINT_MAX
ULONG_MAX
USHRT_MAX
) ],
sigset => [ qw(
) ],
termios => [ qw(
B0
B110
B1200
B134
B150
B1800
B19200
B200
B2400
B300
B38400
B4800
B50
B600
B75
B9600
BRKINT
CLOCAL
ECHONL
HUPCL
ICANON
ICRNL
IEXTEN
IGNBRK
IGNCR
IGNPAR
INLCR
INPCK
ISIG
ISTRIP
IXOFF
IXON
NCCS
NOFLSH
OPOST
PARENB
PARMRK
PARODD
tcdrain
tcflow
tcflush
TCIFLUSH
TCIOFF
TCIOFLUSH
TCION
TCOFLUSH
TCOOFF
TCOON
TCSADRAIN
TCSAFLUSH
TCSANOW
tcsendbreak
TOSTOP
ttyname
VEOF
VEOL
VERASE
VINTR
VKILL
VMIN
VQUIT
VSTART
VSTOP
VSUSP
VTIME
) ],
properties => [ qw(
%property
_POSIX2_C_BIND
_POSIX2_C_DEV
_POSIX2_CHAR_TERM
_POSIX2_LOCALEDEF
_POSIX2_SW_DEV
_POSIX2_VERSION
_POSIX_ADVISORY_INFO
_POSIX_AIO_LISTIO_MAX
_POSIX_AIO_MAX
_POSIX_ARG_MAX
_POSIX_ASYNC_IO
_POSIX_ASYNCHRONOUS_IO
_POSIX_BARRIERS
_POSIX_C_SOURCE
_POSIX_CHILD_MAX
_POSIX_CHOWN_RESTRICTED
_POSIX_CLOCK_SELECTION
_POSIX_CLOCKRES_MIN
_POSIX_CPUTIME
_POSIX_DELAYTIMER_MAX
_POSIX_FD_SETSIZE
_POSIX_FSYNC
_POSIX_HIWAT
_POSIX_HOST_NAME_MAX
_POSIX_IPV6
_POSIX_JOB_CONTROL
_POSIX_LINK_MAX
_POSIX_LOGIN_NAME_MAX
_POSIX_MAPPED_FILES
_POSIX_MAX_CANON
_POSIX_MAX_INPUT
_POSIX_MEMLOCK
_POSIX_MEMLOCK_RANGE
_POSIX_MEMORY_PROTECTION
_POSIX_MESSAGE_PASSING
_POSIX_MONOTONIC_CLOCK
_POSIX_MQ_OPEN_MAX
_POSIX_MQ_PRIO_MAX
_POSIX_NAME_MAX
_POSIX_NGROUPS_MAX
_POSIX_NO_TRUNC
_POSIX_OPEN_MAX
_POSIX_PATH_MAX
_POSIX_PIPE_BUF
_POSIX_PRIORITIZED_IO
_POSIX_PRIORITY_SCHEDULING
_POSIX_QLIMIT
_POSIX_RAW_SOCKETS
_POSIX_RE_DUP_MAX
_POSIX_READER_WRITER_LOCKS
_POSIX_REALTIME_SIGNALS
_POSIX_REENTRANT_FUNCTIONS
_POSIX_REGEXP
_POSIX_RTSIG_MAX
_POSIX_SAVED_IDS
_POSIX_SEM_NSEMS_MAX
_POSIX_SEM_VALUE_MAX
_POSIX_SEMAPHORES
_POSIX_SHARED_MEMORY_OBJECTS
_POSIX_SHELL
_POSIX_SIGQUEUE_MAX
_POSIX_SOURCE
_POSIX_SPAWN
_POSIX_SPIN_LOCKS
_POSIX_SPORADIC_SERVER
_POSIX_SSIZE_MAX
_POSIX_STREAM_MAX
_POSIX_SYMLINK_MAX
_POSIX_SYMLOOP_MAX
_POSIX_SYNCHRONIZED_IO
_POSIX_THREAD_ATTR_STACKADDR
_POSIX_THREAD_ATTR_STACKSIZE
_POSIX_THREAD_CPUTIME
_POSIX_THREAD_DESTRUCTOR_ITERATIONS
_POSIX_THREAD_KEYS_MAX
_POSIX_THREAD_PRIO_INHERIT
_POSIX_THREAD_PRIO_PROTECT
_POSIX_THREAD_PRIORITY_SCHEDULING
_POSIX_THREAD_PROCESS_SHARED
_POSIX_THREAD_ROBUST_PRIO_INHERIT
_POSIX_THREAD_ROBUST_PRIO_PROTECT
_POSIX_THREAD_SAFE_FUNCTIONS
_POSIX_THREAD_SPORADIC_SERVER
_POSIX_THREAD_THREADS_MAX
_POSIX_THREADS
_POSIX_TIMEOUTS
_POSIX_TIMER_MAX
_POSIX_TIMERS
_POSIX_TRACE
_POSIX_TRACE_EVENT_FILTER
_POSIX_TRACE_INHERIT
_POSIX_TRACE_LOG
_POSIX_TTY_NAME_MAX
_POSIX_TYPED_MEMORY_OBJECTS
_POSIX_TZNAME_MAX
_POSIX_UIO_MAXIOV
_POSIX_V6_LP64_OFF64
_POSIX_V6_LPBIG_OFFBIG
_POSIX_V7_LP64_OFF64
_POSIX_V7_LPBIG_OFFBIG
_POSIX_VDISABLE
_POSIX_VERSION
property
property_names
) ],
filesystem => [ qw(
%access
%stat
access
F_OK
FILENAME_MAX
lchown
lstat
major
makedev
MAX_CANON
minor
mkfifo
mknod
NAME_MAX
PATH_MAX
R_OK
rename
S_IFBLK
S_IFCHR
S_IFDIR
S_IFIFO
S_IFLNK
S_IFMT
S_IFREG
S_IFSOCK
S_IRGRP
S_IROTH
S_IRUSR
S_IRWXG
S_IRWXO
S_IRWXU
S_ISBLK
S_ISCHR
S_ISDIR
S_ISFIFO
S_ISLNK
S_ISREG
S_ISSOCK
S_ISVTX
S_ISWHT
S_IWGRP
S_IWOTH
S_IWUSR
S_IXGRP
S_IXOTH
S_IXUSR
stat
utime
W_OK
X_OK
) ],
sysconf => [ qw(
%sysconf
_SC_2_C_BIND
_SC_2_C_DEV
_SC_2_C_VERSION
_SC_2_CHAR_TERM
_SC_2_FORT_DEV
_SC_2_FORT_RUN
_SC_2_LOCALEDEF
_SC_2_PBS
_SC_2_PBS_ACCOUNTING
_SC_2_PBS_CHECKPOINT
_SC_2_PBS_LOCATE
_SC_2_PBS_MESSAGE
_SC_2_PBS_TRACK
_SC_2_SW_DEV
_SC_2_UPE
_SC_2_VERSION
_SC_ADVISORY_INFO
_SC_AIO_LISTIO_MAX
_SC_AIO_MAX
_SC_AIO_PRIO_DELTA_MAX
_SC_ARG_MAX
_SC_ASYNCHRONOUS_IO
_SC_ATEXIT_MAX
_SC_AVPHYS_PAGES
_SC_BARRIERS
_SC_BASE
_SC_BC_BASE_MAX
_SC_BC_DIM_MAX
_SC_BC_SCALE_MAX
_SC_BC_STRING_MAX
_SC_C_LANG_SUPPORT
_SC_C_LANG_SUPPORT_R
_SC_CHAR_BIT
_SC_CHAR_MAX
_SC_CHAR_MIN
_SC_CHARCLASS_NAME_MAX
_SC_CHILD_MAX
_SC_CLK_TCK
_SC_CLOCK_SELECTION
_SC_COLL_WEIGHTS_MAX
_SC_CPUTIME
_SC_DELAYTIMER_MAX
_SC_DEVICE_IO
_SC_DEVICE_SPECIFIC
_SC_DEVICE_SPECIFIC_R
_SC_EQUIV_CLASS_MAX
_SC_EXPR_NEST_MAX
_SC_FD_MGMT
_SC_FIFO
_SC_FILE_ATTRIBUTES
_SC_FILE_LOCKING
_SC_FILE_SYSTEM
_SC_FSYNC
_SC_GETGR_R_SIZE_MAX
_SC_GETPW_R_SIZE_MAX
_SC_HOST_NAME_MAX
_SC_INT_MAX
_SC_INT_MIN
_SC_IOV_MAX
_SC_IPV6
_SC_JOB_CONTROL
_SC_LEVEL1_DCACHE_ASSOC
_SC_LEVEL1_DCACHE_LINESIZE
_SC_LEVEL1_DCACHE_SIZE
_SC_LEVEL1_ICACHE_ASSOC
_SC_LEVEL1_ICACHE_LINESIZE
_SC_LEVEL1_ICACHE_SIZE
_SC_LEVEL2_CACHE_ASSOC
_SC_LEVEL2_CACHE_LINESIZE
_SC_LEVEL2_CACHE_SIZE
_SC_LEVEL3_CACHE_ASSOC
_SC_LEVEL3_CACHE_LINESIZE
_SC_LEVEL3_CACHE_SIZE
_SC_LEVEL4_CACHE_ASSOC
_SC_LEVEL4_CACHE_LINESIZE
_SC_LEVEL4_CACHE_SIZE
_SC_LINE_MAX
_SC_LOGIN_NAME_MAX
_SC_LONG_BIT
_SC_MAPPED_FILES
_SC_MB_LEN_MAX
_SC_MEMLOCK
_SC_MEMLOCK_RANGE
_SC_MEMORY_PROTECTION
_SC_MESSAGE_PASSING
_SC_MONOTONIC_CLOCK
_SC_MQ_OPEN_MAX
_SC_MQ_PRIO_MAX
_SC_MULTI_PROCESS
_SC_NETWORKING
_SC_NGROUPS_MAX
_SC_NL_ARGMAX
_SC_NL_LANGMAX
_SC_NL_MSGMAX
_SC_NL_NMAX
_SC_NL_SETMAX
_SC_NL_TEXTMAX
_SC_NPROCESSORS_CONF
_SC_NPROCESSORS_ONLN
_SC_NZERO
_SC_OPEN_MAX
_SC_PAGE_SIZE
_SC_PAGESIZE
_SC_PASS_MAX
_SC_PHYS_PAGES
_SC_PII
_SC_PII_INTERNET
_SC_PII_INTERNET_DGRAM
_SC_PII_INTERNET_STREAM
_SC_PII_OSI
_SC_PII_OSI_CLTS
_SC_PII_OSI_COTS
_SC_PII_OSI_M
_SC_PII_SOCKET
_SC_PII_XTI
_SC_PIPE
_SC_POLL
_SC_PRIORITIZED_IO
_SC_PRIORITY_SCHEDULING
_SC_RAW_SOCKETS
_SC_RE_DUP_MAX
_SC_READER_WRITER_LOCKS
_SC_REALTIME_SIGNALS
_SC_REGEX_VERSION
_SC_REGEXP
_SC_RTSIG_MAX
_SC_SAVED_IDS
_SC_SCHAR_MAX
_SC_SCHAR_MIN
_SC_SELECT
_SC_SEM_NSEMS_MAX
_SC_SEM_VALUE_MAX
_SC_SEMAPHORES
_SC_SHARED_MEMORY_OBJECTS
_SC_SHELL
_SC_SHRT_MAX
_SC_SHRT_MIN
_SC_SIGNALS
_SC_SIGQUEUE_MAX
_SC_SINGLE_PROCESS
_SC_SPAWN
_SC_SPIN_LOCKS
_SC_SPORADIC_SERVER
_SC_SS_REPL_MAX
_SC_SSIZE_MAX
_SC_STREAM_MAX
_SC_STREAMS
_SC_SYMLOOP_MAX
_SC_SYNCHRONIZED_IO
_SC_SYSTEM_DATABASE
_SC_SYSTEM_DATABASE_R
_SC_T_IOV_MAX
_SC_THREAD_ATTR_STACKADDR
_SC_THREAD_ATTR_STACKSIZE
_SC_THREAD_CPUTIME
_SC_THREAD_DESTRUCTOR_ITERATIONS
_SC_THREAD_KEYS_MAX
_SC_THREAD_PRIO_INHERIT
_SC_THREAD_PRIO_PROTECT
_SC_THREAD_PRIORITY_SCHEDULING
_SC_THREAD_PROCESS_SHARED
_SC_THREAD_ROBUST_PRIO_INHERIT
_SC_THREAD_ROBUST_PRIO_PROTECT
_SC_THREAD_SAFE_FUNCTIONS
_SC_THREAD_SPORADIC_SERVER
_SC_THREAD_STACK_MIN
_SC_THREAD_THREADS_MAX
_SC_THREADS
_SC_TIMEOUTS
_SC_TIMER_MAX
_SC_TIMERS
_SC_TRACE
_SC_TRACE_EVENT_FILTER
_SC_TRACE_EVENT_NAME_MAX
_SC_TRACE_INHERIT
_SC_TRACE_LOG
_SC_TRACE_NAME_MAX
_SC_TRACE_SYS_MAX
_SC_TRACE_USER_EVENT_MAX
_SC_TTY_NAME_MAX
_SC_TYPED_MEMORY_OBJECTS
_SC_TZNAME_MAX
_SC_UCHAR_MAX
_SC_UINT_MAX
_SC_UIO_MAXIOV
_SC_ULONG_MAX
_SC_USER_GROUPS
_SC_USER_GROUPS_R
_SC_USHRT_MAX
_SC_V6_ILP32_OFF32
_SC_V6_ILP32_OFFBIG
_SC_V6_LP64_OFF64
_SC_V6_LPBIG_OFFBIG
_SC_V7_ILP32_OFF32
_SC_V7_ILP32_OFFBIG
_SC_V7_LP64_OFF64
_SC_V7_LPBIG_OFFBIG
_SC_VERSION
_SC_WORD_BIT
_SC_XBS5_ILP32_OFF32
_SC_XBS5_ILP32_OFFBIG
_SC_XBS5_LP64_OFF64
_SC_XBS5_LPBIG_OFFBIG
_SC_XOPEN_CRYPT
_SC_XOPEN_ENH_I18N
_SC_XOPEN_LEGACY
_SC_XOPEN_REALTIME
_SC_XOPEN_REALTIME_THREADS
_SC_XOPEN_SHM
_SC_XOPEN_STREAMS
_SC_XOPEN_UNIX
_SC_XOPEN_VERSION
_SC_XOPEN_XCU_VERSION
_SC_XOPEN_XPG2
_SC_XOPEN_XPG3
_SC_XOPEN_XPG4
sysconf
sysconf_names
) ],
);
# shorter aliases:
$EXPORT_TAGS{cs} = $EXPORT_TAGS{confstr};
$EXPORT_TAGS{ev} = $EXPORT_TAGS{events};
$EXPORT_TAGS{fd} = $EXPORT_TAGS{fdio};
$EXPORT_TAGS{fs} = $EXPORT_TAGS{filesystem};
$EXPORT_TAGS{limit} = $EXPORT_TAGS{limits};
$EXPORT_TAGS{os} = $EXPORT_TAGS{opsys};
$EXPORT_TAGS{pc} = $EXPORT_TAGS{pathconf};
$EXPORT_TAGS{posix} = $EXPORT_TAGS{properties};
$EXPORT_TAGS{proc} = $EXPORT_TAGS{processes};
$EXPORT_TAGS{property} = $EXPORT_TAGS{properties};
$EXPORT_TAGS{props} = $EXPORT_TAGS{properties};
$EXPORT_TAGS{sc} = $EXPORT_TAGS{sysconf};
$EXPORT_TAGS{termio} = $EXPORT_TAGS{termios};
1;

View file

@ -0,0 +1,66 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Sysconf;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
use Carp 'croak';
my @constants;
my @functions = qw/sysconf sysconf_names/;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
, tables => [ '%sysconf' ]
);
my $sysconf;
our %sysconf;
BEGIN {
# initialize the :constants export tag
$sysconf = sysconf_table;
push @constants, keys %$sysconf;
tie %sysconf, 'POSIX::1003::ReadOnlyTable', $sysconf;
}
sub sysconf($);
sub exampleValue($)
{ my ($class, $name) = @_;
$name =~ m/^_SC_/ or return;
my $val = sysconf $name;
defined $val ? $val : 'undef';
}
sub sysconf($)
{ my $key = shift // return;
$key =~ /^_SC_/
or croak "pass the constant name as string";
my $id = $sysconf->{$key} // return;
my $val = POSIX::sysconf($id) // return;
$val+0; # remove " but true" from "0"
}
sub _create_constant($)
{ my ($class, $name) = @_;
my $id = $sysconf->{$name} // return sub() {undef};
sub() {POSIX::sysconf($id)};
}
sub sysconf_names() { keys %$sysconf }
1;

View file

@ -0,0 +1,316 @@
=encoding utf8
=head1 NAME
POSIX::1003::Sysconf - POSIX access to sysconf()
=head1 SYNOPSIS
use POSIX::1003::Sysconf; # load all names
use POSIX::1003::Sysconf qw(sysconf);
# keys are strings!
$ticks = sysconf('_SC_CLK_TCK');
use POSIX::1003::Sysconf qw(sysconf _SC_CLK_TCK);
$ticks = _SC_CLK_TCK; # constants are subs
use POSIX::1003::Sysconf '%sysconf';
my $key = $sysconf{_SC_CLK_TCK};
$sysconf{_SC_NEW_KEY} = $key_code;
$ticks = sysconf($key);
print "$_\n" for keys %sysconf;
=head1 DESCRIPTION
The C<sysconf()> interface can be used to query system information
in numerical form, where C<confstr()> returns strings.
=head1 FUNCTIONS
=head2 Standard POSIX
=over 4
=item B<sysconf>(NAME)
Returns the sysconf value related to the NAMEd constant. The NAME
must be a string. C<undef> will be returned when the NAME is not
known by the system.
example:
my $ticks = sysconf('_SC_CLK_TCK') || 1000;
=back
=head2 Additional
=over 4
=item B<sysconf_names>()
Returns a list with all known names, unsorted.
=back
=head1 CONSTANTS
=over 4
=item B<%sysconf>
This exported variable is a tied HASH which maps C<_SC_*> names
on unique numbers, to be used with the system's C<sysconf()> function.
=back
The following constants where detected on your system when the
module got installed. The second column shows the value which
where returned at that time.
=for comment
#TABLE_SYSCONF_START
_SC_2_C_BIND 200809
_SC_2_C_DEV 200809
_SC_2_C_VERSION undef
_SC_2_CHAR_TERM 200809
_SC_2_FORT_DEV undef
_SC_2_FORT_RUN undef
_SC_2_LOCALEDEF 200809
_SC_2_PBS undef
_SC_2_PBS_ACCOUNTING undef
_SC_2_PBS_CHECKPOINT undef
_SC_2_PBS_LOCATE undef
_SC_2_PBS_MESSAGE undef
_SC_2_PBS_TRACK undef
_SC_2_SW_DEV 200809
_SC_2_UPE undef
_SC_2_VERSION 200809
_SC_ADVISORY_INFO 200809
_SC_AIO_LISTIO_MAX undef
_SC_AIO_MAX undef
_SC_AIO_PRIO_DELTA_MAX 20
_SC_ARG_MAX 2097152
_SC_ASYNCHRONOUS_IO 200809
_SC_ATEXIT_MAX 2147483647
_SC_AVPHYS_PAGES 38454
_SC_BARRIERS 200809
_SC_BASE undef
_SC_BC_BASE_MAX 99
_SC_BC_DIM_MAX 2048
_SC_BC_SCALE_MAX 99
_SC_BC_STRING_MAX 1000
_SC_C_LANG_SUPPORT undef
_SC_C_LANG_SUPPORT_R undef
_SC_CHAR_BIT 8
_SC_CHAR_MAX 127
_SC_CHAR_MIN -128
_SC_CHARCLASS_NAME_MAX 2048
_SC_CHILD_MAX 61461
_SC_CLK_TCK 100
_SC_CLOCK_SELECTION 200809
_SC_COLL_WEIGHTS_MAX 255
_SC_CPUTIME 200809
_SC_DELAYTIMER_MAX 2147483647
_SC_DEVICE_IO undef
_SC_DEVICE_SPECIFIC undef
_SC_DEVICE_SPECIFIC_R undef
_SC_EQUIV_CLASS_MAX undef
_SC_EXPR_NEST_MAX 32
_SC_FD_MGMT undef
_SC_FIFO undef
_SC_FILE_ATTRIBUTES undef
_SC_FILE_LOCKING undef
_SC_FILE_SYSTEM undef
_SC_FSYNC 200809
_SC_GETGR_R_SIZE_MAX 1024
_SC_GETPW_R_SIZE_MAX 1024
_SC_HOST_NAME_MAX 64
_SC_INT_MAX 2147483647
_SC_INT_MIN -2147483648
_SC_IOV_MAX 1024
_SC_IPV6 200809
_SC_JOB_CONTROL 1
_SC_LEVEL1_DCACHE_ASSOC 8
_SC_LEVEL1_DCACHE_LINESIZE 64
_SC_LEVEL1_DCACHE_SIZE 32768
_SC_LEVEL1_ICACHE_ASSOC 8
_SC_LEVEL1_ICACHE_LINESIZE 64
_SC_LEVEL1_ICACHE_SIZE 32768
_SC_LEVEL2_CACHE_ASSOC 8
_SC_LEVEL2_CACHE_LINESIZE 64
_SC_LEVEL2_CACHE_SIZE 262144
_SC_LEVEL3_CACHE_ASSOC 12
_SC_LEVEL3_CACHE_LINESIZE 64
_SC_LEVEL3_CACHE_SIZE 6291456
_SC_LEVEL4_CACHE_ASSOC 0
_SC_LEVEL4_CACHE_LINESIZE 0
_SC_LEVEL4_CACHE_SIZE 0
_SC_LINE_MAX 2048
_SC_LOGIN_NAME_MAX 256
_SC_LONG_BIT 64
_SC_MAPPED_FILES 200809
_SC_MB_LEN_MAX 16
_SC_MEMLOCK 200809
_SC_MEMLOCK_RANGE 200809
_SC_MEMORY_PROTECTION 200809
_SC_MESSAGE_PASSING 200809
_SC_MONOTONIC_CLOCK 200809
_SC_MQ_OPEN_MAX undef
_SC_MQ_PRIO_MAX 32768
_SC_MULTI_PROCESS undef
_SC_NETWORKING undef
_SC_NGROUPS_MAX 65536
_SC_NL_ARGMAX 4096
_SC_NL_LANGMAX 2048
_SC_NL_MSGMAX 2147483647
_SC_NL_NMAX 2147483647
_SC_NL_SETMAX 2147483647
_SC_NL_TEXTMAX 2147483647
_SC_NPROCESSORS_CONF 4
_SC_NPROCESSORS_ONLN 4
_SC_NZERO 20
_SC_OPEN_MAX 1024
_SC_PAGE_SIZE 4096
_SC_PAGESIZE 4096
_SC_PASS_MAX 8192
_SC_PHYS_PAGES 1971261
_SC_PII undef
_SC_PII_INTERNET undef
_SC_PII_INTERNET_DGRAM undef
_SC_PII_INTERNET_STREAM undef
_SC_PII_OSI undef
_SC_PII_OSI_CLTS undef
_SC_PII_OSI_COTS undef
_SC_PII_OSI_M undef
_SC_PII_SOCKET undef
_SC_PII_XTI undef
_SC_PIPE undef
_SC_POLL undef
_SC_PRIORITIZED_IO 200809
_SC_PRIORITY_SCHEDULING 200809
_SC_RAW_SOCKETS 200809
_SC_RE_DUP_MAX 32767
_SC_READER_WRITER_LOCKS 200809
_SC_REALTIME_SIGNALS 200809
_SC_REGEX_VERSION undef
_SC_REGEXP 1
_SC_RTSIG_MAX 32
_SC_SAVED_IDS 1
_SC_SCHAR_MAX 127
_SC_SCHAR_MIN -128
_SC_SELECT undef
_SC_SEM_NSEMS_MAX undef
_SC_SEM_VALUE_MAX 2147483647
_SC_SEMAPHORES 200809
_SC_SHARED_MEMORY_OBJECTS 200809
_SC_SHELL 1
_SC_SHRT_MAX 32767
_SC_SHRT_MIN -32768
_SC_SIGNALS undef
_SC_SIGQUEUE_MAX 61461
_SC_SINGLE_PROCESS undef
_SC_SPAWN 200809
_SC_SPIN_LOCKS 200809
_SC_SPORADIC_SERVER undef
_SC_SS_REPL_MAX undef
_SC_SSIZE_MAX 32767
_SC_STREAM_MAX 16
_SC_STREAMS undef
_SC_SYMLOOP_MAX undef
_SC_SYNCHRONIZED_IO 200809
_SC_SYSTEM_DATABASE undef
_SC_SYSTEM_DATABASE_R undef
_SC_T_IOV_MAX undef
_SC_THREAD_ATTR_STACKADDR 200809
_SC_THREAD_ATTR_STACKSIZE 200809
_SC_THREAD_CPUTIME 200809
_SC_THREAD_DESTRUCTOR_ITERATIONS 4
_SC_THREAD_KEYS_MAX 1024
_SC_THREAD_PRIO_INHERIT 200809
_SC_THREAD_PRIO_PROTECT 200809
_SC_THREAD_PRIORITY_SCHEDULING 200809
_SC_THREAD_PROCESS_SHARED 200809
_SC_THREAD_ROBUST_PRIO_INHERIT undef
_SC_THREAD_ROBUST_PRIO_PROTECT undef
_SC_THREAD_SAFE_FUNCTIONS 200809
_SC_THREAD_SPORADIC_SERVER undef
_SC_THREAD_STACK_MIN 16384
_SC_THREAD_THREADS_MAX undef
_SC_THREADS 200809
_SC_TIMEOUTS 200809
_SC_TIMER_MAX undef
_SC_TIMERS 200809
_SC_TRACE undef
_SC_TRACE_EVENT_FILTER undef
_SC_TRACE_EVENT_NAME_MAX undef
_SC_TRACE_INHERIT undef
_SC_TRACE_LOG undef
_SC_TRACE_NAME_MAX undef
_SC_TRACE_SYS_MAX undef
_SC_TRACE_USER_EVENT_MAX undef
_SC_TTY_NAME_MAX 32
_SC_TYPED_MEMORY_OBJECTS undef
_SC_TZNAME_MAX 6
_SC_UCHAR_MAX 255
_SC_UINT_MAX 4294967295
_SC_UIO_MAXIOV 1024
_SC_ULONG_MAX undef
_SC_USER_GROUPS undef
_SC_USER_GROUPS_R undef
_SC_USHRT_MAX 65535
_SC_V6_ILP32_OFF32 undef
_SC_V6_ILP32_OFFBIG undef
_SC_V6_LP64_OFF64 1
_SC_V6_LPBIG_OFFBIG undef
_SC_V7_ILP32_OFF32 undef
_SC_V7_ILP32_OFFBIG undef
_SC_V7_LP64_OFF64 1
_SC_V7_LPBIG_OFFBIG undef
_SC_VERSION 200809
_SC_WORD_BIT 32
_SC_XBS5_ILP32_OFF32 undef
_SC_XBS5_ILP32_OFFBIG undef
_SC_XBS5_LP64_OFF64 1
_SC_XBS5_LPBIG_OFFBIG undef
_SC_XOPEN_CRYPT 1
_SC_XOPEN_ENH_I18N 1
_SC_XOPEN_LEGACY 1
_SC_XOPEN_REALTIME 1
_SC_XOPEN_REALTIME_THREADS 1
_SC_XOPEN_SHM 1
_SC_XOPEN_STREAMS undef
_SC_XOPEN_UNIX 1
_SC_XOPEN_VERSION 700
_SC_XOPEN_XCU_VERSION 4
_SC_XOPEN_XPG2 1
_SC_XOPEN_XPG3 1
_SC_XOPEN_XPG4 1
=for comment
#TABLE_SYSCONF_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,46 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Termios;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module', 'POSIX::Termios';
my @speed = qw/
B0 B110 B1200 B134 B150 B1800 B19200 B200 B2400
B300 B38400 B4800 B50 B600 B75 B9600
/;
my @flags = qw/
BRKINT CLOCAL ECHONL HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR
INLCR INPCK ISIG ISTRIP IXOFF IXON NCCS NOFLSH OPOST PARENB PARMRK
PARODD TOSTOP VEOF VEOL VERASE VINTR VKILL VMIN VQUIT VSTART VSTOP
VSUSP VTIME
/;
my @actions = qw/
TCSADRAIN TCSANOW TCOON TCION TCSAFLUSH TCIOFF TCOOFF
/;
my @flush = qw/TCIOFLUSH TCOFLUSH TCIFLUSH/;
my @functions = qw/
tcdrain tcflow tcflush tcsendbreak
ttyname
/;
our %EXPORT_TAGS =
( speed => \@speed
, flags => \@flags
, actions => \@actions
, flush => \@flush
, constants => [@speed, @flags, @actions, @flush]
, functions => \@functions
);
1;

View file

@ -0,0 +1,259 @@
=encoding utf8
=head1 NAME
POSIX::1003::Termios - POSIX general terminal interface
=head1 SYNOPSIS
use POSIX::1003::Termios qw(:speed);
$termios = POSIX::1003::Termios->new;
$ispeed = $termios->getispeed;
$termios->setospeed(B9600);
use POSIX::1003::Termios qw(:functions :actions);
tcsendbreak($fd, $duration);
tcflush($fd, TCIFLUSH);
$tty = ttyname($fd);
$tty = ttyname($fh->fileno);
=head1 DESCRIPTION
This module provides an interface to the "General Terminal Interfaces",
as specified by POSIX. The actual implementation is part of POSIX.xs
=head1 METHODS
=head2 Constructors
=over 4
=item POSIX::1003::Termios-E<gt>B<new>()
Create a new Termios object. This object will be destroyed automatically
when it is no longer needed. A Termios object corresponds to the
termios C struct.
$termios = POSIX::1003::Termios->new;
=back
=head2 Accessors
=over 4
=item $obj-E<gt>B<getattr>([FD])
Get terminal control attributes (POSIX function C<tcgetattr>). Pass a file
descriptor, which defaults to C<0> (stdin). Returns C<undef> on failure.
# Obtain the attributes for stdin
$termios->getattr(0);
$termios->getattr();
# Obtain the attributes for stdout
$termios->getattr(1);
=item $obj-E<gt>B<getcc>(INDEX)
Retrieve a value from the C<c_cc> field of a termios object. The c_cc field is
an array so an index must be specified.
$c_cc[1] = $termios->getcc(1);
=item $obj-E<gt>B<getcflag>()
Retrieve the C<c_cflag> field of a termios object.
$c_cflag = $termios->getcflag;
=item $obj-E<gt>B<getiflag>()
Retrieve the C<c_iflag> field of a termios object.
$c_iflag = $termios->getiflag;
=item $obj-E<gt>B<getispeed>()
Retrieve the input baud rate.
$ispeed = $termios->getispeed;
=item $obj-E<gt>B<getlflag>()
Retrieve the C<c_lflag> field of a termios object.
$c_lflag = $termios->getlflag;
=item $obj-E<gt>B<getoflag>()
Retrieve the C<c_oflag> field of a termios object.
$c_oflag = $termios->getoflag;
=item $obj-E<gt>B<getospeed>()
Retrieve the output baud rate.
$ospeed = $termios->getospeed;
=item $obj-E<gt>B<setattr>(FD, FLAGS)
Set terminal control attributes (POSIX function C<tcsetattr>). Returns
C<undef> on failure.
# Set attributes immediately for stdout.
$termios->setattr(1, TCSANOW);
=item $obj-E<gt>B<setcc>(VALUE, INDEX)
Set a value in the C<c_cc> field of a termios object. The c_cc field is an
array so an index must be specified.
$termios->setcc(VEOF, 1 );
=item $obj-E<gt>B<setcflag>(FLAGS)
Set the C<c_cflag> field of a termios object.
$termios->setcflag( $c_cflag | CLOCAL );
=item $obj-E<gt>B<setiflag>(FLAGS)
Set the C<c_iflag> field of a termios object.
$termios->setiflag( $c_iflag | BRKINT );
=item $obj-E<gt>B<setispeed>()
Set the input baud rate. Returns C<undef> on failure.
$termios->setispeed( B9600 );
=item $obj-E<gt>B<setlflag>(FLAGS)
Set the C<c_lflag> field of a termios object.
$termios->setlflag( $c_lflag | ECHO );
=item $obj-E<gt>B<setoflag>(FLAGS)
Set the c_oflag field of a termios object.
$termios->setoflag( $c_oflag | OPOST );
=item $obj-E<gt>B<setospeed>()
Set the output baud rate.
$termios->setospeed( B9600 );
=back
=head1 FUNCTIONS
=over 4
=item B<tcdrain>(FD)
=item B<tcflow>(FD, ACTION)
See the possible ACTION values in L</CONSTANTS>, import tag C<:action>
=item B<tcflush>(FD, QUEUE)
See the possible QUEUE values in L</CONSTANTS>, import tag C<:flush>
=item B<tcsendbreak>(FD, DURATION)
DURATION is system dependent.
=item B<ttyname>(FD)
Returns the path to the special device which relates to the file-descriptor.
See also L<POSIX::1003::Proc::ctermid()|POSIX::1003::Proc/"Standard POSIX functions from unistd.h">
$tty = ttyname($fd);
$tty = ttyname($fh->fileno);
=back
=head1 CONSTANTS
=over 4
=item Available baudrates (ispeed and ospeed), export tag C<:speed>.
B0 B50 B75 B110 B134 B150 B200 B300 B600 B1200
B1800 B2400 B4800 B9600 B19200 B38400
=item Interface values (getattr and setattr), export tag C<:actions>.
TCSADRAIN TCSANOW TCOON TCION TCSAFLUSH TCIOFF TCOOFF
=item To be used as L<tcflush()|POSIX::1003::Termios/"FUNCTIONS"> parameter QUEUE
TCIOFLUSH TCOFLUSH TCIFLUSH
=item c_cc field values, export tag C<:flags> as have all following constants.
VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN
VTIME NCCS
=item c_cflag field values
CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
=item c_iflag field values
BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF
IXON PARMRK
=item c_lflag field values
ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
=item c_oflag field values
OPOST
=back
All constants, shown here with the values discovered during installation
of this module:
=for comment
#TABLE_TERMIOS_START
B0 0 ICANON 2 TCIOFLUSH 2
B110 3 ICRNL 256 TCION 3
B1200 9 IEXTEN 32768 TCOFLUSH 1
B134 4 IGNBRK 1 TCOOFF 0
B150 5 IGNCR 128 TCOON 1
B1800 10 IGNPAR 4 TCSADRAIN 1
B19200 14 INLCR 64 TCSAFLUSH 2
B200 6 INPCK 16 TCSANOW 0
B2400 11 ISIG 1 TOSTOP 256
B300 7 ISTRIP 32 VEOF 4
B38400 15 IXOFF 4096 VEOL 11
B4800 12 IXON 1024 VERASE 2
B50 1 NCCS 32 VINTR 0
B600 8 NOFLSH 128 VKILL 3
B75 2 OPOST 1 VMIN 6
B9600 13 PARENB 256 VQUIT 1
BRKINT 2 PARMRK 8 VSTART 8
CLOCAL 2048 PARODD 512 VSTOP 9
ECHONL 64 TCIFLUSH 0 VSUSP 10
HUPCL 1024 TCIOFF 2 VTIME 5
=for comment
#TABLE_TERMIOS_END
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,37 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
package POSIX::1003::Time;
use vars '$VERSION';
$VERSION = '0.93';
use base 'POSIX::1003::Module';
# Blocks resp. defined in time.h, limits.h
my @constants = qw/
CLK_TCK CLOCKS_PER_SEC NULL
TZNAME_MAX
/;
our @IN_CORE = qw/gmtime localtime/;
my @functions = qw/
asctime ctime strftime
clock difftime mktime
tzset tzname/;
push @functions, @IN_CORE;
our %EXPORT_TAGS =
( constants => \@constants
, functions => \@functions
);
# Everything in POSIX.xs
1;

View file

@ -0,0 +1,142 @@
=encoding utf8
=head1 NAME
POSIX::1003::Time - POSIX handling time
=head1 SYNOPSIS
use POSIX::1003::Time;
tzset(); # set-up local timezone from $ENV{TZ}
($std, $dst) = tzname; # timezone abbreviations
$str = ctime($timestamp); # is equivalent to:
$str = asctime(localtime($timestamp))
$str = strftime("%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2);
# $str contains "Tuesday, December 12, 1995"
$timestamp = mktime(0, 30, 10, 12, 11, 95);
print "Date = ", ctime($timestamp);
print scalar localtime;
my $year = (localtime)[5] + 1900;
$timespan = difftime($end, $begin);
=head1 FUNCTIONS
=head2 Standard POSIX
B<Warning:> the functions L<asctime()|POSIX::1003::Time/"Standard POSIX">, L<mktime()|POSIX::1003::Time/"Standard POSIX">, and L<strftime()|POSIX::1003::Time/"Standard POSIX">
share a weird complex encoding with L<localtime()|POSIX::1003::Time/"Standard POSIX"> and L<gmtime()|POSIX::1003::Time/"Standard POSIX">:
the month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at
zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0,
not 1. The year (C<year>) is given in years since 1900. I.e., the year
1995 is 95; the year 2001 is 101.
=over 4
=item B<asctime>(SEC, MIN, HOUR, MDAY, MON, YEAR, ...)
The C<asctime> function uses C<strftime> with a fixed format, to produce
timestamps with a trailing new-line. Example:
"Sun Sep 16 01:03:52 1973\n"
The parameter order is the same as for L<strftime()|POSIX::1003::Time/"Standard POSIX"> without the C<$fmt>:
my $str = asctime($sec, $min, $hour, $mday, $mon, $year,
$wday, $yday, $isdst);
=item B<clock>()
The amount of spent processor time in microseconds.
=item B<ctime>(TIMESTAMP)
# equivalent
my $str = ctime $timestamp;
my $str = asctime localtime $timestamp;
=item B<difftime>(TIMESTAMP, TIMESTAMP)
Difference between two TIMESTAMPs, which are floats.
$timespan = difftime($end, $begin);
=item B<gmtime>([TIME])
Simply L<perlfunc/gmtime>
=item B<localtime>([TIME])
Simply L<perlfunc/localtime>
=item B<mktime>(SEC, MIN, HOUR, MDAY, MON, YEAR, ...)
Convert date/time info to a calendar time.
Returns "undef" on failure.
my $t = mktime(sec, min, hour, mday, mon, year,
wday = 0, yday = 0, isdst = -1)
# Calendar time for December 12, 1995, at 10:30 am
$timestamp = mktime(0, 30, 10, 12, 11, 95);
print "Date = ", ctime($time_t);
=item B<strftime>(FMT, SEC, MIN, HOUR, MDAY, MON, YEAR, ...)
The formatting of C<strftime> is extremely flexible but the parameters
are quite tricky. Read carefully!
my $str = strftime($fmt, $sec, $min, $hour,
$mday, $mon, $year, $wday, $yday, $isdst);
If you want your code to be portable, your format (FMT) argument
should use only the conversion specifiers defined by the ANSI C
standard (C89, to play safe). These are C<aAbBcdHIjmMpSUwWxXyYZ%>.
But even then, the results of some of the conversion specifiers are
non-portable.
=item B<tzname>()
Returns the strings to be used to represent Standard time (STD)
respectively Daylight Savings Time (DST).
tzset();
my ($std, $dst) = tzname;
=item B<tzset>()
Set-up local timezone from C<$ENV{TZ}> and the OS.
=back
=head1 CONSTANTS
=head2 Constants from time.h
CLK_TCK CLOCKS_PER_SEC NULL
=head2 Constants from limits.h
TXNAME_MAX
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
no warnings 'redefine', 'prototype'; # during release of distribution
sub POSIX::SigAction::new
{ my $class = shift;
bless {HANDLER => $_[0], MASK => $_[1], FLAGS => $_[2] || 0, SAFE => 0},
$class;
}
#---------------------------
# We cannot use a "package" statement, because it confuses CPAN: the
# namespace is assigned to the perl core distribution.
no warnings 'redefine';
sub POSIX::SigAction::handler($;$)
{ $_[0]->{HANDLER} = $_[1] if @_ > 1; $_[0]->{HANDLER} }
sub POSIX::SigAction::mask($;$)
{ $_[0]->{MASK} = $_[1] if @_ > 1; $_[0]->{MASK} }
sub POSIX::SigAction::flags($;$)
{ $_[0]->{FLAGS} = $_[1] if @_ > 1; $_[0]->{FLAGS} }
sub POSIX::SigAction::safe($;$)
{ $_[0]->{SAFE} = $_[1] if @_ > 1; $_[0]->{SAFE} }
1;

View file

@ -0,0 +1,89 @@
=encoding utf8
=head1 NAME
POSIX::SigAction - represent a struct sigaction
=head1 SYNOPSIS
$sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
$sigaction = POSIX::SigAction
->new(\&handler, $sigset, SA_NOCLDSTOP);
$sigset = $sigaction->mask;
$sigaction->flags(SA_RESTART);
$sigaction->safe(1);
=head1 DESCRIPTION
The C<POSIX::SigAction> object corresponds to the C C<struct sigaction>,
defined by C<signal.h>.
This module is a bit tricky: POSIX.pm contains the same code for
the C<POSIX::SigAction> namespace. However, we do not need POSIX.pm
but only the POSIX.xs component which has the namespace hard-coded.
=head1 METHODS
=head2 Constructors
=over 4
=item POSIX::SigAction-E<gt>B<new>(HANDLER, [SIGSET, [FLAGS]])
The first parameter is the handler, a code reference. The second parameter
is a L<POSIX::SigSet|POSIX::SigSet> object, it defaults to the empty set. The third
parameter contains the C<sa_flags>, it defaults to 0.
This object will be destroyed automatically when it is no longer needed.
=back
=head2 Accessors
=over 4
=item $obj-E<gt>B<flags>()
Accessor functions to get/set the values of a SigAction object.
=item $obj-E<gt>B<handler>()
=item $obj-E<gt>B<mask>()
=item $obj-E<gt>B<safe>()
Accessor function for the "safe signals" flag of a SigAction object; see
L<perlipc> for general information on safe (a.k.a. "deferred") signals. If
you wish to handle a signal safely, use this accessor to set the "safe" flag
in the C<POSIX::SigAction> object:
$sigaction->safe(1);
You may also examine the "safe" flag on the output action object which is
filled in when given as the third parameter to
L<POSIX::1003::Signals::sigaction()|POSIX::1003::Signals/"Standard POSIX">:
sigaction(SIGINT, $new_action, $old_action);
if ($old_action->safe) {
# previous SIGINT handler used safe signals
}
=back
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,11 @@
# Copyrights 2011-2013 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use warnings;
use strict;
# Implemented in XS
1;

View file

@ -0,0 +1,88 @@
=encoding utf8
=head1 NAME
POSIX::SigSet - collect signal flags
=head1 SYNOPSIS
use POSIX::SigSet ();
use POSIX::1003::Signals;
$sigset = POSIX::SigSet->new;
$sigset = POSIX::SigSet->new(SIGUSR1);
$sigset->addset(SIGUSR2);
$sigset->delset(SIGUSR2);
$sigset->emptyset();
$sigset->fillset();
if( $sigset->ismember(SIGUSR1) ) { ... }
=head1 DESCRIPTION
The C<POSIX::SigSet> object is simple a collection of signal flags. The
object is administered in POSIX.xs. See L<POSIX::SigAction|POSIX::SigAction> for
examples of its usage.
=head1 METHODS
=head2 Constructors
=over 4
=item POSIX::SigSet-E<gt>B<new>([SIGNALS])
Create a new SigSet object. One or more SIGNALS can be added immediately.
The object will be destroyed automatically when it is no longer needed.
=back
=head2 Other
=over 4
=item $obj-E<gt>B<addset>(SIGNAL)
Add one signal to a SigSet object. Returns C<undef> on failure.
=item $obj-E<gt>B<delset>(SIGNAL)
Remove one signal from the SigSet object.
Returns C<undef> on failure.
=item $obj-E<gt>B<emptyset>()
Initialize the SigSet object to be empty. Returns C<undef> on failure.
=item $obj-E<gt>B<fillset>()
Initialize the SigSet object to include all signals. Returns C<undef>
on failure.
=item $obj-E<gt>B<ismember>()
Tests the SigSet object to see if it contains a specific signal.
example:
if($sigset->ismember(SIGUSR1)) {
print "contains SIGUSR1\n";
}
=back
=head1 SEE ALSO
This module is part of POSIX-1003 distribution version 0.93,
built on April 23, 2013. Website: F<http://perl.overmeer.net>. The code is based on L<POSIX>, which
is released with Perl itself. See also L<POSIX::Util> for
additional functionality.
=head1 COPYRIGHTS
Copyrights 2011-2013 on the perl code and the related documentation
by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

View file

@ -0,0 +1,42 @@
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Confstr.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Confstr.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Events.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Events.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/FS.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/FS.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/FdIO.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/FdIO.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Limit.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Limit.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Locale.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Locale.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Math.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Math.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Module.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Module.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/OS.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/OS.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Pathconf.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Pathconf.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Proc.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Proc.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Properties.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Properties.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Signals.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Signals.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Symbols.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Sysconf.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Sysconf.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Termios.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Termios.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Time.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/1003/Time.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/Overview.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/SigAction.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/SigAction.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/SigSet.pm
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/POSIX/SigSet.pod
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/auto/POSIX/1003/1003.bs
/mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5/x86_64-linux/auto/POSIX/1003/1003.so

View file

Binary file not shown.

View file

@ -0,0 +1,22 @@
=head2 Sun Aug 11 17:26:50 2013: C<Module> L<POSIX::1003|POSIX::1003>
=over 4
=item *
C<installed into: /mnt/mintdisk/home/ryan/workspace/web_light/extern/lib/perl5>
=item *
C<LINKTYPE: dynamic>
=item *
C<VERSION: 0.93>
=item *
C<EXE_FILES: >
=back

1
lib/POSIX Symbolic link
View file

@ -0,0 +1 @@
../extern/lib/perl5/x86_64-linux/POSIX

491
lib/_h2ph_pre.ph Normal file
View file

@ -0,0 +1,491 @@
# This file was created by h2ph version 3
unless (defined &_FILE_OFFSET_BITS) { sub _FILE_OFFSET_BITS() { 64 } }
unless (defined &_FORTIFY_SOURCE) { sub _FORTIFY_SOURCE() { 2 } }
unless (defined &_LARGEFILE_SOURCE) { sub _LARGEFILE_SOURCE() { 1 } }
unless (defined &_LP64) { sub _LP64() { 1 } }
unless (defined &_POSIX_C_SOURCE) { sub _POSIX_C_SOURCE() { 200809 } }
unless (defined &_POSIX_SOURCE) { sub _POSIX_SOURCE() { 1 } }
unless (defined &__ATOMIC_ACQUIRE) { sub __ATOMIC_ACQUIRE() { 2 } }
unless (defined &__ATOMIC_ACQ_REL) { sub __ATOMIC_ACQ_REL() { 4 } }
unless (defined &__ATOMIC_CONSUME) { sub __ATOMIC_CONSUME() { 1 } }
unless (defined &__ATOMIC_RELAXED) { sub __ATOMIC_RELAXED() { 0 } }
unless (defined &__ATOMIC_RELEASE) { sub __ATOMIC_RELEASE() { 3 } }
unless (defined &__ATOMIC_SEQ_CST) { sub __ATOMIC_SEQ_CST() { 5 } }
unless (defined &__BIGGEST_ALIGNMENT__) { sub __BIGGEST_ALIGNMENT__() { 16 } }
unless (defined &__BYTE_ORDER__) { sub __BYTE_ORDER__() { 1234 } }
unless (defined &__CHAR16_TYPE__) { sub __CHAR16_TYPE__() { "short\\\ unsigned\\\ int" } }
unless (defined &__CHAR32_TYPE__) { sub __CHAR32_TYPE__() { "unsigned\\\ int" } }
unless (defined &__CHAR_BIT__) { sub __CHAR_BIT__() { 8 } }
unless (defined &__DBL_DECIMAL_DIG__) { sub __DBL_DECIMAL_DIG__() { 17 } }
unless (defined &__DBL_DENORM_MIN__) { sub __DBL_DENORM_MIN__() { "\(double\)4\.94065645841246544177e\-324L" } }
unless (defined &__DBL_DIG__) { sub __DBL_DIG__() { 15 } }
unless (defined &__DBL_EPSILON__) { sub __DBL_EPSILON__() { "\(double\)2\.22044604925031308085e\-16L" } }
unless (defined &__DBL_HAS_DENORM__) { sub __DBL_HAS_DENORM__() { 1 } }
unless (defined &__DBL_HAS_INFINITY__) { sub __DBL_HAS_INFINITY__() { 1 } }
unless (defined &__DBL_HAS_QUIET_NAN__) { sub __DBL_HAS_QUIET_NAN__() { 1 } }
unless (defined &__DBL_MANT_DIG__) { sub __DBL_MANT_DIG__() { 53 } }
unless (defined &__DBL_MAX_10_EXP__) { sub __DBL_MAX_10_EXP__() { 308 } }
unless (defined &__DBL_MAX_EXP__) { sub __DBL_MAX_EXP__() { 1024 } }
unless (defined &__DBL_MAX__) { sub __DBL_MAX__() { "\(double\)1\.79769313486231570815e\+308L" } }
unless (defined &__DBL_MIN_10_EXP__) { sub __DBL_MIN_10_EXP__() { -307 } }
unless (defined &__DBL_MIN_EXP__) { sub __DBL_MIN_EXP__() { -1021 } }
unless (defined &__DBL_MIN__) { sub __DBL_MIN__() { "\(double\)2\.22507385850720138309e\-308L" } }
unless (defined &__DEC128_EPSILON__) { sub __DEC128_EPSILON__() { "1E\-33DL" } }
unless (defined &__DEC128_MANT_DIG__) { sub __DEC128_MANT_DIG__() { 34 } }
unless (defined &__DEC128_MAX_EXP__) { sub __DEC128_MAX_EXP__() { 6145 } }
unless (defined &__DEC128_MAX__) { sub __DEC128_MAX__() { "9\.999999999999999999999999999999999E6144DL" } }
unless (defined &__DEC128_MIN_EXP__) { sub __DEC128_MIN_EXP__() { -6142 } }
unless (defined &__DEC128_MIN__) { sub __DEC128_MIN__() { "1E\-6143DL" } }
unless (defined &__DEC128_SUBNORMAL_MIN__) { sub __DEC128_SUBNORMAL_MIN__() { "0\.000000000000000000000000000000001E\-6143DL" } }
unless (defined &__DEC32_EPSILON__) { sub __DEC32_EPSILON__() { "1E\-6DF" } }
unless (defined &__DEC32_MANT_DIG__) { sub __DEC32_MANT_DIG__() { 7 } }
unless (defined &__DEC32_MAX_EXP__) { sub __DEC32_MAX_EXP__() { 97 } }
unless (defined &__DEC32_MAX__) { sub __DEC32_MAX__() { "9\.999999E96DF" } }
unless (defined &__DEC32_MIN_EXP__) { sub __DEC32_MIN_EXP__() { -94 } }
unless (defined &__DEC32_MIN__) { sub __DEC32_MIN__() { "1E\-95DF" } }
unless (defined &__DEC32_SUBNORMAL_MIN__) { sub __DEC32_SUBNORMAL_MIN__() { "0\.000001E\-95DF" } }
unless (defined &__DEC64_EPSILON__) { sub __DEC64_EPSILON__() { "1E\-15DD" } }
unless (defined &__DEC64_MANT_DIG__) { sub __DEC64_MANT_DIG__() { 16 } }
unless (defined &__DEC64_MAX_EXP__) { sub __DEC64_MAX_EXP__() { 385 } }
unless (defined &__DEC64_MAX__) { sub __DEC64_MAX__() { "9\.999999999999999E384DD" } }
unless (defined &__DEC64_MIN_EXP__) { sub __DEC64_MIN_EXP__() { -382 } }
unless (defined &__DEC64_MIN__) { sub __DEC64_MIN__() { "1E\-383DD" } }
unless (defined &__DEC64_SUBNORMAL_MIN__) { sub __DEC64_SUBNORMAL_MIN__() { "0\.000000000000001E\-383DD" } }
unless (defined &__DECIMAL_BID_FORMAT__) { sub __DECIMAL_BID_FORMAT__() { 1 } }
unless (defined &__DECIMAL_DIG__) { sub __DECIMAL_DIG__() { 21 } }
unless (defined &__DEC_EVAL_METHOD__) { sub __DEC_EVAL_METHOD__() { 2 } }
unless (defined &__ELF__) { sub __ELF__() { 1 } }
unless (defined &__FINITE_MATH_ONLY__) { sub __FINITE_MATH_ONLY__() { 0 } }
unless (defined &__FLOAT_WORD_ORDER__) { sub __FLOAT_WORD_ORDER__() { 1234 } }
unless (defined &__FLT_DECIMAL_DIG__) { sub __FLT_DECIMAL_DIG__() { 9 } }
unless (defined &__FLT_DENORM_MIN__) { sub __FLT_DENORM_MIN__() { 1.40129846432481707092e-45 } }
unless (defined &__FLT_DIG__) { sub __FLT_DIG__() { 6 } }
unless (defined &__FLT_EPSILON__) { sub __FLT_EPSILON__() { 1.19209289550781250000e-7 } }
unless (defined &__FLT_EVAL_METHOD__) { sub __FLT_EVAL_METHOD__() { 0 } }
unless (defined &__FLT_HAS_DENORM__) { sub __FLT_HAS_DENORM__() { 1 } }
unless (defined &__FLT_HAS_INFINITY__) { sub __FLT_HAS_INFINITY__() { 1 } }
unless (defined &__FLT_HAS_QUIET_NAN__) { sub __FLT_HAS_QUIET_NAN__() { 1 } }
unless (defined &__FLT_MANT_DIG__) { sub __FLT_MANT_DIG__() { 24 } }
unless (defined &__FLT_MAX_10_EXP__) { sub __FLT_MAX_10_EXP__() { 38 } }
unless (defined &__FLT_MAX_EXP__) { sub __FLT_MAX_EXP__() { 128 } }
unless (defined &__FLT_MAX__) { sub __FLT_MAX__() { 3.40282346638528859812e+38 } }
unless (defined &__FLT_MIN_10_EXP__) { sub __FLT_MIN_10_EXP__() { -37 } }
unless (defined &__FLT_MIN_EXP__) { sub __FLT_MIN_EXP__() { -125 } }
unless (defined &__FLT_MIN__) { sub __FLT_MIN__() { 1.17549435082228750797e-38 } }
unless (defined &__FLT_RADIX__) { sub __FLT_RADIX__() { 2 } }
unless (defined &__GCC_ATOMIC_BOOL_LOCK_FREE) { sub __GCC_ATOMIC_BOOL_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_CHAR16_T_LOCK_FREE) { sub __GCC_ATOMIC_CHAR16_T_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_CHAR32_T_LOCK_FREE) { sub __GCC_ATOMIC_CHAR32_T_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_CHAR_LOCK_FREE) { sub __GCC_ATOMIC_CHAR_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_INT_LOCK_FREE) { sub __GCC_ATOMIC_INT_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_LLONG_LOCK_FREE) { sub __GCC_ATOMIC_LLONG_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_LONG_LOCK_FREE) { sub __GCC_ATOMIC_LONG_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_POINTER_LOCK_FREE) { sub __GCC_ATOMIC_POINTER_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_SHORT_LOCK_FREE) { sub __GCC_ATOMIC_SHORT_LOCK_FREE() { 2 } }
unless (defined &__GCC_ATOMIC_TEST_AND_SET_TRUEVAL) { sub __GCC_ATOMIC_TEST_AND_SET_TRUEVAL() { 1 } }
unless (defined &__GCC_ATOMIC_WCHAR_T_LOCK_FREE) { sub __GCC_ATOMIC_WCHAR_T_LOCK_FREE() { 2 } }
unless (defined &__GCC_HAVE_DWARF2_CFI_ASM) { sub __GCC_HAVE_DWARF2_CFI_ASM() { 1 } }
unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1() { 1 } }
unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2() { 1 } }
unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4() { 1 } }
unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8() { 1 } }
unless (defined &__GLIBC_MINOR__) { sub __GLIBC_MINOR__() { 15 } }
unless (defined &__GLIBC__) { sub __GLIBC__() { 2 } }
unless (defined &__GNUC_GNU_INLINE__) { sub __GNUC_GNU_INLINE__() { 1 } }
unless (defined &__GNUC_MINOR__) { sub __GNUC_MINOR__() { 7 } }
unless (defined &__GNUC_PATCHLEVEL__) { sub __GNUC_PATCHLEVEL__() { 2 } }
unless (defined &__GNUC__) { sub __GNUC__() { 4 } }
unless (defined &__GNU_LIBRARY__) { sub __GNU_LIBRARY__() { 6 } }
unless (defined &__GXX_ABI_VERSION) { sub __GXX_ABI_VERSION() { 1002 } }
unless (defined &__INT16_C) { sub __INT16_C($) { my ($c) = @_; "${c}" } }
unless (defined &__INT16_MAX__) { sub __INT16_MAX__() { 32767 } }
unless (defined &__INT16_TYPE__) { sub __INT16_TYPE__() { "short\\\ int" } }
unless (defined &__INT32_C) { sub __INT32_C($) { my ($c) = @_; "${c}" } }
unless (defined &__INT32_MAX__) { sub __INT32_MAX__() { 2147483647 } }
unless (defined &__INT32_TYPE__) { sub __INT32_TYPE__() { "int" } }
unless (defined &__INT64_C) { sub __INT64_C($) { my ($c) = @_; "${c}L" } }
unless (defined &__INT64_MAX__) { sub __INT64_MAX__() { 9223372036854775807 } }
unless (defined &__INT64_TYPE__) { sub __INT64_TYPE__() { "long\\\ int" } }
unless (defined &__INT8_C) { sub __INT8_C($) { my ($c) = @_; "${c}" } }
unless (defined &__INT8_MAX__) { sub __INT8_MAX__() { 127 } }
unless (defined &__INT8_TYPE__) { sub __INT8_TYPE__() { "signed\\\ char" } }
unless (defined &__INTMAX_C) { sub __INTMAX_C($) { my ($c) = @_; "${c}L" } }
unless (defined &__INTMAX_MAX__) { sub __INTMAX_MAX__() { 9223372036854775807 } }
unless (defined &__INTMAX_TYPE__) { sub __INTMAX_TYPE__() { "long\\\ int" } }
unless (defined &__INTPTR_MAX__) { sub __INTPTR_MAX__() { 9223372036854775807 } }
unless (defined &__INTPTR_TYPE__) { sub __INTPTR_TYPE__() { "long\\\ int" } }
unless (defined &__INT_FAST16_MAX__) { sub __INT_FAST16_MAX__() { 9223372036854775807 } }
unless (defined &__INT_FAST16_TYPE__) { sub __INT_FAST16_TYPE__() { "long\\\ int" } }
unless (defined &__INT_FAST32_MAX__) { sub __INT_FAST32_MAX__() { 9223372036854775807 } }
unless (defined &__INT_FAST32_TYPE__) { sub __INT_FAST32_TYPE__() { "long\\\ int" } }
unless (defined &__INT_FAST64_MAX__) { sub __INT_FAST64_MAX__() { 9223372036854775807 } }
unless (defined &__INT_FAST64_TYPE__) { sub __INT_FAST64_TYPE__() { "long\\\ int" } }
unless (defined &__INT_FAST8_MAX__) { sub __INT_FAST8_MAX__() { 127 } }
unless (defined &__INT_FAST8_TYPE__) { sub __INT_FAST8_TYPE__() { "signed\\\ char" } }
unless (defined &__INT_LEAST16_MAX__) { sub __INT_LEAST16_MAX__() { 32767 } }
unless (defined &__INT_LEAST16_TYPE__) { sub __INT_LEAST16_TYPE__() { "short\\\ int" } }
unless (defined &__INT_LEAST32_MAX__) { sub __INT_LEAST32_MAX__() { 2147483647 } }
unless (defined &__INT_LEAST32_TYPE__) { sub __INT_LEAST32_TYPE__() { "int" } }
unless (defined &__INT_LEAST64_MAX__) { sub __INT_LEAST64_MAX__() { 9223372036854775807 } }
unless (defined &__INT_LEAST64_TYPE__) { sub __INT_LEAST64_TYPE__() { "long\\\ int" } }
unless (defined &__INT_LEAST8_MAX__) { sub __INT_LEAST8_MAX__() { 127 } }
unless (defined &__INT_LEAST8_TYPE__) { sub __INT_LEAST8_TYPE__() { "signed\\\ char" } }
unless (defined &__INT_MAX__) { sub __INT_MAX__() { 2147483647 } }
unless (defined &__LDBL_DENORM_MIN__) { sub __LDBL_DENORM_MIN__() { 3.64519953188247460253e-4951 } }
unless (defined &__LDBL_DIG__) { sub __LDBL_DIG__() { 18 } }
unless (defined &__LDBL_EPSILON__) { sub __LDBL_EPSILON__() { 1.08420217248550443401e-19 } }
unless (defined &__LDBL_HAS_DENORM__) { sub __LDBL_HAS_DENORM__() { 1 } }
unless (defined &__LDBL_HAS_INFINITY__) { sub __LDBL_HAS_INFINITY__() { 1 } }
unless (defined &__LDBL_HAS_QUIET_NAN__) { sub __LDBL_HAS_QUIET_NAN__() { 1 } }
unless (defined &__LDBL_MANT_DIG__) { sub __LDBL_MANT_DIG__() { 64 } }
unless (defined &__LDBL_MAX_10_EXP__) { sub __LDBL_MAX_10_EXP__() { 4932 } }
unless (defined &__LDBL_MAX_EXP__) { sub __LDBL_MAX_EXP__() { 16384 } }
unless (defined &__LDBL_MAX__) { sub __LDBL_MAX__() { 1.18973149535723176502e+4932 } }
unless (defined &__LDBL_MIN_10_EXP__) { sub __LDBL_MIN_10_EXP__() { -4931 } }
unless (defined &__LDBL_MIN_EXP__) { sub __LDBL_MIN_EXP__() { -16381 } }
unless (defined &__LDBL_MIN__) { sub __LDBL_MIN__() { 3.36210314311209350626e-4932 } }
unless (defined &__LONG_LONG_MAX__) { sub __LONG_LONG_MAX__() { 9223372036854775807 } }
unless (defined &__LONG_MAX__) { sub __LONG_MAX__() { 9223372036854775807 } }
unless (defined &__LP64__) { sub __LP64__() { 1 } }
unless (defined &__MMX__) { sub __MMX__() { 1 } }
unless (defined &__ORDER_BIG_ENDIAN__) { sub __ORDER_BIG_ENDIAN__() { 4321 } }
unless (defined &__ORDER_LITTLE_ENDIAN__) { sub __ORDER_LITTLE_ENDIAN__() { 1234 } }
unless (defined &__ORDER_PDP_ENDIAN__) { sub __ORDER_PDP_ENDIAN__() { 3412 } }
unless (defined &__PRAGMA_REDEFINE_EXTNAME) { sub __PRAGMA_REDEFINE_EXTNAME() { 1 } }
unless (defined &__PTRDIFF_MAX__) { sub __PTRDIFF_MAX__() { 9223372036854775807 } }
unless (defined &__PTRDIFF_TYPE__) { sub __PTRDIFF_TYPE__() { "long\\\ int" } }
unless (defined &__SCHAR_MAX__) { sub __SCHAR_MAX__() { 127 } }
unless (defined &__SHRT_MAX__) { sub __SHRT_MAX__() { 32767 } }
unless (defined &__SIG_ATOMIC_MAX__) { sub __SIG_ATOMIC_MAX__() { 2147483647 } }
unless (defined &__SIG_ATOMIC_MIN__) { sub __SIG_ATOMIC_MIN__() { "\-2147483647\\\ \-\\\ 1" } }
unless (defined &__SIG_ATOMIC_TYPE__) { sub __SIG_ATOMIC_TYPE__() { "int" } }
unless (defined &__SIZEOF_DOUBLE__) { sub __SIZEOF_DOUBLE__() { 8 } }
unless (defined &__SIZEOF_FLOAT__) { sub __SIZEOF_FLOAT__() { 4 } }
unless (defined &__SIZEOF_INT128__) { sub __SIZEOF_INT128__() { 16 } }
unless (defined &__SIZEOF_INT__) { sub __SIZEOF_INT__() { 4 } }
unless (defined &__SIZEOF_LONG_DOUBLE__) { sub __SIZEOF_LONG_DOUBLE__() { 16 } }
unless (defined &__SIZEOF_LONG_LONG__) { sub __SIZEOF_LONG_LONG__() { 8 } }
unless (defined &__SIZEOF_LONG__) { sub __SIZEOF_LONG__() { 8 } }
unless (defined &__SIZEOF_POINTER__) { sub __SIZEOF_POINTER__() { 8 } }
unless (defined &__SIZEOF_PTRDIFF_T__) { sub __SIZEOF_PTRDIFF_T__() { 8 } }
unless (defined &__SIZEOF_SHORT__) { sub __SIZEOF_SHORT__() { 2 } }
unless (defined &__SIZEOF_SIZE_T__) { sub __SIZEOF_SIZE_T__() { 8 } }
unless (defined &__SIZEOF_WCHAR_T__) { sub __SIZEOF_WCHAR_T__() { 4 } }
unless (defined &__SIZEOF_WINT_T__) { sub __SIZEOF_WINT_T__() { 4 } }
unless (defined &__SIZE_MAX__) { sub __SIZE_MAX__() { 18446744073709551615 } }
unless (defined &__SIZE_TYPE__) { sub __SIZE_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__SSE2_MATH__) { sub __SSE2_MATH__() { 1 } }
unless (defined &__SSE2__) { sub __SSE2__() { 1 } }
unless (defined &__SSE_MATH__) { sub __SSE_MATH__() { 1 } }
unless (defined &__SSE__) { sub __SSE__() { 1 } }
unless (defined &__SSP__) { sub __SSP__() { 1 } }
unless (defined &__STDC_HOSTED__) { sub __STDC_HOSTED__() { 1 } }
unless (defined &__STDC__) { sub __STDC__() { 1 } }
unless (defined &__UINT16_C) { sub __UINT16_C($) { my ($c) = @_; "${c}" } }
unless (defined &__UINT16_MAX__) { sub __UINT16_MAX__() { 65535 } }
unless (defined &__UINT16_TYPE__) { sub __UINT16_TYPE__() { "short\\\ unsigned\\\ int" } }
unless (defined &__UINT32_C) { sub __UINT32_C($) { my ($c) = @_; "${c}U" } }
unless (defined &__UINT32_MAX__) { sub __UINT32_MAX__() { 4294967295 } }
unless (defined &__UINT32_TYPE__) { sub __UINT32_TYPE__() { "unsigned\\\ int" } }
unless (defined &__UINT64_C) { sub __UINT64_C($) { my ($c) = @_; "${c}UL" } }
unless (defined &__UINT64_MAX__) { sub __UINT64_MAX__() { 18446744073709551615 } }
unless (defined &__UINT64_TYPE__) { sub __UINT64_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT8_C) { sub __UINT8_C($) { my ($c) = @_; "${c}" } }
unless (defined &__UINT8_MAX__) { sub __UINT8_MAX__() { 255 } }
unless (defined &__UINT8_TYPE__) { sub __UINT8_TYPE__() { "unsigned\\\ char" } }
unless (defined &__UINTMAX_C) { sub __UINTMAX_C($) { my ($c) = @_; "${c}UL" } }
unless (defined &__UINTMAX_MAX__) { sub __UINTMAX_MAX__() { 18446744073709551615 } }
unless (defined &__UINTMAX_TYPE__) { sub __UINTMAX_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINTPTR_MAX__) { sub __UINTPTR_MAX__() { 18446744073709551615 } }
unless (defined &__UINTPTR_TYPE__) { sub __UINTPTR_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT_FAST16_MAX__) { sub __UINT_FAST16_MAX__() { 18446744073709551615 } }
unless (defined &__UINT_FAST16_TYPE__) { sub __UINT_FAST16_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT_FAST32_MAX__) { sub __UINT_FAST32_MAX__() { 18446744073709551615 } }
unless (defined &__UINT_FAST32_TYPE__) { sub __UINT_FAST32_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT_FAST64_MAX__) { sub __UINT_FAST64_MAX__() { 18446744073709551615 } }
unless (defined &__UINT_FAST64_TYPE__) { sub __UINT_FAST64_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT_FAST8_MAX__) { sub __UINT_FAST8_MAX__() { 255 } }
unless (defined &__UINT_FAST8_TYPE__) { sub __UINT_FAST8_TYPE__() { "unsigned\\\ char" } }
unless (defined &__UINT_LEAST16_MAX__) { sub __UINT_LEAST16_MAX__() { 65535 } }
unless (defined &__UINT_LEAST16_TYPE__) { sub __UINT_LEAST16_TYPE__() { "short\\\ unsigned\\\ int" } }
unless (defined &__UINT_LEAST32_MAX__) { sub __UINT_LEAST32_MAX__() { 4294967295 } }
unless (defined &__UINT_LEAST32_TYPE__) { sub __UINT_LEAST32_TYPE__() { "unsigned\\\ int" } }
unless (defined &__UINT_LEAST64_MAX__) { sub __UINT_LEAST64_MAX__() { 18446744073709551615 } }
unless (defined &__UINT_LEAST64_TYPE__) { sub __UINT_LEAST64_TYPE__() { "long\\\ unsigned\\\ int" } }
unless (defined &__UINT_LEAST8_MAX__) { sub __UINT_LEAST8_MAX__() { 255 } }
unless (defined &__UINT_LEAST8_TYPE__) { sub __UINT_LEAST8_TYPE__() { "unsigned\\\ char" } }
unless (defined &__USE_BSD) { sub __USE_BSD() { 1 } }
unless (defined &__USE_FILE_OFFSET64) { sub __USE_FILE_OFFSET64() { 1 } }
unless (defined &__USE_LARGEFILE) { sub __USE_LARGEFILE() { 1 } }
unless (defined &__USE_MISC) { sub __USE_MISC() { 1 } }
unless (defined &__USE_POSIX) { sub __USE_POSIX() { 1 } }
unless (defined &__USE_POSIX199309) { sub __USE_POSIX199309() { 1 } }
unless (defined &__USE_POSIX199506) { sub __USE_POSIX199506() { 1 } }
unless (defined &__USE_POSIX2) { sub __USE_POSIX2() { 1 } }
unless (defined &__USE_SVID) { sub __USE_SVID() { 1 } }
unless (defined &__VERSION__) { sub __VERSION__() { "\"4\.7\.2\"" } }
unless (defined &__WCHAR_MAX__) { sub __WCHAR_MAX__() { 2147483647 } }
unless (defined &__WCHAR_MIN__) { sub __WCHAR_MIN__() { "\-2147483647\\\ \-\\\ 1" } }
unless (defined &__WCHAR_TYPE__) { sub __WCHAR_TYPE__() { "int" } }
unless (defined &__WINT_MAX__) { sub __WINT_MAX__() { 4294967295 } }
unless (defined &__WINT_MIN__) { sub __WINT_MIN__() { 0 } }
unless (defined &__WINT_TYPE__) { sub __WINT_TYPE__() { "unsigned\\\ int" } }
unless (defined &__amd64) { sub __amd64() { 1 } }
unless (defined &__amd64__) { sub __amd64__() { 1 } }
unless (defined &__gnu_linux__) { sub __gnu_linux__() { 1 } }
unless (defined &__k8) { sub __k8() { 1 } }
unless (defined &__k8__) { sub __k8__() { 1 } }
unless (defined &__linux) { sub __linux() { 1 } }
unless (defined &__linux__) { sub __linux__() { 1 } }
unless (defined &__unix) { sub __unix() { 1 } }
unless (defined &__unix__) { sub __unix__() { 1 } }
unless (defined &__x86_64) { sub __x86_64() { 1 } }
unless (defined &__x86_64__) { sub __x86_64__() { 1 } }
unless (defined &linux) { sub linux() { 1 } }
unless (defined &unix) { sub unix() { 1 } }
1;

1
lib/auto Symbolic link
View file

@ -0,0 +1 @@
../extern/lib/perl5/x86_64-linux/auto

1
lib/syscall.h Normal file
View file

@ -0,0 +1 @@
#include <sys/syscall.h>

6
lib/syscall.ph Normal file
View file

@ -0,0 +1,6 @@
require '_h2ph_pre.ph';
no warnings qw(redefine misc);
require 'sys/syscall.ph';
1;