Sys-Syslog-0.33/000755 000765 000120 00000000000 12147530001 014546 5ustar00maddingueadmin000000 000000 Sys-Syslog-0.33/Changes000644 000765 000765 00000042467 12147527130 016753 0ustar00maddinguemaddingue000000 000000 Revision history for Sys-Syslog 0.33 -- 2013.05.24 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#82531: Invalid usage of POSIX::_exit (Alexander Berger). [OPTIM] No longer inherit from Exporter. [OPTIM] Load Fcntl only when necessary. [DOC] Add links to other logging modules. [DOC] CPAN-RT#80398: Typo spotted by alfirth@gmail.com [DOC] Typo spotted by David Steinbrunner. [TEST] CPAN-RT#79683: Added delays in t/facilities-routing.t 0.32 -- 2012.09.14 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#69040: Don't modify @_ in syslog(). [BUGFIX] Restore compatibility with Perl 5.6.0. [DOC] Perl-RT#81858: Fix some spelling errors (Peter J. Acklam). 0.31 -- 2012.08.18 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Level 'emerg' could not be used since v0.29. [BUGFIX] Setting a message facility with syslog() was broken since v0.29 (Noel Butler). [BUGFIX] CPAN-RT#69992: Make setlogsock() only use the requested mechanism, restoring way it worked in v0.27 and before (Niko Tyni). [BUGFIX] CPAN-RT#69986: setlogsock() doesn't return undef on failure (Niko Tyni). [BUGFIX] CPAN-RT#69997: Use the default UDP socket timeout on GNU/kFreeBSD as well, and lower it to a more sensible value (Niko Tyni). [BUGFIX] CPAN-RT#75827: syslog() logging everything regardless of log mask when using using numeric LOG_* macros (Bryan Thale). [TESTS] Added t/facilities-routing.t [DOC] Don't highlight "the Rules of Sys::Syslog" from the Description. [DIST] Add meta-information in Makefile.PL 0.30 -- 2012.08.15 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#69310: Avoid a POSIX::strftime issue on Windows (Michael Ludwig). [BUGFIX] CPAN-RT#77577: Build on Haiku-OS (Tony Cook). [BUGFIX] CPAN-RT#77578: Silence a compilation warning (Tony Cook). [BUGFIX] CPAN-RT#78044: Don't call getservbyname() when the port is specified (Chan Wilson). [TESTS] t/syslog.t no longer needs to chdir under PERL_CORE. 0.29 -- 2011.04.18 -- Sebastien Aperghis-Tramoni (SAPER) #PerlQA2011 [BUGFIX] CPAN-RT#55215: Sys::Syslog might call exit which triggers DESTROY (Alexander Berger). [BUGFIX] CPAN-RT#55151: Allow temporary facility with native mechanism (Tim Jenkins). [BUGFIX] CPAN-RT#50928: Convert Win32 files to Unix EOLs (Steve Hay). [BUGFIX] CPAN-RT#50534: Unwanted space at the end of syslog message (Eugene V. Lyubimkin). [BUGFIX] CPAN-RT#49877: Options not reset after closelog() (Herbert Brezina). [BUGFIX] CPAN-RT#48386: Add Win32::EventLog as a prerequisite (kmx and Laurent Dami). [FEATURE] CPAN-RT#50534: Added options noeol and nonul. [DIST] Set INSTALLDIRS to "site" when installed on Perl 5.11+ 0.28 -- 2011.04.16 -- Sebastien Aperghis-Tramoni (SAPER) #PerlQA2011 [BUGFIX] CPAN-RT#56084: Reset connection tracking vars (Vladimir Marek). [BUGFIX] CPAN-RT#56826: Avoid memory corruption when closelog() is called twice (Andreas Jaekel). [BUGFIX] CPAN-RT#64287: Make strftime() Windows-compatible (Dave Stafford). [FEATURE] New API for setlogsock(), in order to allow the setting of new options. Thanks to Jake Scott for the idea. [CODE] Modify can_load() so it can print the warnings if desired. [CODE] CPAN-RT#44410: Provide fallback macros in Syslog.xs in order to compile on Novell Netware. [TESTS] In blead, the distribution was moved from ext/Sys/Syslog to ext/Sys-Syslog. t/constants.t had to be fixed (Vincent Pit). [TESTS] CPAN-RT#53317: In core, Sys-Syslog was moved to cpan/, thus making t/constants.t unable to find macros.all (David Mitchell). [TESTS] CPAN-RT#64716: Skip t/data-validation.t if the available version of POE::Component::Server::Syslog is too old. [DIST] Bleadperl no longer require an empty MAN3PODS (Nicholas Clark). [DIST] Removed unneeded modules in Makefile.PL (Nicholas Clark). [DOC] Recreated Sys::Syslog history from the unified git repository. [DOC] Added a section to list the matching Perl and Sys::Syslog version. [DOC] CPAN-RT#49859: Removed a dead link (Leon Brocard). 0.27 -- 2008.09.21 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Fixed compilation on Win32, thanks to Serguei Trouchelle. Also added stubs so calling the XS functions will never fail. [TESTS] t/pod.t now also uses Pod::Checker. 0.26 -- 2008.06.16 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Make Sys::Syslog works with Perl 5.10.0 (because of ExtUtils::Constant::ProxySubs). [CODE] setlogsock() is now a little more strict about its arguments. 0.25 -- 2008.05.17 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#34691: Fixed an incorrect call to sysopen() which prevented Sys::Syslog from working on some Solaris systems. Thanks to Paul Townsend. [BUGFIX] CPAN-RT#34753: Fixed a slowness introduced in v0.19 (which was to work around OSX syslog own slowness). Thanks to Alex Efros. [BUGFIX] CPAN-RT#35952: Fixed a bug with the "nofatal" option. [BUGFIX] CPAN-RT#35189: Fixed a bug in xlate(). [BUGFIX] Fixed build on Win32, thanks to Adam Kennedy. [FEATURE] setlogsock() now interprets the second argument as the hostname for network mechanisms. [DIST] Add AUTHOR to WriteMakefile() in order to fix the META.yml generated by ExtUtils::MakeMaker. [TESTS] Improved t/pod.t with Pod::Checker. 0.24 -- 2007.12.31 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPANT-RT#32001: Skip the setlogsock('stream') tests when /dev/log is unavailable (Brendan O'Dea). 0.23 -- 2007.11.12 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Fixed a too liberal test in the "pipe" mechanism, thanks to Jan Dubois. [DIST] fallback/syslog.h was missing from MANIFEST (thanks to CPAN Tester Matthew Musgrove). [TESTS] Better handling of Perl 5.005, thanks to CPAN Tester Slaven Rezic. 0.22 -- 2007.11.08 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#29875: Added workaround SpamAssassin overzealous logging features. [FEATURE] Added support for PERROR option. [FEATURE] Support for SYSLOG on z/OS, thanks to Chun Bing Ge. [CODE] Prevent $@ from being visible outside the module, in trying to address the problem reported in CPAN-RT#29875. [DOC] CPAN-RT#29451: Add Copyright notice. Thanks to Allison Randal for her advice. [DOC] New speaking about Win32 API instead of Win32 operating system. 0.21 -- 2007.09.14 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] setlogsock(eventlog) returned true even when it shouldn't have. [BUGFIX] CPAN-RT#24431: Added workaround for Mac OS X syslogd. [FEATURE] Added "pipe" mechanism in order to support HP-UX named pipe. Thanks to H.Merijn Brand and PROCURA. [CODE] Sys::Syslog works again on Perl 5.005, thanks to Nicholas Clark. 0.20 -- 2007.09.05 -- Sebastien Aperghis-Tramoni (SAPER) [DOC] Added README.win32 which was missing in MANIFEST. 0.19 -- 2007.09.05 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#20635: Fix tests to avoid problems related to the "stream" mechanism which occured on Debian and Cygwin. [BUGFIX] CPAN-RT#20780: Facility could not be temporarily changed. Also fixes the syslog() before openlog() bug. [BUGFIX] CPAN-RT#21333: Makefile.PL now creates a typemap for Perl 5.6.1 [BUGFIX] CPAN-RT#21516: disconnect_log() now correctly calls closelog_xs(). [BUGFIX] CPAN-RT#21866: Silence warnings in openlog(). [BUGFIX] CPAN-RT#25488: Silence warnings in disconnect_log(). via syslog(). [BUGFIX] Rewrote the constants generation code in order to provide fallback value for non-standard macros. [BUGFIX] Mark Blackman and Edmund von der Burg identified and fixed the random failures appearing on OSX, caused by a UDP timeout. [FEATURE] Added Win32 event log support thanks to Yves Orton. [FEATURE] Added new macros from modern BSD and IRIX. [FEATURE] Each non-standard macro now fall backs to a standard macro. [CODE] Merged changes from Jerry D. Hedden to use ppport.h only when not built from core distribution (blead@30657). [TESTS] t/syslog.t now generates a more detailed TAP output. [TESTS] Merged change blead@29176: suppress taint mode from t/constants.t [TESTS] Added regression tests for CPAN-RT#21866 and #25488. [EG] Added example script eg/syslog.pl [DOC] CPAN-RT#26097: man pages were not installed. [DOC] Added the Sys::Syslog Rules. 0.18 -- 2006.08.28 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Rewrote the way the default identifiant is constructed. [TESTS] CPAN-RT#20946: Removed the console mechanism from the main test loop because writing to the console hangs on several systems. [DOC] Added a note discouraging the use of setlogsock(). 0.17 -- 2006.07.23 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#20622, #20164: Fixed path handling in connect_unix(). [CODE] Renamed some variables ($that is not a valid name), and removed some dead code. [CODE] Actually added the macros from Mac OS X that were announced in the 0.14 version. [DOC] CPAN-RT#20545: Rewrote the documentation about setlogsock(). 0.16 -- 2006.06.20 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Perl-RT#20557: Save errno before trying to connect. [FEATURE] Perl-RT#35406: Applied the patch proposed by Keisuke Hirata for a more lax handling of "stream" or "unix" path. [FEATURE] Now try the "native" mechanism first. [TESTS] Silence warnings generated by t/syslog.t in Perl 5.8.8 and later. [DOC] Added documentation about the "native" mechanism. [DOC] Now indicates whether tickets are from CPAN or Perl RT. 0.15 -- 2006.06.10 -- Sebastien Aperghis-Tramoni (SAPER) [FEATURE] CPAN-RT#17316: Added a "nofatal" option to openlog(). [FEATURE] Sys::Syslog warnings can now be controlled by the warnings category of the same name. [FEATURE] Added support for using the native C syslog(3) functions. [CODE] Removed most "our" variables. [CODE] Improved readability by removing cargo-cult brackets and parentheses. 0.14 -- 2006.05.25 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#19259, #17518: Now allowing all levels and facilities. [CODE] Removed useless "&". [CODE] Improved readability by adding empty lines and reworking the code here and there. [CODE] Added new macros from Mac OS X. [TESTS] Added more tests in order to increase coverage. [DOC] CPAN-RT#19085: Corrected errors in the documentation for setlogmask(). [DOC] Added several links to online manual pages, RFCs and articles. [DOC] Corrected minor things in Changes. 0.13 -- 2006.01.11 -- Sebastien Aperghis-Tramoni (SAPER) [CODE] Applied Gisle Aas patch for a better handling of error messages, then optimized it. [CODE] Merged blead@26768: If getservbyname fails tell what service the lookup attempt tried to use. [CODE] Merged blead@26769: suppress Sys::Hostname usage and directly use INADDR_LOOPBACK. [CODE] Merged blead@26772: $host needs to stay in case the user sets it. [CODE] Merged blead@26773: check that $syslog_path is a socket. [TESTS] CPAN-RT#16980: Sys::Syslog blows up rather spectacularly on Solaris. Corrected by previous patches. [TESTS] CPAN-RT#16974: Failed test in t/podspell. This test is now skipped. 0.12 -- 2006.01.07 -- Sebastien Aperghis-Tramoni (SAPER) [DOC] Added a link to an article about Sys::Syslog. [TESTS] Merged some modifications from bleadperl. [TESTS] Removed optional dependency on Test::Exception. [TESTS] Improved t/constant.t [TESTS] Rewrote t/constants.t because future versions of ExtUtils::Constant will prevent the constant() function from being directly called. 0.11 -- 2005.12.28 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] setlogmask() now behaves like its C counterpart. [FEATURE] Can now export and use the macros. [FEATURE] Support for three Exporter tags. [FEATURE] XSLoader is now optional. [CODE] No longer "use"s Sys::Hostname as it was "require"d where needed. [CODE] CPAN-RT#16604: Use local timestamp. [DIST] Merged blead@26343: Fix realclean target. [DOC] Improved documentation. [TESTS] Added more tests to t/syslog.t in order to increase code coverage. 0.10 -- 2005.12.08 -- Sebastien Aperghis-Tramoni (SAPER) [DOC] Improved documentation. [TESTS] Added -T to t/syslog.t [TESTS] Added t/constants.t to check the macros. [TESTS] Added t/distchk.t, t/podspell.t, t/podcover.t, t/portfs.t 0.09 -- 2005.12.06 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Escape percent signs in error message when interpolating %m (Ronald J. Kimball). [CODE] Now setlogsock() really croak(), as documented. [DIST] CPANized from blead@26281. [DIST] Modified Makefile.PL so that ExtUtils::Constant is conditionally used, with a fallback in the case it's not available. [DIST] Bumped version to 0.09 [DOC] Added support and license information. [TESTS] Rewrote and ported t/syslog.t to Test::More 0.08 -- 2005.12.03 [FEATURES] syslog() can now accept a message without printf() escapes and arguments (Gisle Aas ). [DOC] Document that openlog() might die (Rafael Garcia-Suarez). 0.07 -- 2005.06.27 [CODE] Use XSLoader instead of DynaLoader (Alexey Tourbin). [DOC] Shows the correct way to use syslog() (Dave Mitchell). 0.06 -- 2004.12.14 [FEATURE] Allow escaping %m as %%m in Sys::Syslog format strings (Rafael Garcia-Suarez, suggested by Joshua Richardson and Yitzchak Scott-Thoennes). [CODE] Make Sys::Syslog stricture-compliant (Rafael Garcia-Suarez). [DOC] Document $Sys::Syslog::host (Jay Hannah). 0.05 -- 2004.04.06 [FEATURE] IRIX wants setlogsock("stream") (Jarkko Hietaniemi). [FEATURE] Allow syslog() to use numeric constants in addition to strings for facility names and priorities (Jim Schneider ). [DOC] Remind users to always use openlog() (Jarkko Hietaniemi). 0.04 -- 2003.08.13 [BUGFIX] Do not use "udp" on some platforms (Slaven Rezic). [BUGFIX] Perl-RT#18180: Fixed a problem with Sys:Syslog on Solaris 8 with perl 5.8.0 (Joost van Baal). [BUGFIX] Fixed some warnings (Jarkko Hietaniemi). [BUGFIX] Better error messages (Jari Aalto). 0.03 -- 2002.03.23 [BUGFIX] Fixed copious warnings from Sys::Syslog (Andreas König). [FEATURE] Failover to different communication modes by Nick Williams. 0.02 -- 2001.06.04 [BUGFIX] /dev/console may not be writable in Syslog.pm (Ask Bjoern Hansen). [BUGFIX] Fixed for accidental arguments to autoloaded constants (Gurusamy Sarathy). [BUGFIX] Make _PATH_LOG() return "" if not available (Gurusamy Sarathy). [BUGFIX] Forked child may not exit correctly if it failed to open /dev/console (Graham Barr). [BUGFIX] More checking in case someone has broken their services or protocol databases (Robert Spier). [BUGFIX] xlate() doesn't handle LOG_EMERG (Mark J. Reed). [CODE] Code for constant()s regenerated by Nicholas Clark. [TESTS] Added syslog.t to check if Sys::Syslog works (Tom Hughes). 0.01 -- 2000.02.04 -- Gurusamy Sarathy [FEATURE] Sys::Syslog now uses XSUBs to access facilities from syslog.h so it no longer requires syslog.ph to exist. Thanks to Tom Hughes. As a consequence, Sys::Syslog moved from lib/ to ext/. perl 5.004_03 -- 1997.09.05 -- Tim Bunce [BUGFIX] Handle missing _PATH_LOG (Ulrich Pfeifer). perl 5.004_02 -- 1997.08.07 -- Tim Bunce [FEATURE] UNIX domain sockets support, by Sean Robinson and Tim Bunce. perl 5.004_01 -- 1997.06.11 -- Tim Bunce [BUGFIX] Allows FQDN (even allowing "_"). perl 5.004 -- 1997.05.15 -- Chip Salzenberg [BUGFIX] Fixed $whoami calulation (Marc Rouleau). [BUGFIX] Allows hyphens in hostnames (Jerome Abela). perl 5.003_01 -- 1996.06.18 -- Charles Bailey [CODE] Moved call to hostname() into connect() function, and eliminated domain suffix. [DOC] Correct documentation for calling sequence of syslog() function. perl 5.002_01 -- 1996.03.25 -- Charles Bailey [CODE] Use Sys::Hostname::hostname() only when necessary. perl 5.002 -- 1996.02.29 -- Larry Wall [CODE] Use constants from Socket.pm (Andy Dougherty). [CODE] Connect to the name given by Sys::Hostname::hostname() instead of "localhost" (Andy Dougherty). [DOC] Added documentation, thanks to Hallvard B Furuseth. perl 5.000 -- 1994.10.17 -- Larry Wall [DIST] Converted from lib/syslog.pl to lib/Sys/Syslog.pm Sys-Syslog-0.33/eg/000755 000765 000120 00000000000 12147530001 015141 5ustar00maddingueadmin000000 000000 Sys-Syslog-0.33/fallback/000755 000765 000120 00000000000 12147530001 016305 5ustar00maddingueadmin000000 000000 Sys-Syslog-0.33/Makefile.PL000644 000765 000765 00000015057 12013522132 017412 0ustar00maddinguemaddingue000000 000000 use 5.005; use strict; use ExtUtils::MakeMaker; use File::Copy; use File::Spec; # create a typemap for Perl 5.6 if ($] < 5.008) { open(TYPEMAP, ">typemap") or die "fatal: can't write typemap: $!"; print TYPEMAP "const char *\t\tT_PV\n"; close(TYPEMAP); } # create a lib/ dir in order to avoid warnings in Test::Distribution mkdir "lib", 0755; # virtual paths given to EU::MM my %virtual_path = ( 'Syslog.pm' => '$(INST_LIBDIR)/Syslog.pm' ); # detect when to use Win32::EvenLog my (@extra_params, @extra_prereqs); if ($^O =~ /Win32/) { print " * Win32::EventLog detected.\n"; my $name = "PerlLog"; push @extra_prereqs, "Win32::EventLog" => 0, "Win32::TieRegistry" => 0, "Win32::EventLog" => 0; $virtual_path{'win32/Win32.pm' } = '$(INST_LIBDIR)/Syslog/Win32.pm'; $virtual_path{'win32/PerlLog.dll'} = '$(INST_ARCHAUTODIR)/PerlLog.dll'; push @extra_params, CCFLAGS => "-Ifallback"; # recreate the DLL from its uuencoded form if it's not here if (! -f File::Spec->catfile("win32", "$name.dll")) { # read the uuencoded data open(UU, '<' . File::Spec->catfile("win32", "$name\_dll.uu")) or die "fatal: Can't read file '$name\_dll.uu': $!"; my $uudata = do { local $/; }; close(UU); # write the DLL open(DLL, '>' . File::Spec->catfile("win32", "$name.dll")) or die "fatal: Can't write DLL '$name.dll': $!"; binmode(DLL); print DLL unpack "u", $uudata; close(DLL); } } # detect when being built in Perl core if (not grep { $_ eq 'PERL_CORE=1' } @ARGV) { push @extra_params, DEFINE => '-DUSE_PPPORT_H'; } # on pre-5.6 Perls, add warnings::compat to the prereq modules push @extra_prereqs, "warnings::compat" => "0.06" if $] < 5.006; # starting with Perl 5.11, "site" and "vendor" directories finally are # before "perl" (core) in @INC, thus allowing dual-life modules to be # updated without the need to overwrite the old version my $installdirs = $] < 5.011 ? "perl" : "site"; WriteMakefile( NAME => 'Sys::Syslog', LICENSE => 'perl', AUTHOR => 'Sebastien Aperghis-Tramoni ', VERSION_FROM => 'Syslog.pm', ABSTRACT_FROM => 'Syslog.pm', INSTALLDIRS => $installdirs, XSPROTOARG => '-noprototypes', PM => \%virtual_path, PREREQ_PM => { # run prereqs 'Carp' => 0, 'Fcntl' => 0, 'File::Basename' => 0, 'File::Spec' => 0, 'POSIX' => 0, 'Socket' => 0, 'XSLoader' => 0, @extra_prereqs, # build/test prereqs 'Test::More' => 0, }, META_MERGE => { resources => { repository => "https://github.com/maddingue/Sys-Syslog.git", }, }, PL_FILES => {}, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Sys-Syslog-*' }, realclean => { FILES => 'lib const-c.inc const-xs.inc macros.all ' .'PerlLog.h typemap *.bak *.bin *.rc win32/PerlLog_dll' }, @extra_params ); # find a default value for _PATH_LOG my $_PATH_LOG; if (-c "/dev/conslog" and -w _) { # SunOS 5.8 has a worldwritable /dev/conslog STREAMS log driver. # The /dev/log STREAMS log driver on this platform has permissions # and ownership `crw-r----- root sys'. /dev/conslog has more liberal # permissions. $_PATH_LOG = "/dev/conslog"; } elsif (-S "/var/run/syslog" and -w _) { # Mac OS X puts it at a different path. $_PATH_LOG = "/var/run/syslog"; } elsif (-p "/dev/log" and -w _) { # On HP-UX, /dev/log isn't a unix domain socket but a named pipe. $_PATH_LOG = "/dev/log"; } elsif ((-S "/dev/log" or -c _) and -w _) { # Most unixes have a unix domain socket /dev/log. $_PATH_LOG = "/dev/log"; } else { $_PATH_LOG = ""; } # if possible, generate the code that handles the constants with # ExtUtils::Constant, otherwise use cached copy in fallback/ if(eval {require ExtUtils::Constant; 1}) { my @levels = qw( LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR LOG_INFO LOG_NOTICE LOG_WARNING ); my @facilities = ( # standard facilities qw( LOG_AUTH LOG_AUTHPRIV LOG_CRON LOG_DAEMON LOG_FTP LOG_KERN LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NEWS LOG_SYSLOG LOG_USER LOG_UUCP ), # Mac OS X specific facilities { name => "LOG_INSTALL", type => "IV", default => [ "IV", "LOG_USER" ] }, { name => "LOG_LAUNCHD", type => "IV", default => [ "IV", "LOG_DAEMON"] }, { name => "LOG_NETINFO", type => "IV", default => [ "IV", "LOG_DAEMON"] }, { name => "LOG_RAS", type => "IV", default => [ "IV", "LOG_AUTH" ] }, { name => "LOG_REMOTEAUTH", type => "IV", default => [ "IV", "LOG_AUTH" ] }, # modern BSD specific facilities { name => "LOG_CONSOLE", type => "IV", default => [ "IV", "LOG_USER" ] }, { name => "LOG_NTP", type => "IV", default => [ "IV", "LOG_DAEMON"] }, { name => "LOG_SECURITY", type => "IV", default => [ "IV", "LOG_AUTH" ] }, # IRIX specific facilities { name => "LOG_AUDIT", type => "IV", default => [ "IV", "LOG_AUTH" ] }, { name => "LOG_LFMT", type => "IV", default => [ "IV", "LOG_USER" ] }, ); my @options = qw( LOG_CONS LOG_PID LOG_NDELAY LOG_NOWAIT LOG_ODELAY LOG_PERROR ); my @others_macros = ( qw(LOG_FACMASK), { name => "_PATH_LOG", type => "PV", default => [ "PV", qq("$_PATH_LOG") ] }, { name => "LOG_PRIMASK", type => "IV", default => [ "IV", 7] }, { name => "LOG_NFACILITIES", type => "IV", default => [ "IV", scalar @facilities] }, ); ExtUtils::Constant::WriteConstants( NAME => 'Sys::Syslog', NAMES => [ @levels, @facilities, @options, @others_macros ], ($] > 5.009002 ? (PROXYSUBS => 1) : ()), ); my @names = map { ref $_ ? $_->{name} : $_ } @levels, @facilities, @options; open(MACROS, '>macros.all') or warn "warning: Can't write 'macros.all': $!\n"; print MACROS join $/, @names; close(MACROS); } else { foreach my $file ('const-c.inc', 'const-xs.inc') { my $fallback = File::Spec->catfile('fallback', $file); copy($fallback, $file) or die "fatal: Can't copy $fallback to $file: $!"; } } Sys-Syslog-0.33/MANIFEST000644 000765 000120 00000001066 12147530001 015702 0ustar00maddingueadmin000000 000000 MANIFEST Makefile.PL Changes README README.win32 Syslog.pm Syslog.xs fallback/const-c.inc fallback/const-xs.inc fallback/syslog.h ppport.h eg/syslog.pl t/00-load.t t/constants.t t/data-validation.t t/distchk.t t/facilities-routing.t t/syslog.t t/pod.t t/podcover.t t/podspell.t t/portfs.t win32/compile.pl win32/PerlLog.mc win32/PerlLog.RES win32/PerlLog_RES.uu win32/PerlLog_dll.uu win32/Win32.pm META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Sys-Syslog-0.33/META.json000644 000765 000120 00000002320 12147530001 016164 0ustar00maddingueadmin000000 000000 { "abstract" : "Perl interface to the UNIX syslog(3) calls", "author" : [ "Sebastien Aperghis-Tramoni " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Sys-Syslog", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Carp" : "0", "Fcntl" : "0", "File::Basename" : "0", "File::Spec" : "0", "POSIX" : "0", "Socket" : "0", "Test::More" : "0", "XSLoader" : "0" } } }, "release_status" : "stable", "resources" : { "repository" : { "url" : "https://github.com/maddingue/Sys-Syslog.git" } }, "version" : "0.33" } Sys-Syslog-0.33/META.yml000644 000765 000120 00000001252 12147530001 016017 0ustar00maddingueadmin000000 000000 --- abstract: 'Perl interface to the UNIX syslog(3) calls' author: - 'Sebastien Aperghis-Tramoni ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Sys-Syslog no_index: directory: - t - inc requires: Carp: 0 Fcntl: 0 File::Basename: 0 File::Spec: 0 POSIX: 0 Socket: 0 Test::More: 0 XSLoader: 0 resources: repository: https://github.com/maddingue/Sys-Syslog.git version: 0.33 Sys-Syslog-0.33/ppport.h000644 000765 000765 00000361602 11344055004 017142 0ustar00maddinguemaddingue000000 000000 #if 0 <<'SKIP'; #endif /* ---------------------------------------------------------------------- ppport.h -- Perl/Pollution/Portability Version 3.08 Automatically created by Devel::PPPort running under perl 5.008005 on Thu Jun 8 00:58:19 2006. Do NOT edit this file directly! -- Edit PPPort_pm.PL and the includes in parts/inc/ instead. Use 'perldoc ppport.h' to view the documentation below. ---------------------------------------------------------------------- SKIP =pod =head1 NAME ppport.h - Perl/Pollution/Portability version 3.08 =head1 SYNOPSIS perl ppport.h [options] [source files] Searches current directory for files if no [source files] are given --help show short help --patch=file write one patch file with changes --copy=suffix write changed copies with suffix --diff=program use diff program and options --compat-version=version provide compatibility with Perl version --cplusplus accept C++ comments --quiet don't output anything except fatal errors --nodiag don't show diagnostics --nohints don't show hints --nochanges don't suggest changes --nofilter don't filter input files --strip strip all script and doc functionality from ppport.h (this, obviously, cannot be undone) --list-provided list provided API --list-unsupported list unsupported API --api-info=name show Perl API portability information =head1 COMPATIBILITY This version of F is designed to support operation with Perl installations back to 5.003, and has been tested up to 5.9.3. =head1 OPTIONS =head2 --help Display a brief usage summary. =head2 --patch=I If this option is given, a single patch file will be created if any changes are suggested. This requires a working diff program to be installed on your system. =head2 --copy=I If this option is given, a copy of each file will be saved with the given suffix that contains the suggested changes. This does not require any external programs. If neither C<--patch> or C<--copy> are given, the default is to simply print the diffs for each file. This requires either C or a C program to be installed. =head2 --diff=I Manually set the diff program and options to use. The default is to use C, when installed, and output unified context diffs. =head2 --compat-version=I Tell F to check for compatibility with the given Perl version. The default is to check for compatibility with Perl version 5.003. You can use this option to reduce the output of F if you intend to be backward compatible only down to a certain Perl version. =head2 --cplusplus Usually, F will detect C++ style comments and replace them with C style comments for portability reasons. Using this option instructs F to leave C++ comments untouched. =head2 --quiet Be quiet. Don't print anything except fatal errors. =head2 --nodiag Don't output any diagnostic messages. Only portability alerts will be printed. =head2 --nohints Don't output any hints. Hints often contain useful portability notes. =head2 --nochanges Don't suggest any changes. Only give diagnostic output and hints unless these are also deactivated. =head2 --nofilter Don't filter the list of input files. By default, files not looking like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. =head2 --strip Strip all script and documentation functionality from F. This reduces the size of F dramatically and may be useful if you want to include F in smaller modules without increasing their distribution size too much. =head2 --list-provided Lists the API elements for which compatibility is provided by F. Also lists if it must be explicitly requested, if it has dependencies, and if there are hints for it. =head2 --list-unsupported Lists the API elements that are known not to be supported by F and below which version of Perl they probably won't be available or work. =head2 --api-info=I Show portability information for API elements matching I. If I is surrounded by slashes, it is interpreted as a regular expression. =head1 DESCRIPTION In order for a Perl extension (XS) module to be as portable as possible across differing versions of Perl itself, certain steps need to be taken. =over 4 =item * Including this header is the first major one. This alone will give you access to a large part of the Perl API that hasn't been available in earlier Perl releases. Use perl ppport.h --list-provided to see which API elements are provided by ppport.h. =item * You should avoid using deprecated parts of the API. For example, using global Perl variables without the C prefix is deprecated. Also, some API functions used to have a C prefix. Using this form is also deprecated. You can safely use the supported API, as F will provide wrappers for older Perl versions. =item * If you use one of a few functions or variables that were not present in earlier versions of Perl, and that can't be provided using a macro, you have to explicitly request support for these functions by adding one or more C<#define>s in your source code before the inclusion of F. These functions or variables will be marked C in the list shown by C<--list-provided>. Depending on whether you module has a single or multiple files that use such functions or variables, you want either C or global variants. For a C function or variable (used only in a single source file), use: #define NEED_function #define NEED_variable For a global function or variable (used in multiple source files), use: #define NEED_function_GLOBAL #define NEED_variable_GLOBAL Note that you mustn't have more than one global request for the same function or variable in your project. Function / Variable Static Request Global Request ----------------------------------------------------------------------------------------- PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL grok_number() NEED_grok_number NEED_grok_number_GLOBAL grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL sv_2pv_nolen() NEED_sv_2pv_nolen NEED_sv_2pv_nolen_GLOBAL sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL To avoid namespace conflicts, you can change the namespace of the explicitly exported functions / variables using the C macro. Just C<#define> the macro before including C: #define DPPP_NAMESPACE MyOwnNamespace_ #include "ppport.h" The default namespace is C. =back The good thing is that most of the above can be checked by running F on your source code. See the next section for details. =head1 EXAMPLES To verify whether F is needed for your module, whether you should make any changes to your code, and whether any special defines should be used, F can be run as a Perl script to check your source code. Simply say: perl ppport.h The result will usually be a list of patches suggesting changes that should at least be acceptable, if not necessarily the most efficient solution, or a fix for all possible problems. If you know that your XS module uses features only available in newer Perl releases, if you're aware that it uses C++ comments, and if you want all suggestions as a single patch file, you could use something like this: perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff If you only want your code to be scanned without any suggestions for changes, use: perl ppport.h --nochanges You can specify a different C program or options, using the C<--diff> option: perl ppport.h --diff='diff -C 10' This would output context diffs with 10 lines of context. To display portability information for the C function, use: perl ppport.h --api-info=newSVpvn Since the argument to C<--api-info> can be a regular expression, you can use perl ppport.h --api-info=/_nomg$/ to display portability information for all C<_nomg> functions or perl ppport.h --api-info=/./ to display information for all known API elements. =head1 BUGS If this version of F is causing failure during the compilation of this module, please check if newer versions of either this module or C are available on CPAN before sending a bug report. If F was generated using the latest version of C and is causing failure of this module, please file a bug report using the CPAN Request Tracker at L. Please include the following information: =over 4 =item 1. The complete output from running "perl -V" =item 2. This file. =item 3. The name and version of the module you were trying to build. =item 4. A full log of the build that failed. =item 5. Any other information that you think could be relevant. =back For the latest version of this code, please get the C module from CPAN. =head1 COPYRIGHT Version 3.x, Copyright (c) 2004-2006, Marcus Holland-Moritz. Version 2.x, Copyright (C) 2001, Paul Marquess. Version 1.x, Copyright (C) 1999, Kenneth Albanowski. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO See L. =cut use strict; my %opt = ( quiet => 0, diag => 1, hints => 1, changes => 1, cplusplus => 0, filter => 1, strip => 0, ); my($ppport) = $0 =~ /([\w.]+)$/; my $LF = '(?:\r\n|[\r\n])'; # line feed my $HS = "[ \t]"; # horizontal whitespace eval { require Getopt::Long; Getopt::Long::GetOptions(\%opt, qw( help quiet diag! filter! hints! changes! cplusplus strip patch=s copy=s diff=s compat-version=s list-provided list-unsupported api-info=s )) or usage(); }; if ($@ and grep /^-/, @ARGV) { usage() if "@ARGV" =~ /^--?h(?:elp)?$/; die "Getopt::Long not found. Please don't use any options.\n"; } usage() if $opt{help}; strip() if $opt{strip}; if (exists $opt{'compat-version'}) { my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; if ($@) { die "Invalid version number format: '$opt{'compat-version'}'\n"; } die "Only Perl 5 is supported\n" if $r != 5; die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; } else { $opt{'compat-version'} = 5; } # Never use C comments in this file!!!!! my $ccs = '/'.'*'; my $cce = '*'.'/'; my $rccs = quotemeta $ccs; my $rcce = quotemeta $cce; my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ ? ( $1 => { ($2 ? ( base => $2 ) : ()), ($3 ? ( todo => $3 ) : ()), (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), } ) : die "invalid spec: $_" } qw( AvFILLp|5.004050||p AvFILL||| CLASS|||n CX_CURPAD_SAVE||| CX_CURPAD_SV||| CopFILEAV|5.006000||p CopFILEGV_set|5.006000||p CopFILEGV|5.006000||p CopFILESV|5.006000||p CopFILE_set|5.006000||p CopFILE|5.006000||p CopSTASHPV_set|5.006000||p CopSTASHPV|5.006000||p CopSTASH_eq|5.006000||p CopSTASH_set|5.006000||p CopSTASH|5.006000||p CopyD|5.009002||p Copy||| CvPADLIST||| CvSTASH||| CvWEAKOUTSIDE||| DEFSV|5.004050||p END_EXTERN_C|5.005000||p ENTER||| ERRSV|5.004050||p EXTEND||| EXTERN_C|5.005000||p F0convert|||n FREETMPS||| GIMME_V||5.004000|n GIMME|||n GROK_NUMERIC_RADIX|5.007002||p G_ARRAY||| G_DISCARD||| G_EVAL||| G_NOARGS||| G_SCALAR||| G_VOID||5.004000| GetVars||| GvSV||| Gv_AMupdate||| HEf_SVKEY||5.004000| HeHASH||5.004000| HeKEY||5.004000| HeKLEN||5.004000| HePV||5.004000| HeSVKEY_force||5.004000| HeSVKEY_set||5.004000| HeSVKEY||5.004000| HeVAL||5.004000| HvNAME||| INT2PTR|5.006000||p IN_LOCALE_COMPILETIME|5.007002||p IN_LOCALE_RUNTIME|5.007002||p IN_LOCALE|5.007002||p IN_PERL_COMPILETIME|5.008001||p IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p IS_NUMBER_INFINITY|5.007002||p IS_NUMBER_IN_UV|5.007002||p IS_NUMBER_NAN|5.007003||p IS_NUMBER_NEG|5.007002||p IS_NUMBER_NOT_INT|5.007002||p IVSIZE|5.006000||p IVTYPE|5.006000||p IVdf|5.006000||p LEAVE||| LVRET||| MARK||| MULTICALL||5.009003| MY_CXT_CLONE|5.009002||p MY_CXT_INIT|5.007003||p MY_CXT|5.007003||p MoveD|5.009002||p Move||| NEWSV||| NOOP|5.005000||p NUM2PTR|5.006000||p NVTYPE|5.006000||p NVef|5.006001||p NVff|5.006001||p NVgf|5.006001||p Newxc|5.009003||p Newxz|5.009003||p Newx|5.009003||p Nullav||| Nullch||| Nullcv||| Nullhv||| Nullsv||| ORIGMARK||| PAD_BASE_SV||| PAD_CLONE_VARS||| PAD_COMPNAME_FLAGS||| PAD_COMPNAME_GEN_set||| PAD_COMPNAME_GEN||| PAD_COMPNAME_OURSTASH||| PAD_COMPNAME_PV||| PAD_COMPNAME_TYPE||| PAD_RESTORE_LOCAL||| PAD_SAVE_LOCAL||| PAD_SAVE_SETNULLPAD||| PAD_SETSV||| PAD_SET_CUR_NOSAVE||| PAD_SET_CUR||| PAD_SVl||| PAD_SV||| PERL_BCDVERSION|5.009003||p PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p PERL_INT_MAX|5.004000||p PERL_INT_MIN|5.004000||p PERL_LONG_MAX|5.004000||p PERL_LONG_MIN|5.004000||p PERL_MAGIC_arylen|5.007002||p PERL_MAGIC_backref|5.007002||p PERL_MAGIC_bm|5.007002||p PERL_MAGIC_collxfrm|5.007002||p PERL_MAGIC_dbfile|5.007002||p PERL_MAGIC_dbline|5.007002||p PERL_MAGIC_defelem|5.007002||p PERL_MAGIC_envelem|5.007002||p PERL_MAGIC_env|5.007002||p PERL_MAGIC_ext|5.007002||p PERL_MAGIC_fm|5.007002||p PERL_MAGIC_glob|5.007002||p PERL_MAGIC_isaelem|5.007002||p PERL_MAGIC_isa|5.007002||p PERL_MAGIC_mutex|5.007002||p PERL_MAGIC_nkeys|5.007002||p PERL_MAGIC_overload_elem|5.007002||p PERL_MAGIC_overload_table|5.007002||p PERL_MAGIC_overload|5.007002||p PERL_MAGIC_pos|5.007002||p PERL_MAGIC_qr|5.007002||p PERL_MAGIC_regdata|5.007002||p PERL_MAGIC_regdatum|5.007002||p PERL_MAGIC_regex_global|5.007002||p PERL_MAGIC_shared_scalar|5.007003||p PERL_MAGIC_shared|5.007003||p PERL_MAGIC_sigelem|5.007002||p PERL_MAGIC_sig|5.007002||p PERL_MAGIC_substr|5.007002||p PERL_MAGIC_sv|5.007002||p PERL_MAGIC_taint|5.007002||p PERL_MAGIC_tiedelem|5.007002||p PERL_MAGIC_tiedscalar|5.007002||p PERL_MAGIC_tied|5.007002||p PERL_MAGIC_utf8|5.008001||p PERL_MAGIC_uvar_elem|5.007003||p PERL_MAGIC_uvar|5.007002||p PERL_MAGIC_vec|5.007002||p PERL_MAGIC_vstring|5.008001||p PERL_QUAD_MAX|5.004000||p PERL_QUAD_MIN|5.004000||p PERL_REVISION|5.006000||p PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p PERL_SCAN_DISALLOW_PREFIX|5.007003||p PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p PERL_SCAN_SILENT_ILLDIGIT|5.008001||p PERL_SHORT_MAX|5.004000||p PERL_SHORT_MIN|5.004000||p PERL_SIGNALS_UNSAFE_FLAG|5.008001||p PERL_SUBVERSION|5.006000||p PERL_UCHAR_MAX|5.004000||p PERL_UCHAR_MIN|5.004000||p PERL_UINT_MAX|5.004000||p PERL_UINT_MIN|5.004000||p PERL_ULONG_MAX|5.004000||p PERL_ULONG_MIN|5.004000||p PERL_UNUSED_DECL|5.007002||p PERL_UQUAD_MAX|5.004000||p PERL_UQUAD_MIN|5.004000||p PERL_USHORT_MAX|5.004000||p PERL_USHORT_MIN|5.004000||p PERL_VERSION|5.006000||p PL_DBsingle|||pn PL_DBsub|||pn PL_DBtrace|||n PL_Sv|5.005000||p PL_compiling|5.004050||p PL_copline|5.005000||p PL_curcop|5.004050||p PL_curstash|5.004050||p PL_debstash|5.004050||p PL_defgv|5.004050||p PL_diehook|5.004050||p PL_dirty|5.004050||p PL_dowarn|||pn PL_errgv|5.004050||p PL_hexdigit|5.005000||p PL_hints|5.005000||p PL_last_in_gv|||n PL_modglobal||5.005000|n PL_na|5.004050||pn PL_no_modify|5.006000||p PL_ofs_sv|||n PL_perl_destruct_level|5.004050||p PL_perldb|5.004050||p PL_ppaddr|5.006000||p PL_rsfp_filters|5.004050||p PL_rsfp|5.004050||p PL_rs|||n PL_signals|5.008001||p PL_stack_base|5.004050||p PL_stack_sp|5.004050||p PL_stdingv|5.004050||p PL_sv_arenaroot|5.004050||p PL_sv_no|5.004050||pn PL_sv_undef|5.004050||pn PL_sv_yes|5.004050||pn PL_tainted|5.004050||p PL_tainting|5.004050||p POP_MULTICALL||5.009003| POPi|||n POPl|||n POPn|||n POPpbytex||5.007001|n POPpx||5.005030|n POPp|||n POPs|||n PTR2IV|5.006000||p PTR2NV|5.006000||p PTR2UV|5.006000||p PTR2ul|5.007001||p PTRV|5.006000||p PUSHMARK||| PUSH_MULTICALL||5.009003| PUSHi||| PUSHmortal|5.009002||p PUSHn||| PUSHp||| PUSHs||| PUSHu|5.004000||p PUTBACK||| PerlIO_clearerr||5.007003| PerlIO_close||5.007003| PerlIO_eof||5.007003| PerlIO_error||5.007003| PerlIO_fileno||5.007003| PerlIO_fill||5.007003| PerlIO_flush||5.007003| PerlIO_get_base||5.007003| PerlIO_get_bufsiz||5.007003| PerlIO_get_cnt||5.007003| PerlIO_get_ptr||5.007003| PerlIO_read||5.007003| PerlIO_seek||5.007003| PerlIO_set_cnt||5.007003| PerlIO_set_ptrcnt||5.007003| PerlIO_setlinebuf||5.007003| PerlIO_stderr||5.007003| PerlIO_stdin||5.007003| PerlIO_stdout||5.007003| PerlIO_tell||5.007003| PerlIO_unread||5.007003| PerlIO_write||5.007003| Poison|5.008000||p RETVAL|||n Renewc||| Renew||| SAVECLEARSV||| SAVECOMPPAD||| SAVEPADSV||| SAVETMPS||| SAVE_DEFSV|5.004050||p SPAGAIN||| SP||| START_EXTERN_C|5.005000||p START_MY_CXT|5.007003||p STMT_END|||p STMT_START|||p ST||| SVt_IV||| SVt_NV||| SVt_PVAV||| SVt_PVCV||| SVt_PVHV||| SVt_PVMG||| SVt_PV||| Safefree||| Slab_Alloc||| Slab_Free||| StructCopy||| SvCUR_set||| SvCUR||| SvEND||| SvGETMAGIC|5.004050||p SvGROW||| SvIOK_UV||5.006000| SvIOK_notUV||5.006000| SvIOK_off||| SvIOK_only_UV||5.006000| SvIOK_only||| SvIOK_on||| SvIOKp||| SvIOK||| SvIVX||| SvIV_nomg|5.009001||p SvIV_set||| SvIVx||| SvIV||| SvIsCOW_shared_hash||5.008003| SvIsCOW||5.008003| SvLEN_set||| SvLEN||| SvLOCK||5.007003| SvMAGIC_set|5.009003||p SvNIOK_off||| SvNIOKp||| SvNIOK||| SvNOK_off||| SvNOK_only||| SvNOK_on||| SvNOKp||| SvNOK||| SvNVX||| SvNV_set||| SvNVx||| SvNV||| SvOK||| SvOOK||| SvPOK_off||| SvPOK_only_UTF8||5.006000| SvPOK_only||| SvPOK_on||| SvPOKp||| SvPOK||| SvPVX_const|5.009003||p SvPVX_mutable|5.009003||p SvPVX||| SvPV_force_nomg|5.007002||p SvPV_force||| SvPV_nolen|5.006000||p SvPV_nomg|5.007002||p SvPV_set||| SvPVbyte_force||5.009002| SvPVbyte_nolen||5.006000| SvPVbytex_force||5.006000| SvPVbytex||5.006000| SvPVbyte|5.006000||p SvPVutf8_force||5.006000| SvPVutf8_nolen||5.006000| SvPVutf8x_force||5.006000| SvPVutf8x||5.006000| SvPVutf8||5.006000| SvPVx||| SvPV||| SvREFCNT_dec||| SvREFCNT_inc||| SvREFCNT||| SvROK_off||| SvROK_on||| SvROK||| SvRV_set|5.009003||p SvRV||| SvSETMAGIC||| SvSHARE||5.007003| SvSTASH_set|5.009003|5.009003|p SvSTASH||| SvSetMagicSV_nosteal||5.004000| SvSetMagicSV||5.004000| SvSetSV_nosteal||5.004000| SvSetSV||| SvTAINTED_off||5.004000| SvTAINTED_on||5.004000| SvTAINTED||5.004000| SvTAINT||| SvTRUE||| SvTYPE||| SvUNLOCK||5.007003| SvUOK||5.007001| SvUPGRADE||| SvUTF8_off||5.006000| SvUTF8_on||5.006000| SvUTF8||5.006000| SvUVXx|5.004000||p SvUVX|5.004000||p SvUV_nomg|5.009001||p SvUV_set|5.009003||p SvUVx|5.004000||p SvUV|5.004000||p SvVOK||5.008001| THIS|||n UNDERBAR|5.009002||p UVSIZE|5.006000||p UVTYPE|5.006000||p UVXf|5.007001||p UVof|5.006000||p UVuf|5.006000||p UVxf|5.006000||p XCPT_CATCH|5.009002||p XCPT_RETHROW|5.009002||p XCPT_TRY_END|5.009002||p XCPT_TRY_START|5.009002||p XPUSHi||| XPUSHmortal|5.009002||p XPUSHn||| XPUSHp||| XPUSHs||| XPUSHu|5.004000||p XSRETURN_EMPTY||| XSRETURN_IV||| XSRETURN_NO||| XSRETURN_NV||| XSRETURN_PV||| XSRETURN_UNDEF||| XSRETURN_UV|5.008001||p XSRETURN_YES||| XSRETURN|||p XST_mIV||| XST_mNO||| XST_mNV||| XST_mPV||| XST_mUNDEF||| XST_mUV|5.008001||p XST_mYES||| XS_VERSION_BOOTCHECK||| XS_VERSION||| XSprePUSH|5.006000||p XS||| ZeroD|5.009002||p Zero||| _aMY_CXT|5.007003||p _pMY_CXT|5.007003||p aMY_CXT_|5.007003||p aMY_CXT|5.007003||p aTHX_|5.006000||p aTHX|5.006000||p add_data||| allocmy||| amagic_call||| amagic_cmp_locale||| amagic_cmp||| amagic_i_ncmp||| amagic_ncmp||| any_dup||| ao||| append_elem||| append_list||| apply_attrs_my||| apply_attrs_string||5.006001| apply_attrs||| apply||| atfork_lock||5.007003|n atfork_unlock||5.007003|n av_arylen_p||5.009003| av_clear||| av_delete||5.006000| av_exists||5.006000| av_extend||| av_fake||| av_fetch||| av_fill||| av_len||| av_make||| av_pop||| av_push||| av_reify||| av_shift||| av_store||| av_undef||| av_unshift||| ax|||n bad_type||| bind_match||| block_end||| block_gimme||5.004000| block_start||| boolSV|5.004000||p boot_core_PerlIO||| boot_core_UNIVERSAL||| boot_core_xsutils||| bytes_from_utf8||5.007001| bytes_to_utf8||5.006001| cache_re||| call_argv|5.006000||p call_atexit||5.006000| call_body||| call_list_body||| call_list||5.004000| call_method|5.006000||p call_pv|5.006000||p call_sv|5.006000||p calloc||5.007002|n cando||| cast_i32||5.006000| cast_iv||5.006000| cast_ulong||5.006000| cast_uv||5.006000| check_type_and_open||| check_uni||| checkcomma||| checkposixcc||| ck_anoncode||| ck_bitop||| ck_concat||| ck_defined||| ck_delete||| ck_die||| ck_eof||| ck_eval||| ck_exec||| ck_exists||| ck_exit||| ck_ftst||| ck_fun||| ck_glob||| ck_grep||| ck_index||| ck_join||| ck_lengthconst||| ck_lfun||| ck_listiob||| ck_match||| ck_method||| ck_null||| ck_open||| ck_repeat||| ck_require||| ck_retarget||| ck_return||| ck_rfun||| ck_rvconst||| ck_sassign||| ck_say||| ck_select||| ck_shift||| ck_sort||| ck_spair||| ck_split||| ck_subr||| ck_substr||| ck_svconst||| ck_trunc||| ck_unpack||| ckwarn_d||5.009003| ckwarn||5.009003| cl_and||| cl_anything||| cl_init_zero||| cl_init||| cl_is_anything||| cl_or||| closest_cop||| convert||| cop_free||| cr_textfilter||| croak_nocontext|||vn croak|||v csighandler||5.009003|n custom_op_desc||5.007003| custom_op_name||5.007003| cv_ckproto||| cv_clone||| cv_const_sv||5.004000| cv_dump||| cv_undef||| cx_dump||5.005000| cx_dup||| cxinc||| dAXMARK|5.009003||p dAX|5.007002||p dITEMS|5.007002||p dMARK||| dMULTICALL||5.009003| dMY_CXT_SV|5.007003||p dMY_CXT|5.007003||p dNOOP|5.006000||p dORIGMARK||| dSP||| dTHR|5.004050||p dTHXa|5.006000||p dTHXoa|5.006000||p dTHX|5.006000||p dUNDERBAR|5.009002||p dXCPT|5.009002||p dXSARGS||| dXSI32||| dXSTARG|5.006000||p deb_curcv||| deb_nocontext|||vn deb_stack_all||| deb_stack_n||| debop||5.005000| debprofdump||5.005000| debprof||| debstackptrs||5.007003| debstack||5.007003| deb||5.007003|v del_sv||| delimcpy||5.004000| deprecate_old||| deprecate||| despatch_signals||5.007001| destroy_matcher||| die_nocontext|||vn die_where||| die|||v dirp_dup||| div128||| djSP||| do_aexec5||| do_aexec||| do_aspawn||| do_binmode||5.004050| do_chomp||| do_chop||| do_close||| do_dump_pad||| do_eof||| do_exec3||| do_execfree||| do_exec||| do_gv_dump||5.006000| do_gvgv_dump||5.006000| do_hv_dump||5.006000| do_ipcctl||| do_ipcget||| do_join||| do_kv||| do_magic_dump||5.006000| do_msgrcv||| do_msgsnd||| do_oddball||| do_op_dump||5.006000| do_open9||5.006000| do_openn||5.007001| do_open||5.004000| do_pipe||| do_pmop_dump||5.006000| do_print||| do_readline||| do_seek||| do_semop||| do_shmio||| do_smartmatch||| do_spawn_nowait||| do_spawn||| do_sprintf||| do_sv_dump||5.006000| do_sysseek||| do_tell||| do_trans_complex_utf8||| do_trans_complex||| do_trans_count_utf8||| do_trans_count||| do_trans_simple_utf8||| do_trans_simple||| do_trans||| do_vecget||| do_vecset||| do_vop||| docatch_body||| docatch||| doeval||| dofile||| dofindlabel||| doform||| doing_taint||5.008001|n dooneliner||| doopen_pm||| doparseform||| dopoptoeval||| dopoptogiven||| dopoptolabel||| dopoptoloop||| dopoptosub_at||| dopoptosub||| dopoptowhen||| doref||5.009003| dounwind||| dowantarray||| dump_all||5.006000| dump_eval||5.006000| dump_fds||| dump_form||5.006000| dump_indent||5.006000|v dump_mstats||| dump_packsubs||5.006000| dump_sub||5.006000| dump_sv_child||| dump_vindent||5.006000| dumpuntil||| dup_attrlist||| emulate_eaccess||| eval_pv|5.006000||p eval_sv|5.006000||p expect_number||| fbm_compile||5.005000| fbm_instr||5.005000| fd_on_nosuid_fs||| feature_is_enabled||| filter_add||| filter_del||| filter_gets||| filter_read||| find_beginning||| find_byclass||| find_in_my_stash||| find_runcv||| find_rundefsvoffset||5.009002| find_script||| find_uninit_var||| first_symbol|||n fold_constants||| forbid_setid||| force_ident||| force_list||| force_next||| force_version||| force_word||| form_nocontext|||vn form||5.004000|v fp_dup||| fprintf_nocontext|||vn free_global_struct||| free_tied_hv_pool||| free_tmps||| gen_constant_list||| get_av|5.006000||p get_context||5.006000|n get_cv|5.006000||p get_db_sub||| get_debug_opts||| get_hash_seed||| get_hv|5.006000||p get_mstats||| get_no_modify||| get_num||| get_op_descs||5.005000| get_op_names||5.005000| get_opargs||| get_ppaddr||5.006000| get_sv|5.006000||p get_vtbl||5.005030| getcwd_sv||5.007002| getenv_len||| gp_dup||| gp_free||| gp_ref||| grok_bin|5.007003||p grok_hex|5.007003||p grok_number|5.007002||p grok_numeric_radix|5.007002||p grok_oct|5.007003||p group_end||| gv_AVadd||| gv_HVadd||| gv_IOadd||| gv_SVadd||| gv_autoload4||5.004000| gv_check||| gv_const_sv||5.009003| gv_dump||5.006000| gv_efullname3||5.004000| gv_efullname4||5.006001| gv_efullname||| gv_ename||| gv_fetchfile||| gv_fetchmeth_autoload||5.007003| gv_fetchmethod_autoload||5.004000| gv_fetchmethod||| gv_fetchmeth||| gv_fetchpvn_flags||5.009002| gv_fetchpv||| gv_fetchsv||5.009002| gv_fullname3||5.004000| gv_fullname4||5.006001| gv_fullname||| gv_handler||5.007001| gv_init_sv||| gv_init||| gv_stashpvn|5.006000||p gv_stashpv||| gv_stashsv||| he_dup||| hek_dup||| hfreeentries||| hsplit||| hv_assert||5.009001| hv_auxinit||| hv_backreferences_p||| hv_clear_placeholders||5.009001| hv_clear||| hv_delayfree_ent||5.004000| hv_delete_common||| hv_delete_ent||5.004000| hv_delete||| hv_eiter_p||5.009003| hv_eiter_set||5.009003| hv_exists_ent||5.004000| hv_exists||| hv_fetch_common||| hv_fetch_ent||5.004000| hv_fetch||| hv_free_ent||5.004000| hv_iterinit||| hv_iterkeysv||5.004000| hv_iterkey||| hv_iternext_flags||5.008000| hv_iternextsv||| hv_iternext||| hv_iterval||| hv_kill_backrefs||| hv_ksplit||5.004000| hv_magic_check||| hv_magic||| hv_name_set||5.009003| hv_notallowed||| hv_placeholders_get||5.009003| hv_placeholders_p||5.009003| hv_placeholders_set||5.009003| hv_riter_p||5.009003| hv_riter_set||5.009003| hv_scalar||5.009001| hv_store_ent||5.004000| hv_store_flags||5.008000| hv_store||| hv_undef||| ibcmp_locale||5.004000| ibcmp_utf8||5.007003| ibcmp||| incl_perldb||| incline||| incpush_if_exists||| incpush||| ingroup||| init_argv_symbols||| init_debugger||| init_global_struct||| init_i18nl10n||5.006000| init_i18nl14n||5.006000| init_ids||| init_interp||| init_lexer||| init_main_stash||| init_perllib||| init_postdump_symbols||| init_predump_symbols||| init_stacks||5.005000| init_tm||5.007002| instr||| intro_my||| intuit_method||| intuit_more||| invert||| io_close||| isALNUM||| isALPHA||| isDIGIT||| isLOWER||| isSPACE||| isUPPER||| is_an_int||| is_gv_magical_sv||| is_gv_magical||| is_handle_constructor||| is_list_assignment||| is_lvalue_sub||5.007001| is_uni_alnum_lc||5.006000| is_uni_alnumc_lc||5.006000| is_uni_alnumc||5.006000| is_uni_alnum||5.006000| is_uni_alpha_lc||5.006000| is_uni_alpha||5.006000| is_uni_ascii_lc||5.006000| is_uni_ascii||5.006000| is_uni_cntrl_lc||5.006000| is_uni_cntrl||5.006000| is_uni_digit_lc||5.006000| is_uni_digit||5.006000| is_uni_graph_lc||5.006000| is_uni_graph||5.006000| is_uni_idfirst_lc||5.006000| is_uni_idfirst||5.006000| is_uni_lower_lc||5.006000| is_uni_lower||5.006000| is_uni_print_lc||5.006000| is_uni_print||5.006000| is_uni_punct_lc||5.006000| is_uni_punct||5.006000| is_uni_space_lc||5.006000| is_uni_space||5.006000| is_uni_upper_lc||5.006000| is_uni_upper||5.006000| is_uni_xdigit_lc||5.006000| is_uni_xdigit||5.006000| is_utf8_alnumc||5.006000| is_utf8_alnum||5.006000| is_utf8_alpha||5.006000| is_utf8_ascii||5.006000| is_utf8_char_slow||| is_utf8_char||5.006000| is_utf8_cntrl||5.006000| is_utf8_common||| is_utf8_digit||5.006000| is_utf8_graph||5.006000| is_utf8_idcont||5.008000| is_utf8_idfirst||5.006000| is_utf8_lower||5.006000| is_utf8_mark||5.006000| is_utf8_print||5.006000| is_utf8_punct||5.006000| is_utf8_space||5.006000| is_utf8_string_loclen||5.009003| is_utf8_string_loc||5.008001| is_utf8_string||5.006001| is_utf8_upper||5.006000| is_utf8_xdigit||5.006000| isa_lookup||| items|||n ix|||n jmaybe||| keyword||| leave_scope||| lex_end||| lex_start||| linklist||| listkids||| list||| load_module_nocontext|||vn load_module||5.006000|v localize||| looks_like_bool||| looks_like_number||| lop||| mPUSHi|5.009002||p mPUSHn|5.009002||p mPUSHp|5.009002||p mPUSHu|5.009002||p mXPUSHi|5.009002||p mXPUSHn|5.009002||p mXPUSHp|5.009002||p mXPUSHu|5.009002||p magic_clear_all_env||| magic_clearenv||| magic_clearpack||| magic_clearsig||| magic_dump||5.006000| magic_existspack||| magic_freearylen_p||| magic_freeovrld||| magic_freeregexp||| magic_getarylen||| magic_getdefelem||| magic_getglob||| magic_getnkeys||| magic_getpack||| magic_getpos||| magic_getsig||| magic_getsubstr||| magic_gettaint||| magic_getuvar||| magic_getvec||| magic_get||| magic_killbackrefs||| magic_len||| magic_methcall||| magic_methpack||| magic_nextpack||| magic_regdata_cnt||| magic_regdatum_get||| magic_regdatum_set||| magic_scalarpack||| magic_set_all_env||| magic_setamagic||| magic_setarylen||| magic_setbm||| magic_setcollxfrm||| magic_setdbline||| magic_setdefelem||| magic_setenv||| magic_setfm||| magic_setglob||| magic_setisa||| magic_setmglob||| magic_setnkeys||| magic_setpack||| magic_setpos||| magic_setregexp||| magic_setsig||| magic_setsubstr||| magic_settaint||| magic_setutf8||| magic_setuvar||| magic_setvec||| magic_set||| magic_sizepack||| magic_wipepack||| magicname||| make_matcher||| make_trie||| malloced_size|||n malloc||5.007002|n markstack_grow||| matcher_matches_sv||| measure_struct||| memEQ|5.004000||p memNE|5.004000||p mem_collxfrm||| mess_alloc||| mess_nocontext|||vn mess||5.006000|v method_common||| mfree||5.007002|n mg_clear||| mg_copy||| mg_dup||| mg_find||| mg_free||| mg_get||| mg_length||5.005000| mg_localize||| mg_magical||| mg_set||| mg_size||5.005000| mini_mktime||5.007002| missingterm||| mode_from_discipline||| modkids||| mod||| moreswitches||| mul128||| mulexp10|||n my_atof2||5.007002| my_atof||5.006000| my_attrs||| my_bcopy|||n my_betoh16|||n my_betoh32|||n my_betoh64|||n my_betohi|||n my_betohl|||n my_betohs|||n my_bzero|||n my_chsize||| my_clearenv||| my_cxt_init||| my_exit_jump||| my_exit||| my_failure_exit||5.004000| my_fflush_all||5.006000| my_fork||5.007003|n my_htobe16|||n my_htobe32|||n my_htobe64|||n my_htobei|||n my_htobel|||n my_htobes|||n my_htole16|||n my_htole32|||n my_htole64|||n my_htolei|||n my_htolel|||n my_htoles|||n my_htonl||| my_kid||| my_letoh16|||n my_letoh32|||n my_letoh64|||n my_letohi|||n my_letohl|||n my_letohs|||n my_lstat||| my_memcmp||5.004000|n my_memset|||n my_ntohl||| my_pclose||5.004000| my_popen_list||5.007001| my_popen||5.004000| my_setenv||| my_socketpair||5.007003|n my_sprintf||5.009003|vn my_stat||| my_strftime||5.007002| my_swabn|||n my_swap||| my_unexec||| my||| need_utf8|||n newANONATTRSUB||5.006000| newANONHASH||| newANONLIST||| newANONSUB||| newASSIGNOP||| newATTRSUB||5.006000| newAVREF||| newAV||| newBINOP||| newCONDOP||| newCONSTSUB|5.006000||p newCVREF||| newDEFSVOP||| newFORM||| newFOROP||| newGIVENOP||5.009003| newGIVWHENOP||| newGVOP||| newGVREF||| newGVgen||| newHVREF||| newHVhv||5.005000| newHV||| newIO||| newLISTOP||| newLOGOP||| newLOOPEX||| newLOOPOP||| newMYSUB||5.006000| newNULLLIST||| newOP||| newPADOP||5.006000| newPMOP||| newPROG||| newPVOP||| newRANGE||| newRV_inc|5.004000||p newRV_noinc|5.006000||p newRV||| newSLICEOP||| newSTATEOP||| newSUB||| newSVOP||| newSVREF||| newSVhek||5.009003| newSViv||| newSVnv||| newSVpvf_nocontext|||vn newSVpvf||5.004000|v newSVpvn_share||5.007001| newSVpvn|5.006000||p newSVpv||| newSVrv||| newSVsv||| newSVuv|5.006000||p newSV||| newUNOP||| newWHENOP||5.009003| newWHILEOP||5.009003| newXSproto||5.006000| newXS||5.006000| new_collate||5.006000| new_constant||| new_ctype||5.006000| new_he||| new_logop||| new_numeric||5.006000| new_stackinfo||5.005000| new_version||5.009000| next_symbol||| nextargv||| nextchar||| ninstr||| no_bareword_allowed||| no_fh_allowed||| no_op||| not_a_number||| nothreadhook||5.008000| nuke_stacks||| num_overflow|||n offer_nice_chunk||| oopsAV||| oopsCV||| oopsHV||| op_clear||| op_const_sv||| op_dump||5.006000| op_free||| op_null||5.007002| op_refcnt_lock||5.009002| op_refcnt_unlock||5.009002| open_script||| pMY_CXT_|5.007003||p pMY_CXT|5.007003||p pTHX_|5.006000||p pTHX|5.006000||p pack_cat||5.007003| pack_rec||| package||| packlist||5.008001| pad_add_anon||| pad_add_name||| pad_alloc||| pad_block_start||| pad_check_dup||| pad_compname_type||| pad_findlex||| pad_findmy||| pad_fixup_inner_anons||| pad_free||| pad_leavemy||| pad_new||| pad_push||| pad_reset||| pad_setsv||| pad_sv||| pad_swipe||| pad_tidy||| pad_undef||| parse_body||| parse_unicode_opts||| path_is_absolute||| peep||| pending_ident||| perl_alloc_using|||n perl_alloc|||n perl_clone_using|||n perl_clone|||n perl_construct|||n perl_destruct||5.007003|n perl_free|||n perl_parse||5.006000|n perl_run|||n pidgone||| pmflag||| pmop_dump||5.006000| pmruntime||| pmtrans||| pop_scope||| pregcomp||| pregexec||| pregfree||| prepend_elem||| printf_nocontext|||vn ptr_table_clear||| ptr_table_fetch||| ptr_table_free||| ptr_table_new||| ptr_table_split||| ptr_table_store||| push_scope||| put_byte||| pv_display||5.006000| pv_uni_display||5.007003| qerror||| re_croak2||| re_dup||| re_intuit_start||5.006000| re_intuit_string||5.006000| realloc||5.007002|n reentrant_free||| reentrant_init||| reentrant_retry|||vn reentrant_size||| ref_array_or_hash||| refkids||| refto||| ref||5.009003| reg_node||| reganode||| regatom||| regbranch||| regclass_swash||5.007003| regclass||| regcppop||| regcppush||| regcurly||| regdump||5.005000| regexec_flags||5.005000| reghop3||| reghopmaybe3||| reghopmaybe||| reghop||| reginclass||| reginitcolors||5.006000| reginsert||| regmatch||| regnext||5.005000| regoptail||| regpiece||| regpposixcc||| regprop||| regrepeat_hard||| regrepeat||| regtail||| regtry||| reguni||| regwhite||| reg||| repeatcpy||| report_evil_fh||| report_uninit||| require_errno||| require_pv||5.006000| restore_magic||| rninstr||| rsignal_restore||| rsignal_save||| rsignal_state||5.004000| rsignal||5.004000| run_body||| run_user_filter||| runops_debug||5.005000| runops_standard||5.005000| rvpv_dup||| rxres_free||| rxres_restore||| rxres_save||| safesyscalloc||5.006000|n safesysfree||5.006000|n safesysmalloc||5.006000|n safesysrealloc||5.006000|n same_dirent||| save_I16||5.004000| save_I32||| save_I8||5.006000| save_aelem||5.004050| save_alloc||5.006000| save_aptr||| save_ary||| save_bool||5.008001| save_clearsv||| save_delete||| save_destructor_x||5.006000| save_destructor||5.006000| save_freeop||| save_freepv||| save_freesv||| save_generic_pvref||5.006001| save_generic_svref||5.005030| save_gp||5.004000| save_hash||| save_hek_flags||| save_helem||5.004050| save_hints||5.005000| save_hptr||| save_int||| save_item||| save_iv||5.005000| save_lines||| save_list||| save_long||| save_magic||| save_mortalizesv||5.007001| save_nogv||| save_op||| save_padsv||5.007001| save_pptr||| save_re_context||5.006000| save_scalar_at||| save_scalar||| save_set_svflags||5.009000| save_shared_pvref||5.007003| save_sptr||| save_svref||| save_threadsv||5.005000| save_vptr||5.006000| savepvn||| savepv||| savesharedpv||5.007003| savestack_grow_cnt||5.008001| savestack_grow||| savesvpv||5.009002| sawparens||| scalar_mod_type||| scalarboolean||| scalarkids||| scalarseq||| scalarvoid||| scalar||| scan_bin||5.006000| scan_commit||| scan_const||| scan_formline||| scan_heredoc||| scan_hex||| scan_ident||| scan_inputsymbol||| scan_num||5.007001| scan_oct||| scan_pat||| scan_str||| scan_subst||| scan_trans||| scan_version||5.009001| scan_vstring||5.008001| scan_word||| scope||| screaminstr||5.005000| seed||5.008001| sequence_num||| sequence||| set_context||5.006000|n set_csh||| set_numeric_local||5.006000| set_numeric_radix||5.006000| set_numeric_standard||5.006000| setdefout||| setenv_getix||| share_hek_flags||| share_hek||5.004000| si_dup||| sighandler|||n simplify_sort||| skipspace||| sortcv_stacked||| sortcv_xsub||| sortcv||| sortsv_flags||5.009003| sortsv||5.007003| ss_dup||| stack_grow||| start_glob||| start_subparse||5.004000| stashpv_hvname_match||5.009003| stdize_locale||| strEQ||| strGE||| strGT||| strLE||| strLT||| strNE||| str_to_version||5.006000| stringify_regexp||| strip_return||| strnEQ||| strnNE||| study_chunk||| sub_crush_depth||| sublex_done||| sublex_push||| sublex_start||| sv_2bool||| sv_2cv||| sv_2io||| sv_2iuv_non_preserve||| sv_2iv_flags||5.009001| sv_2iv||| sv_2mortal||| sv_2nv||| sv_2pv_flags||5.007002| sv_2pv_nolen|5.006000||p sv_2pvbyte_nolen||| sv_2pvbyte|5.006000||p sv_2pvutf8_nolen||5.006000| sv_2pvutf8||5.006000| sv_2pv||| sv_2uv_flags||5.009001| sv_2uv|5.004000||p sv_add_arena||| sv_add_backref||| sv_backoff||| sv_bless||| sv_cat_decode||5.008001| sv_catpv_mg|5.006000||p sv_catpvf_mg_nocontext|||pvn sv_catpvf_mg|5.006000|5.004000|pv sv_catpvf_nocontext|||vn sv_catpvf||5.004000|v sv_catpvn_flags||5.007002| sv_catpvn_mg|5.004050||p sv_catpvn_nomg|5.007002||p sv_catpvn||| sv_catpv||| sv_catsv_flags||5.007002| sv_catsv_mg|5.004050||p sv_catsv_nomg|5.007002||p sv_catsv||| sv_chop||| sv_clean_all||| sv_clean_objs||| sv_clear||| sv_cmp_locale||5.004000| sv_cmp||| sv_collxfrm||| sv_compile_2op||5.008001| sv_copypv||5.007003| sv_dec||| sv_del_backref||| sv_derived_from||5.004000| sv_dump||| sv_dup||| sv_eq||| sv_exp_grow||| sv_force_normal_flags||5.007001| sv_force_normal||5.006000| sv_free2||| sv_free_arenas||| sv_free||| sv_gets||5.004000| sv_grow||| sv_i_ncmp||| sv_inc||| sv_insert||| sv_isa||| sv_isobject||| sv_iv||5.005000| sv_kill_backrefs||| sv_len_utf8||5.006000| sv_len||| sv_magicext||5.007003| sv_magic||| sv_mortalcopy||| sv_ncmp||| sv_newmortal||| sv_newref||| sv_nolocking||5.007003| sv_nosharing||5.007003| sv_nounlocking||5.007003| sv_nv||5.005000| sv_peek||5.005000| sv_pos_b2u||5.006000| sv_pos_u2b||5.006000| sv_pvbyten_force||5.006000| sv_pvbyten||5.006000| sv_pvbyte||5.006000| sv_pvn_force_flags||5.007002| sv_pvn_force|||p sv_pvn_nomg|5.007003||p sv_pvn|5.006000||p sv_pvutf8n_force||5.006000| sv_pvutf8n||5.006000| sv_pvutf8||5.006000| sv_pv||5.006000| sv_recode_to_utf8||5.007003| sv_reftype||| sv_release_COW||| sv_release_IVX||| sv_replace||| sv_report_used||| sv_reset||| sv_rvweaken||5.006000| sv_setiv_mg|5.006000||p sv_setiv||| sv_setnv_mg|5.006000||p sv_setnv||| sv_setpv_mg|5.006000||p sv_setpvf_mg_nocontext|||pvn sv_setpvf_mg|5.006000|5.004000|pv sv_setpvf_nocontext|||vn sv_setpvf||5.004000|v sv_setpviv_mg||5.008001| sv_setpviv||5.008001| sv_setpvn_mg|5.006000||p sv_setpvn||| sv_setpv||| sv_setref_iv||| sv_setref_nv||| sv_setref_pvn||| sv_setref_pv||| sv_setref_uv||5.007001| sv_setsv_cow||| sv_setsv_flags||5.007002| sv_setsv_mg|5.006000||p sv_setsv_nomg|5.007002||p sv_setsv||| sv_setuv_mg|5.006000||p sv_setuv|5.006000||p sv_tainted||5.004000| sv_taint||5.004000| sv_true||5.005000| sv_unglob||| sv_uni_display||5.007003| sv_unmagic||| sv_unref_flags||5.007001| sv_unref||| sv_untaint||5.004000| sv_upgrade||| sv_usepvn_mg|5.006000||p sv_usepvn||| sv_utf8_decode||5.006000| sv_utf8_downgrade||5.006000| sv_utf8_encode||5.006000| sv_utf8_upgrade_flags||5.007002| sv_utf8_upgrade||5.007001| sv_uv|5.006000||p sv_vcatpvf_mg|5.006000|5.004000|p sv_vcatpvfn||5.004000| sv_vcatpvf|5.006000|5.004000|p sv_vsetpvf_mg|5.006000|5.004000|p sv_vsetpvfn||5.004000| sv_vsetpvf|5.006000|5.004000|p svtype||| swallow_bom||| swash_fetch||5.007002| swash_get||| swash_init||5.006000| sys_intern_clear||| sys_intern_dup||| sys_intern_init||| taint_env||| taint_proper||| tmps_grow||5.006000| toLOWER||| toUPPER||| to_byte_substr||| to_uni_fold||5.007003| to_uni_lower_lc||5.006000| to_uni_lower||5.007003| to_uni_title_lc||5.006000| to_uni_title||5.007003| to_uni_upper_lc||5.006000| to_uni_upper||5.007003| to_utf8_case||5.007003| to_utf8_fold||5.007003| to_utf8_lower||5.007003| to_utf8_substr||| to_utf8_title||5.007003| to_utf8_upper||5.007003| tokenize_use||| tokeq||| tokereport||| too_few_arguments||| too_many_arguments||| uiv_2buf|||n unlnk||| unpack_rec||| unpack_str||5.007003| unpackstring||5.008001| unshare_hek_or_pvn||| unshare_hek||| unsharepvn||5.004000| unwind_handler_stack||| upg_version||5.009000| usage||| utf16_to_utf8_reversed||5.006001| utf16_to_utf8||5.006001| utf8_distance||5.006000| utf8_hop||5.006000| utf8_length||5.007001| utf8_mg_pos_init||| utf8_mg_pos||| utf8_to_bytes||5.006001| utf8_to_uvchr||5.007001| utf8_to_uvuni||5.007001| utf8n_to_uvchr||| utf8n_to_uvuni||5.007001| utilize||| uvchr_to_utf8_flags||5.007003| uvchr_to_utf8||| uvuni_to_utf8_flags||5.007003| uvuni_to_utf8||5.007001| validate_suid||| varname||| vcmp||5.009000| vcroak||5.006000| vdeb||5.007003| vdie_common||| vdie_croak_common||| vdie||| vform||5.006000| visit||| vivify_defelem||| vivify_ref||| vload_module||5.006000| vmess||5.006000| vnewSVpvf|5.006000|5.004000|p vnormal||5.009002| vnumify||5.009000| vstringify||5.009000| vverify||5.009003| vwarner||5.006000| vwarn||5.006000| wait4pid||| warn_nocontext|||vn warner_nocontext|||vn warner||5.006000|v warn|||v watch||| whichsig||| write_no_mem||| write_to_stderr||| yyerror||| yylex||| yyparse||| yywarn||| ); if (exists $opt{'list-unsupported'}) { my $f; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $API{$f}{todo}; print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; } exit 0; } # Scan for possible replacement candidates my(%replace, %need, %hints, %depends); my $replace = 0; my $hint = ''; while () { if ($hint) { if (m{^\s*\*\s(.*?)\s*$}) { $hints{$hint} ||= ''; # suppress warning with older perls $hints{$hint} .= "$1\n"; } else { $hint = ''; } } $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$}; $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; if (m{^\s*$rccs\s+(\w+)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { push @{$depends{$1}}, map { s/\s+//g; $_ } split /,/, $2; } $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; } if (exists $opt{'api-info'}) { my $f; my $count = 0; my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $f =~ /$match/; print "\n=== $f ===\n\n"; my $info = 0; if ($API{$f}{base} || $API{$f}{todo}) { my $base = format_version($API{$f}{base} || $API{$f}{todo}); print "Supported at least starting from perl-$base.\n"; $info++; } if ($API{$f}{provided}) { my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; print "Support by $ppport provided back to perl-$todo.\n"; print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; print "$hints{$f}" if exists $hints{$f}; $info++; } unless ($info) { print "No portability information available.\n"; } $count++; } if ($count > 0) { print "\n"; } else { print "Found no API matching '$opt{'api-info'}'.\n"; } exit 0; } if (exists $opt{'list-provided'}) { my $f; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $API{$f}{provided}; my @flags; push @flags, 'explicit' if exists $need{$f}; push @flags, 'depend' if exists $depends{$f}; push @flags, 'hint' if exists $hints{$f}; my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; print "$f$flags\n"; } exit 0; } my @files; my @srcext = qw( xs c h cc cpp ); my $srcext = join '|', @srcext; if (@ARGV) { my %seen; @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV; } else { eval { require File::Find; File::Find::find(sub { $File::Find::name =~ /\.($srcext)$/i and push @files, $File::Find::name; }, '.'); }; if ($@) { @files = map { glob "*.$_" } @srcext; } } if (!@ARGV || $opt{filter}) { my(@in, @out); my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; for (@files) { my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/\.($srcext)$/i; push @{ $out ? \@out : \@in }, $_; } if (@ARGV && @out) { warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); } @files = @in; } unless (@files) { die "No input files given!\n"; } my(%files, %global, %revreplace); %revreplace = reverse %replace; my $filename; my $patch_opened = 0; for $filename (@files) { unless (open IN, "<$filename") { warn "Unable to read from $filename: $!\n"; next; } info("Scanning $filename ..."); my $c = do { local $/; }; close IN; my %file = (orig => $c, changes => 0); # temporarily remove C comments from the code my @ccom; $c =~ s{ ( [^"'/]+ | (?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+ | (?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+ ) | (/ (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* )) }{ defined $2 and push @ccom, $2; defined $1 ? $1 : "$ccs$#ccom$cce"; }egsx; $file{ccom} = \@ccom; $file{code} = $c; $file{has_inc_ppport} = ($c =~ /#.*include.*\Q$ppport\E/); my $func; for $func (keys %API) { my $match = $func; $match .= "|$revreplace{$func}" if exists $revreplace{$func}; if ($c =~ /\b(?:Perl_)?($match)\b/) { $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; if (exists $API{$func}{provided}) { if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { $file{uses}{$func}++; my @deps = rec_depend($func); if (@deps) { $file{uses_deps}{$func} = \@deps; for (@deps) { $file{uses}{$_} = 0 unless exists $file{uses}{$_}; } } for ($func, @deps) { if (exists $need{$_}) { $file{needs}{$_} = 'static'; } } } } if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { if ($c =~ /\b$func\b/) { $file{uses_todo}{$func}++; } } } } while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { if (exists $need{$2}) { $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; } else { warning("Possibly wrong #define $1 in $filename"); } } for (qw(uses needs uses_todo needed_global needed_static)) { for $func (keys %{$file{$_}}) { push @{$global{$_}{$func}}, $filename; } } $files{$filename} = \%file; } # Globally resolve NEED_'s my $need; for $need (keys %{$global{needs}}) { if (@{$global{needs}{$need}} > 1) { my @targets = @{$global{needs}{$need}}; my @t = grep $files{$_}{needed_global}{$need}, @targets; @targets = @t if @t; @t = grep /\.xs$/i, @targets; @targets = @t if @t; my $target = shift @targets; $files{$target}{needs}{$need} = 'global'; for (@{$global{needs}{$need}}) { $files{$_}{needs}{$need} = 'extern' if $_ ne $target; } } } for $filename (@files) { exists $files{$filename} or next; info("=== Analyzing $filename ==="); my %file = %{$files{$filename}}; my $func; my $c = $file{code}; for $func (sort keys %{$file{uses_Perl}}) { if ($API{$func}{varargs}) { my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); if ($changes) { warning("Doesn't pass interpreter argument aTHX to Perl_$func"); $file{changes} += $changes; } } else { warning("Uses Perl_$func instead of $func"); $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} {$func$1(}g); } } for $func (sort keys %{$file{uses_replace}}) { warning("Uses $func instead of $replace{$func}"); $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); } for $func (sort keys %{$file{uses}}) { next unless $file{uses}{$func}; # if it's only a dependency if (exists $file{uses_deps}{$func}) { diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); } elsif (exists $replace{$func}) { warning("Uses $func instead of $replace{$func}"); $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); } else { diag("Uses $func"); } hint($func); } for $func (sort keys %{$file{uses_todo}}) { warning("Uses $func, which may not be portable below perl ", format_version($API{$func}{todo})); } for $func (sort keys %{$file{needed_static}}) { my $message = ''; if (not exists $file{uses}{$func}) { $message = "No need to define NEED_$func if $func is never used"; } elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { $message = "No need to define NEED_$func when already needed globally"; } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); } } for $func (sort keys %{$file{needed_global}}) { my $message = ''; if (not exists $global{uses}{$func}) { $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; } elsif (exists $file{needs}{$func}) { if ($file{needs}{$func} eq 'extern') { $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; } elsif ($file{needs}{$func} eq 'static') { $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; } } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); } } $file{needs_inc_ppport} = keys %{$file{uses}}; if ($file{needs_inc_ppport}) { my $pp = ''; for $func (sort keys %{$file{needs}}) { my $type = $file{needs}{$func}; next if $type eq 'extern'; my $suffix = $type eq 'global' ? '_GLOBAL' : ''; unless (exists $file{"needed_$type"}{$func}) { if ($type eq 'global') { diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); } else { diag("File needs $func, adding static request"); } $pp .= "#define NEED_$func$suffix\n"; } } if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { $pp = ''; $file{changes}++; } unless ($file{has_inc_ppport}) { diag("Needs to include '$ppport'"); $pp .= qq(#include "$ppport"\n) } if ($pp) { $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) || ($c =~ s/^/$pp/); } } else { if ($file{has_inc_ppport}) { diag("No need to include '$ppport'"); $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); } } # put back in our C comments my $ix; my $cppc = 0; my @ccom = @{$file{ccom}}; for $ix (0 .. $#ccom) { if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { $cppc++; $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; } else { $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; } } if ($cppc) { my $s = $cppc != 1 ? 's' : ''; warning("Uses $cppc C++ style comment$s, which is not portable"); } if ($file{changes}) { if (exists $opt{copy}) { my $newfile = "$filename$opt{copy}"; if (-e $newfile) { error("'$newfile' already exists, refusing to write copy of '$filename'"); } else { local *F; if (open F, ">$newfile") { info("Writing copy of '$filename' with changes to '$newfile'"); print F $c; close F; } else { error("Cannot open '$newfile' for writing: $!"); } } } elsif (exists $opt{patch} || $opt{changes}) { if (exists $opt{patch}) { unless ($patch_opened) { if (open PATCH, ">$opt{patch}") { $patch_opened = 1; } else { error("Cannot open '$opt{patch}' for writing: $!"); delete $opt{patch}; $opt{changes} = 1; goto fallback; } } mydiff(\*PATCH, $filename, $c); } else { fallback: info("Suggested changes:"); mydiff(\*STDOUT, $filename, $c); } } else { my $s = $file{changes} == 1 ? '' : 's'; info("$file{changes} potentially required change$s detected"); } } else { info("Looks good"); } } close PATCH if $patch_opened; exit 0; sub mydiff { local *F = shift; my($file, $str) = @_; my $diff; if (exists $opt{diff}) { $diff = run_diff($opt{diff}, $file, $str); } if (!defined $diff and can_use('Text::Diff')) { $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); $diff = <
$tmp") { print F $str; close F; if (open F, "$prog $file $tmp |") { while () { s/\Q$tmp\E/$file.patched/; $diff .= $_; } close F; unlink $tmp; return $diff; } unlink $tmp; } else { error("Cannot open '$tmp' for writing: $!"); } return undef; } sub can_use { eval "use @_;"; return $@ eq ''; } sub rec_depend { my $func = shift; my %seen; return () unless exists $depends{$func}; grep !$seen{$_}++, map { ($_, rec_depend($_)) } @{$depends{$func}}; } sub parse_version { my $ver = shift; if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { return ($1, $2, $3); } elsif ($ver !~ /^\d+\.[\d_]+$/) { die "cannot parse version '$ver'\n"; } $ver =~ s/_//g; $ver =~ s/$/000000/; my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; $v = int $v; $s = int $s; if ($r < 5 || ($r == 5 && $v < 6)) { if ($s % 10) { die "cannot parse version '$ver'\n"; } } return ($r, $v, $s); } sub format_version { my $ver = shift; $ver =~ s/$/000000/; my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; $v = int $v; $s = int $s; if ($r < 5 || ($r == 5 && $v < 6)) { if ($s % 10) { die "invalid version '$ver'\n"; } $s /= 10; $ver = sprintf "%d.%03d", $r, $v; $s > 0 and $ver .= sprintf "_%02d", $s; return $ver; } return sprintf "%d.%d.%d", $r, $v, $s; } sub info { $opt{quiet} and return; print @_, "\n"; } sub diag { $opt{quiet} and return; $opt{diag} and print @_, "\n"; } sub warning { $opt{quiet} and return; print "*** ", @_, "\n"; } sub error { print "*** ERROR: ", @_, "\n"; } my %given_hints; sub hint { $opt{quiet} and return; $opt{hints} or return; my $func = shift; exists $hints{$func} or return; $given_hints{$func}++ and return; my $hint = $hints{$func}; $hint =~ s/^/ /mg; print " --- hint for $func ---\n", $hint; } sub usage { my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; my %M = ( 'I' => '*' ); $usage =~ s/^\s*perl\s+\S+/$^X $0/; $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; print < }; $self =~ s/^$HS+Do NOT edit.*?(?=^-)//ms; $self =~ s/^SKIP.*(?=^__DATA__)/SKIP if (\@ARGV && \$ARGV[0] eq '--unstrip') { eval { require Devel::PPPort }; \$@ and die "Cannot require Devel::PPPort, please install.\\n"; Devel::PPPort::WriteFile(\$0); exit 0; } print <$0" or die "cannot strip $0: $!\n"; print OUT $self; exit 0; } __DATA__ */ #ifndef _P_P_PORTABILITY_H_ #define _P_P_PORTABILITY_H_ #ifndef DPPP_NAMESPACE # define DPPP_NAMESPACE DPPP_ #endif #define DPPP_CAT2(x,y) CAT2(x,y) #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) #ifndef PERL_REVISION # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) # define PERL_PATCHLEVEL_H_IMPLICIT # include # endif # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) # include # endif # ifndef PERL_REVISION # define PERL_REVISION (5) /* Replace: 1 */ # define PERL_VERSION PATCHLEVEL # define PERL_SUBVERSION SUBVERSION /* Replace PERL_PATCHLEVEL with PERL_VERSION */ /* Replace: 0 */ # endif #endif #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) /* It is very unlikely that anyone will try to use this with Perl 6 (or greater), but who knows. */ #if PERL_REVISION != 5 # error ppport.h only works with Perl version 5 #endif /* PERL_REVISION != 5 */ #ifdef I_LIMITS # include #endif #ifndef PERL_UCHAR_MIN # define PERL_UCHAR_MIN ((unsigned char)0) #endif #ifndef PERL_UCHAR_MAX # ifdef UCHAR_MAX # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) # else # ifdef MAXUCHAR # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) # else # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) # endif # endif #endif #ifndef PERL_USHORT_MIN # define PERL_USHORT_MIN ((unsigned short)0) #endif #ifndef PERL_USHORT_MAX # ifdef USHORT_MAX # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) # else # ifdef MAXUSHORT # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) # else # ifdef USHRT_MAX # define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) # else # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) # endif # endif # endif #endif #ifndef PERL_SHORT_MAX # ifdef SHORT_MAX # define PERL_SHORT_MAX ((short)SHORT_MAX) # else # ifdef MAXSHORT /* Often used in */ # define PERL_SHORT_MAX ((short)MAXSHORT) # else # ifdef SHRT_MAX # define PERL_SHORT_MAX ((short)SHRT_MAX) # else # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) # endif # endif # endif #endif #ifndef PERL_SHORT_MIN # ifdef SHORT_MIN # define PERL_SHORT_MIN ((short)SHORT_MIN) # else # ifdef MINSHORT # define PERL_SHORT_MIN ((short)MINSHORT) # else # ifdef SHRT_MIN # define PERL_SHORT_MIN ((short)SHRT_MIN) # else # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif #ifndef PERL_UINT_MAX # ifdef UINT_MAX # define PERL_UINT_MAX ((unsigned int)UINT_MAX) # else # ifdef MAXUINT # define PERL_UINT_MAX ((unsigned int)MAXUINT) # else # define PERL_UINT_MAX (~(unsigned int)0) # endif # endif #endif #ifndef PERL_UINT_MIN # define PERL_UINT_MIN ((unsigned int)0) #endif #ifndef PERL_INT_MAX # ifdef INT_MAX # define PERL_INT_MAX ((int)INT_MAX) # else # ifdef MAXINT /* Often used in */ # define PERL_INT_MAX ((int)MAXINT) # else # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) # endif # endif #endif #ifndef PERL_INT_MIN # ifdef INT_MIN # define PERL_INT_MIN ((int)INT_MIN) # else # ifdef MININT # define PERL_INT_MIN ((int)MININT) # else # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) # endif # endif #endif #ifndef PERL_ULONG_MAX # ifdef ULONG_MAX # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) # else # ifdef MAXULONG # define PERL_ULONG_MAX ((unsigned long)MAXULONG) # else # define PERL_ULONG_MAX (~(unsigned long)0) # endif # endif #endif #ifndef PERL_ULONG_MIN # define PERL_ULONG_MIN ((unsigned long)0L) #endif #ifndef PERL_LONG_MAX # ifdef LONG_MAX # define PERL_LONG_MAX ((long)LONG_MAX) # else # ifdef MAXLONG # define PERL_LONG_MAX ((long)MAXLONG) # else # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) # endif # endif #endif #ifndef PERL_LONG_MIN # ifdef LONG_MIN # define PERL_LONG_MIN ((long)LONG_MIN) # else # ifdef MINLONG # define PERL_LONG_MIN ((long)MINLONG) # else # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) # endif # endif #endif #if defined(HAS_QUAD) && (defined(convex) || defined(uts)) # ifndef PERL_UQUAD_MAX # ifdef ULONGLONG_MAX # define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) # else # ifdef MAXULONGLONG # define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) # else # define PERL_UQUAD_MAX (~(unsigned long long)0) # endif # endif # endif # ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN ((unsigned long long)0L) # endif # ifndef PERL_QUAD_MAX # ifdef LONGLONG_MAX # define PERL_QUAD_MAX ((long long)LONGLONG_MAX) # else # ifdef MAXLONGLONG # define PERL_QUAD_MAX ((long long)MAXLONGLONG) # else # define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) # endif # endif # endif # ifndef PERL_QUAD_MIN # ifdef LONGLONG_MIN # define PERL_QUAD_MIN ((long long)LONGLONG_MIN) # else # ifdef MINLONGLONG # define PERL_QUAD_MIN ((long long)MINLONGLONG) # else # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif /* This is based on code from 5.003 perl.h */ #ifdef HAS_QUAD # ifdef cray #ifndef IVTYPE # define IVTYPE int #endif #ifndef IV_MIN # define IV_MIN PERL_INT_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_INT_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UINT_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UINT_MAX #endif # ifdef INTSIZE #ifndef IVSIZE # define IVSIZE INTSIZE #endif # endif # else # if defined(convex) || defined(uts) #ifndef IVTYPE # define IVTYPE long long #endif #ifndef IV_MIN # define IV_MIN PERL_QUAD_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_QUAD_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UQUAD_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UQUAD_MAX #endif # ifdef LONGLONGSIZE #ifndef IVSIZE # define IVSIZE LONGLONGSIZE #endif # endif # else #ifndef IVTYPE # define IVTYPE long #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif # ifdef LONGSIZE #ifndef IVSIZE # define IVSIZE LONGSIZE #endif # endif # endif # endif #ifndef IVSIZE # define IVSIZE 8 #endif #ifndef PERL_QUAD_MIN # define PERL_QUAD_MIN IV_MIN #endif #ifndef PERL_QUAD_MAX # define PERL_QUAD_MAX IV_MAX #endif #ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN UV_MIN #endif #ifndef PERL_UQUAD_MAX # define PERL_UQUAD_MAX UV_MAX #endif #else #ifndef IVTYPE # define IVTYPE long #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif #endif #ifndef IVSIZE # ifdef LONGSIZE # define IVSIZE LONGSIZE # else # define IVSIZE 4 /* A bold guess, but the best we can make. */ # endif #endif #ifndef UVTYPE # define UVTYPE unsigned IVTYPE #endif #ifndef UVSIZE # define UVSIZE IVSIZE #endif #ifndef sv_setuv # define sv_setuv(sv, uv) \ STMT_START { \ UV TeMpUv = uv; \ if (TeMpUv <= IV_MAX) \ sv_setiv(sv, TeMpUv); \ else \ sv_setnv(sv, (double)TeMpUv); \ } STMT_END #endif #ifndef newSVuv # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) #endif #ifndef sv_2uv # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) #endif #ifndef SvUVX # define SvUVX(sv) ((UV)SvIVX(sv)) #endif #ifndef SvUVXx # define SvUVXx(sv) SvUVX(sv) #endif #ifndef SvUV # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) #endif #ifndef SvUVx # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) #endif /* Hint: sv_uv * Always use the SvUVx() macro instead of sv_uv(). */ #ifndef sv_uv # define sv_uv(sv) SvUVx(sv) #endif #ifndef XST_mUV # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) #endif #ifndef XSRETURN_UV # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END #endif #ifndef PUSHu # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END #endif #ifndef XPUSHu # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END #endif #ifdef HAS_MEMCMP #ifndef memNE # define memNE(s1,s2,l) (memcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) #endif #else #ifndef memNE # define memNE(s1,s2,l) (bcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) #endif #endif #ifndef MoveD # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifndef CopyD # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifdef HAS_MEMSET #ifndef ZeroD # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) #endif #else #ifndef ZeroD # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) #endif #endif #ifndef Poison # define Poison(d,n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t)) #endif #ifndef Newx # define Newx(v,n,t) New(0,v,n,t) #endif #ifndef Newxc # define Newxc(v,n,t,c) Newc(0,v,n,t,c) #endif #ifndef Newxz # define Newxz(v,n,t) Newz(0,v,n,t) #endif #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) /* Replace: 1 */ # define PL_DBsingle DBsingle # define PL_DBsub DBsub # define PL_Sv Sv # define PL_compiling compiling # define PL_copline copline # define PL_curcop curcop # define PL_curstash curstash # define PL_debstash debstash # define PL_defgv defgv # define PL_diehook diehook # define PL_dirty dirty # define PL_dowarn dowarn # define PL_errgv errgv # define PL_hexdigit hexdigit # define PL_hints hints # define PL_na na # define PL_no_modify no_modify # define PL_perl_destruct_level perl_destruct_level # define PL_perldb perldb # define PL_ppaddr ppaddr # define PL_rsfp_filters rsfp_filters # define PL_rsfp rsfp # define PL_stack_base stack_base # define PL_stack_sp stack_sp # define PL_stdingv stdingv # define PL_sv_arenaroot sv_arenaroot # define PL_sv_no sv_no # define PL_sv_undef sv_undef # define PL_sv_yes sv_yes # define PL_tainted tainted # define PL_tainting tainting /* Replace: 0 */ #endif #ifndef PERL_UNUSED_DECL # ifdef HASATTRIBUTE # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) # define PERL_UNUSED_DECL # else # define PERL_UNUSED_DECL __attribute__((unused)) # endif # else # define PERL_UNUSED_DECL # endif #endif #ifndef NOOP # define NOOP (void)0 #endif #ifndef dNOOP # define dNOOP extern int Perl___notused PERL_UNUSED_DECL #endif #ifndef NVTYPE # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) # define NVTYPE long double # else # define NVTYPE double # endif typedef NVTYPE NV; #endif #ifndef INT2PTR # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) # define PTRV UV # define INT2PTR(any,d) (any)(d) # else # if PTRSIZE == LONGSIZE # define PTRV unsigned long # else # define PTRV unsigned # endif # define INT2PTR(any,d) (any)(PTRV)(d) # endif # define NUM2PTR(any,d) (any)(PTRV)(d) # define PTR2IV(p) INT2PTR(IV,p) # define PTR2UV(p) INT2PTR(UV,p) # define PTR2NV(p) NUM2PTR(NV,p) # if PTRSIZE == LONGSIZE # define PTR2ul(p) (unsigned long)(p) # else # define PTR2ul(p) INT2PTR(unsigned long,p) # endif #endif /* !INT2PTR */ #undef START_EXTERN_C #undef END_EXTERN_C #undef EXTERN_C #ifdef __cplusplus # define START_EXTERN_C extern "C" { # define END_EXTERN_C } # define EXTERN_C extern "C" #else # define START_EXTERN_C # define END_EXTERN_C # define EXTERN_C extern #endif #ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN # if defined(__STRICT_ANSI__) && defined(PERL_GCC_PEDANTIC) # define PERL_GCC_BRACE_GROUPS_FORBIDDEN # endif #endif #undef STMT_START #undef STMT_END #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ # define STMT_END ) #else # if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) # define STMT_START if (1) # define STMT_END else (void)0 # else # define STMT_START do # define STMT_END while (0) # endif #endif #ifndef boolSV # define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) #endif /* DEFSV appears first in 5.004_56 */ #ifndef DEFSV # define DEFSV GvSV(PL_defgv) #endif #ifndef SAVE_DEFSV # define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) #endif /* Older perls (<=5.003) lack AvFILLp */ #ifndef AvFILLp # define AvFILLp AvFILL #endif #ifndef ERRSV # define ERRSV get_sv("@",FALSE) #endif #ifndef newSVpvn # define newSVpvn(data,len) ((data) \ ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ : newSV(0)) #endif /* Hint: gv_stashpvn * This function's backport doesn't support the length parameter, but * rather ignores it. Portability can only be ensured if the length * parameter is used for speed reasons, but the length can always be * correctly computed from the string argument. */ #ifndef gv_stashpvn # define gv_stashpvn(str,len,create) gv_stashpv(str,create) #endif /* Replace: 1 */ #ifndef get_cv # define get_cv perl_get_cv #endif #ifndef get_sv # define get_sv perl_get_sv #endif #ifndef get_av # define get_av perl_get_av #endif #ifndef get_hv # define get_hv perl_get_hv #endif /* Replace: 0 */ #ifndef dUNDERBAR # define dUNDERBAR dNOOP #endif #ifndef UNDERBAR # define UNDERBAR DEFSV #endif #ifndef dAX # define dAX I32 ax = MARK - PL_stack_base + 1 #endif #ifndef dITEMS # define dITEMS I32 items = SP - MARK #endif #ifndef dXSTARG # define dXSTARG SV * targ = sv_newmortal() #endif #ifndef dAXMARK # define dAXMARK I32 ax = POPMARK; \ register SV ** const mark = PL_stack_base + ax++ #endif #ifndef XSprePUSH # define XSprePUSH (sp = PL_stack_base + ax - 1) #endif #if ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 0))) # undef XSRETURN # define XSRETURN(off) \ STMT_START { \ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ return; \ } STMT_END #endif #ifndef PERL_SIGNALS_UNSAFE_FLAG #define PERL_SIGNALS_UNSAFE_FLAG 0x0001 #if defined(NEED_PL_signals) static U32 DPPP_(my_PL_signals) = PERL_SIGNALS_UNSAFE_FLAG; #elif defined(NEED_PL_signals_GLOBAL) U32 DPPP_(my_PL_signals) = PERL_SIGNALS_UNSAFE_FLAG; #else extern U32 DPPP_(my_PL_signals); #endif #define PL_signals DPPP_(my_PL_signals) #endif #ifndef dTHR # define dTHR dNOOP #endif #ifndef dTHX # define dTHX dNOOP #endif #ifndef dTHXa # define dTHXa(x) dNOOP #endif #ifndef pTHX # define pTHX void #endif #ifndef pTHX_ # define pTHX_ #endif #ifndef aTHX # define aTHX #endif #ifndef aTHX_ # define aTHX_ #endif #ifndef dTHXoa # define dTHXoa(x) dTHXa(x) #endif #ifndef PUSHmortal # define PUSHmortal PUSHs(sv_newmortal()) #endif #ifndef mPUSHp # define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l)) #endif #ifndef mPUSHn # define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n)) #endif #ifndef mPUSHi # define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i)) #endif #ifndef mPUSHu # define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u)) #endif #ifndef XPUSHmortal # define XPUSHmortal XPUSHs(sv_newmortal()) #endif #ifndef mXPUSHp # define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END #endif #ifndef mXPUSHn # define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END #endif #ifndef mXPUSHi # define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END #endif #ifndef mXPUSHu # define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END #endif /* Replace: 1 */ #ifndef call_sv # define call_sv perl_call_sv #endif #ifndef call_pv # define call_pv perl_call_pv #endif #ifndef call_argv # define call_argv perl_call_argv #endif #ifndef call_method # define call_method perl_call_method #endif #ifndef eval_sv # define eval_sv perl_eval_sv #endif /* Replace: 0 */ /* Replace perl_eval_pv with eval_pv */ /* eval_pv depends on eval_sv */ #ifndef eval_pv #if defined(NEED_eval_pv) static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); static #else extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); #endif #ifdef eval_pv # undef eval_pv #endif #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) #define Perl_eval_pv DPPP_(my_eval_pv) #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error) { dSP; SV* sv = newSVpv(p, 0); PUSHMARK(sp); eval_sv(sv, G_SCALAR); SvREFCNT_dec(sv); SPAGAIN; sv = POPs; PUTBACK; if (croak_on_error && SvTRUE(GvSV(errgv))) croak(SvPVx(GvSV(errgv), na)); return sv; } #endif #endif #ifndef newRV_inc # define newRV_inc(sv) newRV(sv) /* Replace */ #endif #ifndef newRV_noinc #if defined(NEED_newRV_noinc) static SV * DPPP_(my_newRV_noinc)(SV *sv); static #else extern SV * DPPP_(my_newRV_noinc)(SV *sv); #endif #ifdef newRV_noinc # undef newRV_noinc #endif #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) #define Perl_newRV_noinc DPPP_(my_newRV_noinc) #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) SV * DPPP_(my_newRV_noinc)(SV *sv) { SV *rv = (SV *)newRV(sv); SvREFCNT_dec(sv); return rv; } #endif #endif /* Hint: newCONSTSUB * Returns a CV* as of perl-5.7.1. This return value is not supported * by Devel::PPPort. */ /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))) && ((PERL_VERSION != 4) || (PERL_SUBVERSION != 5)) #if defined(NEED_newCONSTSUB) static void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); static #else extern void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); #endif #ifdef newCONSTSUB # undef newCONSTSUB #endif #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv) { U32 oldhints = PL_hints; HV *old_cop_stash = PL_curcop->cop_stash; HV *old_curstash = PL_curstash; line_t oldline = PL_curcop->cop_line; PL_curcop->cop_line = PL_copline; PL_hints &= ~HINT_BLOCK_SCOPE; if (stash) PL_curstash = PL_curcop->cop_stash = stash; newSUB( #if ((PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))) start_subparse(), #elif ((PERL_VERSION == 3) && (PERL_SUBVERSION == 22)) start_subparse(0), #else /* 5.003_23 onwards */ start_subparse(FALSE, 0), #endif newSVOP(OP_CONST, 0, newSVpv(name,0)), newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ); PL_hints = oldhints; PL_curcop->cop_stash = old_cop_stash; PL_curstash = old_curstash; PL_curcop->cop_line = oldline; } #endif #endif /* * Boilerplate macros for initializing and accessing interpreter-local * data from C. All statics in extensions should be reworked to use * this, if you want to make the extension thread-safe. See ext/re/re.xs * for an example of the use of these macros. * * Code that uses these macros is responsible for the following: * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" * 2. Declare a typedef named my_cxt_t that is a structure that contains * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. * 4. Use the MY_CXT_INIT macro such that it is called exactly once * (typically put in the BOOT: section). * 5. Use the members of the my_cxt_t structure everywhere as * MY_CXT.member. * 6. Use the dMY_CXT macro (a declaration) in all the functions that * access MY_CXT. */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) #ifndef START_MY_CXT /* This must appear in all extensions that define a my_cxt_t structure, * right after the definition (i.e. at file scope). The non-threads * case below uses it to declare the data as static. */ #define START_MY_CXT #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 68))) /* Fetches the SV that keeps the per-interpreter data. */ #define dMY_CXT_SV \ SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) #else /* >= perl5.004_68 */ #define dMY_CXT_SV \ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ sizeof(MY_CXT_KEY)-1, TRUE) #endif /* < perl5.004_68 */ /* This declaration should be used within all functions that use the * interpreter-local data. */ #define dMY_CXT \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) /* Creates and zeroes the per-interpreter data. * (We allocate my_cxtp in a Perl SV so that it will be released when * the interpreter goes away.) */ #define MY_CXT_INIT \ dMY_CXT_SV; \ /* newSV() allocates one more than needed */ \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Zero(my_cxtp, 1, my_cxt_t); \ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) /* This macro must be used to access members of the my_cxt_t structure. * e.g. MYCXT.some_data */ #define MY_CXT (*my_cxtp) /* Judicious use of these macros can reduce the number of times dMY_CXT * is used. Use is similar to pTHX, aTHX etc. */ #define pMY_CXT my_cxt_t *my_cxtp #define pMY_CXT_ pMY_CXT, #define _pMY_CXT ,pMY_CXT #define aMY_CXT my_cxtp #define aMY_CXT_ aMY_CXT, #define _aMY_CXT ,aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE /* Clones the per-interpreter data. */ #define MY_CXT_CLONE \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) #endif #else /* single interpreter */ #ifndef START_MY_CXT #define START_MY_CXT static my_cxt_t my_cxt; #define dMY_CXT_SV dNOOP #define dMY_CXT dNOOP #define MY_CXT_INIT NOOP #define MY_CXT my_cxt #define pMY_CXT void #define pMY_CXT_ #define _pMY_CXT #define aMY_CXT #define aMY_CXT_ #define _aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE #define MY_CXT_CLONE NOOP #endif #endif #ifndef IVdf # if IVSIZE == LONGSIZE # define IVdf "ld" # define UVuf "lu" # define UVof "lo" # define UVxf "lx" # define UVXf "lX" # else # if IVSIZE == INTSIZE # define IVdf "d" # define UVuf "u" # define UVof "o" # define UVxf "x" # define UVXf "X" # endif # endif #endif #ifndef NVef # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ # define NVef PERL_PRIeldbl # define NVff PERL_PRIfldbl # define NVgf PERL_PRIgldbl # else # define NVef "e" # define NVff "f" # define NVgf "g" # endif #endif #ifndef SvPV_nolen #if defined(NEED_sv_2pv_nolen) static char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); static #else extern char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); #endif #ifdef sv_2pv_nolen # undef sv_2pv_nolen #endif #define sv_2pv_nolen(a) DPPP_(my_sv_2pv_nolen)(aTHX_ a) #define Perl_sv_2pv_nolen DPPP_(my_sv_2pv_nolen) #if defined(NEED_sv_2pv_nolen) || defined(NEED_sv_2pv_nolen_GLOBAL) char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv) { STRLEN n_a; return sv_2pv(sv, &n_a); } #endif /* Hint: sv_2pv_nolen * Use the SvPV_nolen() macro instead of sv_2pv_nolen(). */ /* SvPV_nolen depends on sv_2pv_nolen */ #define SvPV_nolen(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX(sv) : sv_2pv_nolen(sv)) #endif #ifdef SvPVbyte /* Hint: SvPVbyte * Does not work in perl-5.6.1, ppport.h implements a version * borrowed from perl-5.7.3. */ #if ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 0))) #if defined(NEED_sv_2pvbyte) static char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); static #else extern char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); #endif #ifdef sv_2pvbyte # undef sv_2pvbyte #endif #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp) { sv_utf8_downgrade(sv,0); return SvPV(sv,*lp); } #endif /* Hint: sv_2pvbyte * Use the SvPVbyte() macro instead of sv_2pvbyte(). */ #undef SvPVbyte /* SvPVbyte depends on sv_2pvbyte */ #define SvPVbyte(sv, lp) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) #endif #else # define SvPVbyte SvPV # define sv_2pvbyte sv_2pv #endif /* sv_2pvbyte_nolen depends on sv_2pv_nolen */ #ifndef sv_2pvbyte_nolen # define sv_2pvbyte_nolen sv_2pv_nolen #endif /* Hint: sv_pvn * Always use the SvPV() macro instead of sv_pvn(). */ #ifndef sv_pvn # define sv_pvn(sv, len) SvPV(sv, len) #endif /* Hint: sv_pvn_force * Always use the SvPV_force() macro instead of sv_pvn_force(). */ #ifndef sv_pvn_force # define sv_pvn_force(sv, len) SvPV_force(sv, len) #endif #ifndef SvMAGIC_set # define SvMAGIC_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END #endif #if ((PERL_VERSION < 9) || ((PERL_VERSION == 9) && (PERL_SUBVERSION < 3))) #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) (0 + SvPVX(sv)) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END #endif #else #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ((sv)->sv_u.svu_rv = (val)); } STMT_END #endif #endif #ifndef SvSTASH_set # define SvSTASH_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END #endif #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 0))) #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END #endif #else #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END #endif #endif #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(vnewSVpvf) #if defined(NEED_vnewSVpvf) static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); static #else extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); #endif #ifdef vnewSVpvf # undef vnewSVpvf #endif #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) { register SV *sv = newSV(0); sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); return sv; } #endif #endif /* sv_vcatpvf depends on sv_vcatpvfn */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf) # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif /* sv_vsetpvf depends on sv_vsetpvfn */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf) # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif /* sv_catpvf_mg depends on sv_vcatpvfn, sv_catpvf_mg_nocontext */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg) #if defined(NEED_sv_catpvf_mg) static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); #endif #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) { va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif /* sv_catpvf_mg_nocontext depends on sv_vcatpvfn */ #ifdef PERL_IMPLICIT_CONTEXT #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg_nocontext) #if defined(NEED_sv_catpvf_mg_nocontext) static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); #endif #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif #ifndef sv_catpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext # else # define sv_catpvf_mg Perl_sv_catpvf_mg # endif #endif /* sv_vcatpvf_mg depends on sv_vcatpvfn */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf_mg) # define sv_vcatpvf_mg(sv, pat, args) \ STMT_START { \ sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif /* sv_setpvf_mg depends on sv_vsetpvfn, sv_setpvf_mg_nocontext */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg) #if defined(NEED_sv_setpvf_mg) static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); #endif #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) { va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif /* sv_setpvf_mg_nocontext depends on sv_vsetpvfn */ #ifdef PERL_IMPLICIT_CONTEXT #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg_nocontext) #if defined(NEED_sv_setpvf_mg_nocontext) static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); #endif #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif #ifndef sv_setpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext # else # define sv_setpvf_mg Perl_sv_setpvf_mg # endif #endif /* sv_vsetpvf_mg depends on sv_vsetpvfn */ #if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf_mg) # define sv_vsetpvf_mg(sv, pat, args) \ STMT_START { \ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif #ifndef SvGETMAGIC # define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END #endif #ifndef PERL_MAGIC_sv # define PERL_MAGIC_sv '\0' #endif #ifndef PERL_MAGIC_overload # define PERL_MAGIC_overload 'A' #endif #ifndef PERL_MAGIC_overload_elem # define PERL_MAGIC_overload_elem 'a' #endif #ifndef PERL_MAGIC_overload_table # define PERL_MAGIC_overload_table 'c' #endif #ifndef PERL_MAGIC_bm # define PERL_MAGIC_bm 'B' #endif #ifndef PERL_MAGIC_regdata # define PERL_MAGIC_regdata 'D' #endif #ifndef PERL_MAGIC_regdatum # define PERL_MAGIC_regdatum 'd' #endif #ifndef PERL_MAGIC_env # define PERL_MAGIC_env 'E' #endif #ifndef PERL_MAGIC_envelem # define PERL_MAGIC_envelem 'e' #endif #ifndef PERL_MAGIC_fm # define PERL_MAGIC_fm 'f' #endif #ifndef PERL_MAGIC_regex_global # define PERL_MAGIC_regex_global 'g' #endif #ifndef PERL_MAGIC_isa # define PERL_MAGIC_isa 'I' #endif #ifndef PERL_MAGIC_isaelem # define PERL_MAGIC_isaelem 'i' #endif #ifndef PERL_MAGIC_nkeys # define PERL_MAGIC_nkeys 'k' #endif #ifndef PERL_MAGIC_dbfile # define PERL_MAGIC_dbfile 'L' #endif #ifndef PERL_MAGIC_dbline # define PERL_MAGIC_dbline 'l' #endif #ifndef PERL_MAGIC_mutex # define PERL_MAGIC_mutex 'm' #endif #ifndef PERL_MAGIC_shared # define PERL_MAGIC_shared 'N' #endif #ifndef PERL_MAGIC_shared_scalar # define PERL_MAGIC_shared_scalar 'n' #endif #ifndef PERL_MAGIC_collxfrm # define PERL_MAGIC_collxfrm 'o' #endif #ifndef PERL_MAGIC_tied # define PERL_MAGIC_tied 'P' #endif #ifndef PERL_MAGIC_tiedelem # define PERL_MAGIC_tiedelem 'p' #endif #ifndef PERL_MAGIC_tiedscalar # define PERL_MAGIC_tiedscalar 'q' #endif #ifndef PERL_MAGIC_qr # define PERL_MAGIC_qr 'r' #endif #ifndef PERL_MAGIC_sig # define PERL_MAGIC_sig 'S' #endif #ifndef PERL_MAGIC_sigelem # define PERL_MAGIC_sigelem 's' #endif #ifndef PERL_MAGIC_taint # define PERL_MAGIC_taint 't' #endif #ifndef PERL_MAGIC_uvar # define PERL_MAGIC_uvar 'U' #endif #ifndef PERL_MAGIC_uvar_elem # define PERL_MAGIC_uvar_elem 'u' #endif #ifndef PERL_MAGIC_vstring # define PERL_MAGIC_vstring 'V' #endif #ifndef PERL_MAGIC_vec # define PERL_MAGIC_vec 'v' #endif #ifndef PERL_MAGIC_utf8 # define PERL_MAGIC_utf8 'w' #endif #ifndef PERL_MAGIC_substr # define PERL_MAGIC_substr 'x' #endif #ifndef PERL_MAGIC_defelem # define PERL_MAGIC_defelem 'y' #endif #ifndef PERL_MAGIC_glob # define PERL_MAGIC_glob '*' #endif #ifndef PERL_MAGIC_arylen # define PERL_MAGIC_arylen '#' #endif #ifndef PERL_MAGIC_pos # define PERL_MAGIC_pos '.' #endif #ifndef PERL_MAGIC_backref # define PERL_MAGIC_backref '<' #endif #ifndef PERL_MAGIC_ext # define PERL_MAGIC_ext '~' #endif /* That's the best we can do... */ #ifndef SvPV_force_nomg # define SvPV_force_nomg SvPV_force #endif #ifndef SvPV_nomg # define SvPV_nomg SvPV #endif #ifndef sv_catpvn_nomg # define sv_catpvn_nomg sv_catpvn #endif #ifndef sv_catsv_nomg # define sv_catsv_nomg sv_catsv #endif #ifndef sv_setsv_nomg # define sv_setsv_nomg sv_setsv #endif #ifndef sv_pvn_nomg # define sv_pvn_nomg sv_pvn #endif #ifndef SvIV_nomg # define SvIV_nomg SvIV #endif #ifndef SvUV_nomg # define SvUV_nomg SvUV #endif #ifndef sv_catpv_mg # define sv_catpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catpvn_mg # define sv_catpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catsv_mg # define sv_catsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_catsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setiv_mg # define sv_setiv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setiv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setnv_mg # define sv_setnv_mg(sv, num) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setnv(TeMpSv,num); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpv_mg # define sv_setpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpvn_mg # define sv_setpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setsv_mg # define sv_setsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_setsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setuv_mg # define sv_setuv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setuv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_usepvn_mg # define sv_usepvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_usepvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifdef USE_ITHREADS #ifndef CopFILE # define CopFILE(c) ((c)->cop_file) #endif #ifndef CopFILEGV # define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) ((c)->cop_stashpv) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) #endif #ifndef CopSTASH # define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ || (CopSTASHPV(c) && HvNAME(hv) \ && strEQ(CopSTASHPV(c), HvNAME(hv))))) #endif #else #ifndef CopFILEGV # define CopFILEGV(c) ((c)->cop_filegv) #endif #ifndef CopFILEGV_set # define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) #endif #ifndef CopFILE # define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) #endif #ifndef CopSTASH # define CopSTASH(c) ((c)->cop_stash) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) #endif #endif /* USE_ITHREADS */ #ifndef IN_PERL_COMPILETIME # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) #endif #ifndef IN_LOCALE_RUNTIME # define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) #endif #ifndef IN_LOCALE_COMPILETIME # define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) #endif #ifndef IN_LOCALE # define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) #endif #ifndef IS_NUMBER_IN_UV # define IS_NUMBER_IN_UV 0x01 #endif #ifndef IS_NUMBER_GREATER_THAN_UV_MAX # define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 #endif #ifndef IS_NUMBER_NOT_INT # define IS_NUMBER_NOT_INT 0x04 #endif #ifndef IS_NUMBER_NEG # define IS_NUMBER_NEG 0x08 #endif #ifndef IS_NUMBER_INFINITY # define IS_NUMBER_INFINITY 0x10 #endif #ifndef IS_NUMBER_NAN # define IS_NUMBER_NAN 0x20 #endif /* GROK_NUMERIC_RADIX depends on grok_numeric_radix */ #ifndef GROK_NUMERIC_RADIX # define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) #endif #ifndef PERL_SCAN_GREATER_THAN_UV_MAX # define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 #endif #ifndef PERL_SCAN_SILENT_ILLDIGIT # define PERL_SCAN_SILENT_ILLDIGIT 0x04 #endif #ifndef PERL_SCAN_ALLOW_UNDERSCORES # define PERL_SCAN_ALLOW_UNDERSCORES 0x01 #endif #ifndef PERL_SCAN_DISALLOW_PREFIX # define PERL_SCAN_DISALLOW_PREFIX 0x02 #endif #ifndef grok_numeric_radix #if defined(NEED_grok_numeric_radix) static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); static #else extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); #endif #ifdef grok_numeric_radix # undef grok_numeric_radix #endif #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) bool DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) { #ifdef USE_LOCALE_NUMERIC #ifdef PL_numeric_radix_sv if (PL_numeric_radix_sv && IN_LOCALE) { STRLEN len; char* radix = SvPV(PL_numeric_radix_sv, len); if (*sp + len <= send && memEQ(*sp, radix, len)) { *sp += len; return TRUE; } } #else /* older perls don't have PL_numeric_radix_sv so the radix * must manually be requested from locale.h */ #include dTHR; /* needed for older threaded perls */ struct lconv *lc = localeconv(); char *radix = lc->decimal_point; if (radix && IN_LOCALE) { STRLEN len = strlen(radix); if (*sp + len <= send && memEQ(*sp, radix, len)) { *sp += len; return TRUE; } } #endif #endif /* USE_LOCALE_NUMERIC */ /* always try "." if numeric radix didn't match because * we may have data from different locales mixed */ if (*sp < send && **sp == '.') { ++*sp; return TRUE; } return FALSE; } #endif #endif /* grok_number depends on grok_numeric_radix */ #ifndef grok_number #if defined(NEED_grok_number) static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); static #else extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); #endif #ifdef grok_number # undef grok_number #endif #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) #define Perl_grok_number DPPP_(my_grok_number) #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) int DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) { const char *s = pv; const char *send = pv + len; const UV max_div_10 = UV_MAX / 10; const char max_mod_10 = UV_MAX % 10; int numtype = 0; int sawinf = 0; int sawnan = 0; while (s < send && isSPACE(*s)) s++; if (s == send) { return 0; } else if (*s == '-') { s++; numtype = IS_NUMBER_NEG; } else if (*s == '+') s++; if (s == send) return 0; /* next must be digit or the radix separator or beginning of infinity */ if (isDIGIT(*s)) { /* UVs are at least 32 bits, so the first 9 decimal digits cannot overflow. */ UV value = *s - '0'; /* This construction seems to be more optimiser friendly. (without it gcc does the isDIGIT test and the *s - '0' separately) With it gcc on arm is managing 6 instructions (6 cycles) per digit. In theory the optimiser could deduce how far to unroll the loop before checking for overflow. */ if (++s < send) { int digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { /* Now got 9 digits, so need to check each time for overflow. */ digit = *s - '0'; while (digit >= 0 && digit <= 9 && (value < max_div_10 || (value == max_div_10 && digit <= max_mod_10))) { value = value * 10 + digit; if (++s < send) digit = *s - '0'; else break; } if (digit >= 0 && digit <= 9 && (s < send)) { /* value overflowed. skip the remaining digits, don't worry about setting *valuep. */ do { s++; } while (s < send && isDIGIT(*s)); numtype |= IS_NUMBER_GREATER_THAN_UV_MAX; goto skip_value; } } } } } } } } } } } } } } } } } } numtype |= IS_NUMBER_IN_UV; if (valuep) *valuep = value; skip_value: if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT; while (s < send && isDIGIT(*s)) /* optional digits after the radix */ s++; } } else if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ /* no digits before the radix means we need digits after it */ if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); if (valuep) { /* integer approximation is valid - it's 0. */ *valuep = 0; } } else return 0; } else if (*s == 'I' || *s == 'i') { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; s++; if (s < send && (*s == 'I' || *s == 'i')) { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; s++; if (s == send || (*s != 'T' && *s != 't')) return 0; s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; s++; } sawinf = 1; } else if (*s == 'N' || *s == 'n') { /* XXX TODO: There are signaling NaNs and quiet NaNs. */ s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; sawnan = 1; } else return 0; if (sawinf) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; } else if (sawnan) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; } else if (s < send) { /* we can have an optional exponent part */ if (*s == 'e' || *s == 'E') { /* The only flag we keep is sign. Blow away any "it's UV" */ numtype &= IS_NUMBER_NEG; numtype |= IS_NUMBER_NOT_INT; s++; if (s < send && (*s == '-' || *s == '+')) s++; if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); } else return 0; } } while (s < send && isSPACE(*s)) s++; if (s >= send) return numtype; if (len == 10 && memEQ(pv, "0 but true", 10)) { if (valuep) *valuep = 0; return IS_NUMBER_IN_UV; } return 0; } #endif #endif /* * The grok_* routines have been modified to use warn() instead of * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, * which is why the stack variable has been renamed to 'xdigit'. */ #ifndef grok_bin #if defined(NEED_grok_bin) static UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); static #else extern UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); #endif #ifdef grok_bin # undef grok_bin #endif #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) #define Perl_grok_bin DPPP_(my_grok_bin) #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading b or 0b. for compatibility silently suffer "b" and "0b" as valid binary numbers. */ if (len >= 1) { if (s[0] == 'b') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'b') { s+=2; len-=2; } } } for (; len-- && *s; s++) { char bit = *s; if (bit == '0' || bit == '1') { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_bin. */ redo: if (!overflowed) { if (value <= max_div_2) { value = (value << 1) | (bit - '0'); continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in binary number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 2.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount. */ value_nv += (NV)(bit - '0'); continue; } if (bit == '_' && len && allow_underscores && (bit = s[1]) && (bit == '0' || bit == '1')) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal binary digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Binary number > 0b11111111111111111111111111111111 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_hex #if defined(NEED_grok_hex) static UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); static #else extern UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); #endif #ifdef grok_hex # undef grok_hex #endif #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) #define Perl_grok_hex DPPP_(my_grok_hex) #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; const char *xdigit; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading x or 0x. for compatibility silently suffer "x" and "0x" as valid hex numbers. */ if (len >= 1) { if (s[0] == 'x') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'x') { s+=2; len-=2; } } } for (; len-- && *s; s++) { xdigit = strchr((char *) PL_hexdigit, *s); if (xdigit) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_hex. */ redo: if (!overflowed) { if (value <= max_div_16) { value = (value << 4) | ((xdigit - PL_hexdigit) & 15); continue; } warn("Integer overflow in hexadecimal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 16.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 16-tuples. */ value_nv += (NV)((xdigit - PL_hexdigit) & 15); continue; } if (*s == '_' && len && allow_underscores && s[1] && (xdigit = strchr((char *) PL_hexdigit, s[1]))) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal hexadecimal digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Hexadecimal number > 0xffffffff non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_oct #if defined(NEED_grok_oct) static UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); static #else extern UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); #endif #ifdef grok_oct # undef grok_oct #endif #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) #define Perl_grok_oct DPPP_(my_grok_oct) #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; for (; len-- && *s; s++) { /* gcc 2.95 optimiser not smart enough to figure that this subtraction out front allows slicker code. */ int digit = *s - '0'; if (digit >= 0 && digit <= 7) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. */ redo: if (!overflowed) { if (value <= max_div_8) { value = (value << 3) | digit; continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in octal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 8.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 8-tuples. */ value_nv += (NV)digit; continue; } if (digit == ('_' - '0') && len && allow_underscores && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) { --len; ++s; goto redo; } /* Allow \octal to work the DWIM way (that is, stop scanning * as soon as non-octal characters are seen, complain only iff * someone seems to want to use the digits eight and nine). */ if (digit == 8 || digit == 9) { if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal octal digit '%c' ignored", *s); } break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Octal number > 037777777777 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifdef NO_XSLOCKS # ifdef dJMPENV # define dXCPT dJMPENV; int rEtV = 0 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) # define XCPT_TRY_END JMPENV_POP; # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW JMPENV_JUMP(rEtV) # else # define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 # define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) # define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW Siglongjmp(top_env, rEtV) # endif #endif #endif /* _P_P_PORTABILITY_H_ */ /* End of File ppport.h */ Sys-Syslog-0.33/README000644 000765 000765 00000003027 12012477651 016330 0ustar00maddinguemaddingue000000 000000 NAME Sys::Syslog - Perl interface to the UNIX syslog(3) calls DESCRIPTION Sys::Syslog is an interface to the UNIX syslog(3) program. Call syslog() with a string priority and a list of printf() args just like syslog(3). INSTALLATION To install this module, run the following commands: $ perl Makefile.PL $ make $ make test $ make install An ANSI-compliant compiler is required to compile the extension. Sys::Syslog should work on any Perl since 5.6.0. This module is regularly compiled and tested by the CPAN Testers on various combinations of Perl and operating systems. See also the corresponding CPAN Testers page: http://testers.cpan.org/show/Sys-Syslog.html SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Sys::Syslog You can also look for information at: Search CPAN http://search.cpan.org/dist/Sys-Syslog/ MetaCPAN https://metacpan.org/module/Sys::Syslog CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Syslog AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/Sys-Syslog CPAN Ratings: http://cpanratings.perl.org/d/Sys-Syslog COPYRIGHT AND LICENCE Copyright (C) 1990-2012 by Larry Wall and others. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Sys-Syslog-0.33/README.win32000644 000765 000765 00000002400 12013761665 017265 0ustar00maddinguemaddingue000000 000000 NAME README.win32 - Customise and build Sys::Syslog with Win32 EventLog support DESCRIPTION This package includes support for the Win32 Event log. This requires building a message file and then compiling it and linking it into the final .DLL produced by MakeMaker. The default message text file used by Sys::Syslog is PerlLog.mc, located in the win32/ subdirectory. If the message file is updated then you need to go in the win32/ subdirectory and run the "compile.pl" command to update the relevant files. Note that Sys::Syslog::Win32 is built by this process. The following files are in the win32 directory: PerlLog.mc -- Message file, change this if you change anything. compile.pl -- Compile the message file and produce Win32.pm and PerlLog.RES. Requires that mc.exe and rc.exe are in the path. PerlLog.RES -- Precompiled resource file, used when building the DLL Win32.pm -- Generated Win32 module for working with the resource file When building win32/PerlLog.RES will be linked into the final XS file, and win32/Win32.pm will be copied to lib/Sys/Syslog/Win32.pm, which will then be installed by MakeMaker as per normal. Sys-Syslog-0.33/Syslog.pm000644 000765 000120 00000132450 12147527730 016410 0ustar00maddingueadmin000000 000000 package Sys::Syslog; use strict; use warnings; use warnings::register; use Carp; use Exporter qw< import >; use File::Basename; use POSIX qw< strftime setlocale LC_TIME >; use Socket qw< :all >; require 5.005; { no strict 'vars'; $VERSION = '0.33'; %EXPORT_TAGS = ( standard => [qw(openlog syslog closelog setlogmask)], extended => [qw(setlogsock)], macros => [ # levels qw( LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR LOG_INFO LOG_NOTICE LOG_WARNING ), # standard facilities qw( LOG_AUTH LOG_AUTHPRIV LOG_CRON LOG_DAEMON LOG_FTP LOG_KERN LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NEWS LOG_SYSLOG LOG_USER LOG_UUCP ), # Mac OS X specific facilities qw( LOG_INSTALL LOG_LAUNCHD LOG_NETINFO LOG_RAS LOG_REMOTEAUTH ), # modern BSD specific facilities qw( LOG_CONSOLE LOG_NTP LOG_SECURITY ), # IRIX specific facilities qw( LOG_AUDIT LOG_LFMT ), # options qw( LOG_CONS LOG_PID LOG_NDELAY LOG_NOWAIT LOG_ODELAY LOG_PERROR ), # others macros qw( LOG_FACMASK LOG_NFACILITIES LOG_PRIMASK LOG_MASK LOG_UPTO ), ], ); @EXPORT = ( @{$EXPORT_TAGS{standard}}, ); @EXPORT_OK = ( @{$EXPORT_TAGS{extended}}, @{$EXPORT_TAGS{macros}}, ); eval { require XSLoader; XSLoader::load('Sys::Syslog', $VERSION); 1 } or do { require DynaLoader; push @ISA, 'DynaLoader'; bootstrap Sys::Syslog $VERSION; }; } # # Public variables # use vars qw($host); # host to send syslog messages to (see notes at end) # # Prototypes # sub silent_eval (&); # # Global variables # use vars qw($facility); my $connected = 0; # flag to indicate if we're connected or not my $syslog_send; # coderef of the function used to send messages my $syslog_path = undef; # syslog path for "stream" and "unix" mechanisms my $syslog_xobj = undef; # if defined, holds the external object used to send messages my $transmit_ok = 0; # flag to indicate if the last message was transmitted my $sock_port = undef; # socket port my $sock_timeout = 0; # socket timeout, see below my $current_proto = undef; # current mechanism used to transmit messages my $ident = ''; # identifiant prepended to each message $facility = ''; # current facility my $maskpri = LOG_UPTO(&LOG_DEBUG); # current log mask my %options = ( ndelay => 0, noeol => 0, nofatal => 0, nonul => 0, nowait => 0, perror => 0, pid => 0, ); # Default is now to first use the native mechanism, so Perl programs # behave like other normal Unix programs, then try other mechanisms. my @connectMethods = qw(native tcp udp unix pipe stream console); if ($^O eq "freebsd" or $^O eq "linux") { @connectMethods = grep { $_ ne 'udp' } @connectMethods; } # And on Win32 systems, we try to use the native mechanism for this # platform, the events logger, available through Win32::EventLog. EVENTLOG: { my $is_Win32 = $^O =~ /Win32/i; if (can_load("Sys::Syslog::Win32", $is_Win32)) { unshift @connectMethods, 'eventlog'; } } my @defaultMethods = @connectMethods; my @fallbackMethods = (); # The timeout in connection_ok() was pushed up to 0.25 sec in # Sys::Syslog v0.19 in order to address a heisenbug on MacOSX: # http://london.pm.org/pipermail/london.pm/Week-of-Mon-20061211/005961.html # # However, this also had the effect of slowing this test for # all other operating systems, which apparently impacted some # users (cf. CPAN-RT #34753). So, in order to make everybody # happy, the timeout is now zero by default on all systems # except on OSX where it is set to 250 msec, and can be set # with the infamous setlogsock() function. # # Update 2011-08: this issue is also been seen on multiprocessor # Debian GNU/kFreeBSD systems. See http://bugs.debian.org/627821 # and https://rt.cpan.org/Ticket/Display.html?id=69997 # Also, lowering the delay to 1 ms, which should be enough. $sock_timeout = 0.001 if $^O =~ /darwin|gnukfreebsd/; # Perl 5.6.0's warnings.pm doesn't have warnings::warnif() if (not defined &warnings::warnif) { *warnings::warnif = sub { goto &warnings::warn if warnings::enabled(__PACKAGE__) } } # coderef for a nicer handling of errors my $err_sub = $options{nofatal} ? \&warnings::warnif : \&croak; sub AUTOLOAD { # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. no strict 'vars'; my $constname; ($constname = $AUTOLOAD) =~ s/.*:://; croak "Sys::Syslog::constant() not defined" if $constname eq 'constant'; my ($error, $val) = constant($constname); croak $error if $error; no strict 'refs'; *$AUTOLOAD = sub { $val }; goto &$AUTOLOAD; } sub openlog { ($ident, my $logopt, $facility) = @_; # default values $ident ||= basename($0) || getlogin() || getpwuid($<) || 'syslog'; $logopt ||= ''; $facility ||= LOG_USER(); for my $opt (split /\b/, $logopt) { $options{$opt} = 1 if exists $options{$opt} } $err_sub = delete $options{nofatal} ? \&warnings::warnif : \&croak; return 1 unless $options{ndelay}; connect_log(); } sub closelog { disconnect_log() if $connected; $options{$_} = 0 for keys %options; $facility = $ident = ""; $connected = 0; return 1 } sub setlogmask { my $oldmask = $maskpri; $maskpri = shift unless $_[0] == 0; $oldmask; } my %mechanism = ( console => { check => sub { 1 }, }, eventlog => { check => sub { return can_load("Win32::EventLog") }, err_msg => "no Win32 API available", }, inet => { check => sub { 1 }, }, native => { check => sub { 1 }, }, pipe => { check => sub { ($syslog_path) = grep { defined && length && -p && -w _ } $syslog_path, &_PATH_LOG, "/dev/log"; return $syslog_path ? 1 : 0 }, err_msg => "path not available", }, stream => { check => sub { if (not defined $syslog_path) { my @try = qw(/dev/log /dev/conslog); unshift @try, &_PATH_LOG if length &_PATH_LOG; ($syslog_path) = grep { -w } @try; } return defined $syslog_path && -w $syslog_path }, err_msg => "could not find any writable device", }, tcp => { check => sub { return 1 if defined $sock_port; if (getservbyname('syslog', 'tcp') || getservbyname('syslogng', 'tcp')) { $host = $syslog_path; return 1 } else { return } }, err_msg => "TCP service unavailable", }, udp => { check => sub { return 1 if defined $sock_port; if (getservbyname('syslog', 'udp')) { $host = $syslog_path; return 1 } else { return } }, err_msg => "UDP service unavailable", }, unix => { check => sub { my @try = ($syslog_path, &_PATH_LOG); ($syslog_path) = grep { defined && length && -w } @try; return defined $syslog_path && -w $syslog_path }, err_msg => "path not available", }, ); sub setlogsock { my %opt; # handle arguments # - old API: setlogsock($sock_type, $sock_path, $sock_timeout) # - new API: setlogsock(\%options) croak "setlogsock(): Invalid number of arguments" unless @_ >= 1 and @_ <= 3; if (my $ref = ref $_[0]) { if ($ref eq "HASH") { %opt = %{ $_[0] }; croak "setlogsock(): No argument given" unless keys %opt; } elsif ($ref eq "ARRAY") { @opt{qw< type path timeout >} = @_; } else { croak "setlogsock(): Unexpected \L$ref\E reference" } } else { @opt{qw< type path timeout >} = @_; } # check socket type, remove invalid ones my $diag_invalid_type = "setlogsock(): Invalid type%s; must be one of " . join ", ", map { "'$_'" } sort keys %mechanism; croak sprintf $diag_invalid_type, "" unless defined $opt{type}; my @sock_types = ref $opt{type} eq "ARRAY" ? @{$opt{type}} : ($opt{type}); my @tmp; for my $sock_type (@sock_types) { carp sprintf $diag_invalid_type, " '$sock_type'" and next unless exists $mechanism{$sock_type}; push @tmp, "tcp", "udp" and next if $sock_type eq "inet"; push @tmp, $sock_type; } @sock_types = @tmp; # set global options $syslog_path = $opt{path} if defined $opt{path}; $host = $opt{host} if defined $opt{host}; $sock_timeout = $opt{timeout} if defined $opt{timeout}; $sock_port = $opt{port} if defined $opt{port}; disconnect_log() if $connected; $transmit_ok = 0; @fallbackMethods = (); @connectMethods = (); my $found = 0; # check each given mechanism and test if it can be used on the current system for my $sock_type (@sock_types) { if ( $mechanism{$sock_type}{check}->() ) { push @connectMethods, $sock_type; $found = 1; } else { warnings::warnif("setlogsock(): type='$sock_type': " . $mechanism{$sock_type}{err_msg}); } } # if no mechanism worked from the given ones, use the default ones @connectMethods = @defaultMethods unless @connectMethods; return $found; } sub syslog { my ($priority, $mask, @args) = @_; my ($message, $buf); my (@words, $num, $numpri, $numfac, $sum); my $failed = undef; my $fail_time = undef; my $error = $!; # if $ident is undefined, it means openlog() wasn't previously called # so do it now in order to have sensible defaults openlog() unless $ident; local $facility = $facility; # may need to change temporarily. croak "syslog: expecting argument \$priority" unless defined $priority; croak "syslog: expecting argument \$format" unless defined $mask; if ($priority =~ /^\d+$/) { $numpri = LOG_PRI($priority); $numfac = LOG_FAC($priority) << 3; } elsif ($priority =~ /^\w+/) { # Allow "level" or "level|facility". @words = split /\W+/, $priority, 2; undef $numpri; undef $numfac; for my $word (@words) { next if length $word == 0; # Translate word to number. $num = xlate($word); if ($num < 0) { croak "syslog: invalid level/facility: $word" } elsif ($num <= LOG_PRIMASK() and $word ne "kern") { croak "syslog: too many levels given: $word" if defined $numpri; $numpri = $num; } else { croak "syslog: too many facilities given: $word" if defined $numfac; $facility = $word if $word =~ /^[A-Za-z]/; $numfac = $num; } } } else { croak "syslog: invalid level/facility: $priority" } croak "syslog: level must be given" unless defined $numpri; # don't log if priority is below mask level return 0 unless LOG_MASK($numpri) & $maskpri; if (not defined $numfac) { # Facility not specified in this call. $facility = 'user' unless $facility; $numfac = xlate($facility); } connect_log() unless $connected; if ($mask =~ /%m/) { # escape percent signs for sprintf() $error =~ s/%/%%/g if @args; # replace %m with $error, if preceded by an even number of percent signs $mask =~ s/(?$timestamp $whoami: $message"; # add (or not) a newline $buf .= "\n" if !$options{noeol} and rindex($buf, "\n") == -1; # add (or not) a NUL character $buf .= "\0" if !$options{nonul}; } # handle PERROR option # "native" mechanism already handles it by itself if ($options{perror} and $current_proto ne 'native') { my $whoami = $ident; $whoami .= "[$$]" if $options{pid}; print STDERR "$whoami: $message\n"; } # it's possible that we'll get an error from sending # (e.g. if method is UDP and there is no UDP listener, # then we'll get ECONNREFUSED on the send). So what we # want to do at this point is to fallback onto a different # connection method. while (scalar @fallbackMethods || $syslog_send) { if ($failed && (time - $fail_time) > 60) { # it's been a while... maybe things have been fixed @fallbackMethods = (); disconnect_log(); $transmit_ok = 0; # make it look like a fresh attempt connect_log(); } if ($connected && !connection_ok()) { # Something was OK, but has now broken. Remember coz we'll # want to go back to what used to be OK. $failed = $current_proto unless $failed; $fail_time = time; disconnect_log(); } connect_log() unless $connected; $failed = undef if ($current_proto && $failed && $current_proto eq $failed); if ($syslog_send) { if ($syslog_send->($buf, $numpri, $numfac)) { $transmit_ok++; return 1; } # typically doesn't happen, since errors are rare from write(). disconnect_log(); } } # could not send, could not fallback onto a working # connection method. Lose. return 0; } sub _syslog_send_console { my ($buf) = @_; # The console print is a method which could block # so we do it in a child process and always return success # to the caller. if (my $pid = fork) { if ($options{nowait}) { return 1; } else { if (waitpid($pid, 0) >= 0) { return ($? >> 8); } else { # it's possible that the caller has other # plans for SIGCHLD, so let's not interfere return 1; } } } else { if (open(CONS, ">/dev/console")) { my $ret = print CONS $buf . "\r"; # XXX: should this be \x0A ? POSIX::_exit($ret) if defined $pid; close CONS; } POSIX::_exit(0) if defined $pid; } } sub _syslog_send_stream { my ($buf) = @_; # XXX: this only works if the OS stream implementation makes a write # look like a putmsg() with simple header. For instance it works on # Solaris 8 but not Solaris 7. # To be correct, it should use a STREAMS API, but perl doesn't have one. return syswrite(SYSLOG, $buf, length($buf)); } sub _syslog_send_pipe { my ($buf) = @_; return print SYSLOG $buf; } sub _syslog_send_socket { my ($buf) = @_; return syswrite(SYSLOG, $buf, length($buf)); #return send(SYSLOG, $buf, 0); } sub _syslog_send_native { my ($buf, $numpri, $numfac) = @_; syslog_xs($numpri|$numfac, $buf); return 1; } # xlate() # ----- # private function to translate names to numeric values # sub xlate { my ($name) = @_; return $name+0 if $name =~ /^\s*\d+\s*$/; $name = uc $name; $name = "LOG_$name" unless $name =~ /^LOG_/; # ExtUtils::Constant 0.20 introduced a new way to implement # constants, called ProxySubs. When it was used to generate # the C code, the constant() function no longer returns the # correct value. Therefore, we first try a direct call to # constant(), and if the value is an error we try to call the # constant by its full name. my $value = constant($name); if (index($value, "not a valid") >= 0) { $name = "Sys::Syslog::$name"; $value = eval { no strict "refs"; &$name }; $value = $@ unless defined $value; } $value = -1 if index($value, "not a valid") >= 0; return defined $value ? $value : -1; } # connect_log() # ----------- # This function acts as a kind of front-end: it tries to connect to # a syslog service using the selected methods, trying each one in the # selected order. # sub connect_log { @fallbackMethods = @connectMethods unless scalar @fallbackMethods; if ($transmit_ok && $current_proto) { # Retry what we were on, because it has worked in the past. unshift(@fallbackMethods, $current_proto); } $connected = 0; my @errs = (); my $proto = undef; while ($proto = shift @fallbackMethods) { no strict 'refs'; my $fn = "connect_$proto"; $connected = &$fn(\@errs) if defined &$fn; last if $connected; } $transmit_ok = 0; if ($connected) { $current_proto = $proto; my ($old) = select(SYSLOG); $| = 1; select($old); } else { @fallbackMethods = (); $err_sub->(join "\n\t- ", "no connection to syslog available", @errs); return undef; } } sub connect_tcp { my ($errs) = @_; my $proto = getprotobyname('tcp'); if (!defined $proto) { push @$errs, "getprotobyname failed for tcp"; return 0; } my $port = $sock_port || getservbyname('syslog', 'tcp'); $port = getservbyname('syslogng', 'tcp') unless defined $port; if (!defined $port) { push @$errs, "getservbyname failed for syslog/tcp and syslogng/tcp"; return 0; } my $addr; if (defined $host) { $addr = inet_aton($host); if (!$addr) { push @$errs, "can't lookup $host"; return 0; } } else { $addr = INADDR_LOOPBACK; } $addr = sockaddr_in($port, $addr); if (!socket(SYSLOG, AF_INET, SOCK_STREAM, $proto)) { push @$errs, "tcp socket: $!"; return 0; } setsockopt(SYSLOG, SOL_SOCKET, SO_KEEPALIVE, 1); if (silent_eval { IPPROTO_TCP() }) { # These constants don't exist in 5.005. They were added in 1999 setsockopt(SYSLOG, IPPROTO_TCP(), TCP_NODELAY(), 1); } if (!connect(SYSLOG, $addr)) { push @$errs, "tcp connect: $!"; return 0; } $syslog_send = \&_syslog_send_socket; return 1; } sub connect_udp { my ($errs) = @_; my $proto = getprotobyname('udp'); if (!defined $proto) { push @$errs, "getprotobyname failed for udp"; return 0; } my $port = $sock_port || getservbyname('syslog', 'udp'); if (!defined $port) { push @$errs, "getservbyname failed for syslog/udp"; return 0; } my $addr; if (defined $host) { $addr = inet_aton($host); if (!$addr) { push @$errs, "can't lookup $host"; return 0; } } else { $addr = INADDR_LOOPBACK; } $addr = sockaddr_in($port, $addr); if (!socket(SYSLOG, AF_INET, SOCK_DGRAM, $proto)) { push @$errs, "udp socket: $!"; return 0; } if (!connect(SYSLOG, $addr)) { push @$errs, "udp connect: $!"; return 0; } # We want to check that the UDP connect worked. However the only # way to do that is to send a message and see if an ICMP is returned _syslog_send_socket(""); if (!connection_ok()) { push @$errs, "udp connect: nobody listening"; return 0; } $syslog_send = \&_syslog_send_socket; return 1; } sub connect_stream { my ($errs) = @_; # might want syslog_path to be variable based on syslog.h (if only # it were in there!) $syslog_path = '/dev/conslog' unless defined $syslog_path; if (!-w $syslog_path) { push @$errs, "stream $syslog_path is not writable"; return 0; } require Fcntl; if (!sysopen(SYSLOG, $syslog_path, Fcntl::O_WRONLY(), 0400)) { push @$errs, "stream can't open $syslog_path: $!"; return 0; } $syslog_send = \&_syslog_send_stream; return 1; } sub connect_pipe { my ($errs) = @_; $syslog_path ||= &_PATH_LOG || "/dev/log"; if (not -w $syslog_path) { push @$errs, "$syslog_path is not writable"; return 0; } if (not open(SYSLOG, ">$syslog_path")) { push @$errs, "can't write to $syslog_path: $!"; return 0; } $syslog_send = \&_syslog_send_pipe; return 1; } sub connect_unix { my ($errs) = @_; $syslog_path ||= _PATH_LOG() if length _PATH_LOG(); if (not defined $syslog_path) { push @$errs, "_PATH_LOG not available in syslog.h and no user-supplied socket path"; return 0; } if (not (-S $syslog_path or -c _)) { push @$errs, "$syslog_path is not a socket"; return 0; } my $addr = sockaddr_un($syslog_path); if (!$addr) { push @$errs, "can't locate $syslog_path"; return 0; } if (!socket(SYSLOG, AF_UNIX, SOCK_STREAM, 0)) { push @$errs, "unix stream socket: $!"; return 0; } if (!connect(SYSLOG, $addr)) { if (!socket(SYSLOG, AF_UNIX, SOCK_DGRAM, 0)) { push @$errs, "unix dgram socket: $!"; return 0; } if (!connect(SYSLOG, $addr)) { push @$errs, "unix dgram connect: $!"; return 0; } } $syslog_send = \&_syslog_send_socket; return 1; } sub connect_native { my ($errs) = @_; my $logopt = 0; # reconstruct the numeric equivalent of the options for my $opt (keys %options) { $logopt += xlate($opt) if $options{$opt} } openlog_xs($ident, $logopt, xlate($facility)); $syslog_send = \&_syslog_send_native; return 1; } sub connect_eventlog { my ($errs) = @_; $syslog_xobj = Sys::Syslog::Win32::_install(); $syslog_send = \&Sys::Syslog::Win32::_syslog_send; return 1; } sub connect_console { my ($errs) = @_; if (!-w '/dev/console') { push @$errs, "console is not writable"; return 0; } $syslog_send = \&_syslog_send_console; return 1; } # To test if the connection is still good, we need to check if any # errors are present on the connection. The errors will not be raised # by a write. Instead, sockets are made readable and the next read # would cause the error to be returned. Unfortunately the syslog # 'protocol' never provides anything for us to read. But with # judicious use of select(), we can see if it would be readable... sub connection_ok { return 1 if defined $current_proto and ( $current_proto eq 'native' or $current_proto eq 'console' or $current_proto eq 'eventlog' ); my $rin = ''; vec($rin, fileno(SYSLOG), 1) = 1; my $ret = select $rin, undef, $rin, $sock_timeout; return ($ret ? 0 : 1); } sub disconnect_log { $connected = 0; $syslog_send = undef; if (defined $current_proto and $current_proto eq 'native') { closelog_xs(); unshift @fallbackMethods, $current_proto; $current_proto = undef; return 1; } elsif (defined $current_proto and $current_proto eq 'eventlog') { $syslog_xobj->Close(); unshift @fallbackMethods, $current_proto; $current_proto = undef; return 1; } return close SYSLOG; } # # Wrappers around eval() that makes sure that nobody, and I say NOBODY, # ever knows that I wanted to test if something was here or not. # It is needed because some applications are trying to be too smart, # do it wrong, and it ends up in EPIC FAIL. # Yes I'm speaking of YOU, SpamAssassin. # sub silent_eval (&) { local($SIG{__DIE__}, $SIG{__WARN__}, $@); return eval { $_[0]->() } } sub can_load { my ($module, $verbose) = @_; local($SIG{__DIE__}, $SIG{__WARN__}, $@); my $loaded = eval "use $module; 1"; warn $@ if not $loaded and $verbose; return $loaded } "Eighth Rule: read the documentation." __END__ =head1 NAME Sys::Syslog - Perl interface to the UNIX syslog(3) calls =head1 VERSION This is the documentation of version 0.33 =head1 SYNOPSIS use Sys::Syslog; # all except setlogsock() use Sys::Syslog qw(:standard :macros); # standard functions & macros openlog($ident, $logopt, $facility); # don't forget this syslog($priority, $format, @args); $oldmask = setlogmask($mask_priority); closelog(); =head1 DESCRIPTION C is an interface to the UNIX C program. Call C with a string priority and a list of C args just like C. =head1 EXPORTS C exports the following C tags: =over 4 =item * C<:standard> exports the standard C functions: openlog closelog setlogmask syslog =item * C<:extended> exports the Perl specific functions for C: setlogsock =item * C<:macros> exports the symbols corresponding to most of your C macros and the C and C functions. See L<"CONSTANTS"> for the supported constants and their meaning. =back By default, C exports the symbols from the C<:standard> tag. =head1 FUNCTIONS =over 4 =item B Opens the syslog. C<$ident> is prepended to every message. C<$logopt> contains zero or more of the options detailed below. C<$facility> specifies the part of the system to report about, for example C or C: see L<"Facilities"> for a list of well-known facilities, and your C documentation for the facilities available in your system. Check L<"SEE ALSO"> for useful links. Facility can be given as a string or a numeric macro. This function will croak if it can't connect to the syslog daemon. Note that C now takes three arguments, just like C. B before calling C.> B =over 4 =item * C - This option is ignored, since the failover mechanism will drop down to the console automatically if all other media fail. =item * C - Open the connection immediately (normally, the connection is opened when the first message is logged). =item * C - When set to true, no end of line character (C<\n>) will be appended to the message. This can be useful for some buggy syslog daemons. =item * C - When set to true, C and C will only emit warnings instead of dying if the connection to the syslog can't be established. =item * C - When set to true, no C character (C<\0>) will be appended to the message. This can be useful for some buggy syslog daemons. =item * C - Don't wait for child processes that may have been created while logging the message. (The GNU C library does not create a child process, so this option has no effect on Linux.) =item * C - Write the message to standard error output as well to the system log (added in C 0.22). =item * C - Include PID with each message. =back B Open the syslog with options C and C, and with facility C: openlog($name, "ndelay,pid", "local0"); Same thing, but this time using the macro corresponding to C: openlog($name, "ndelay,pid", LOG_LOCAL0); =item B =item B If C<$priority> permits, logs C<$message> or C with the addition that C<%m> in $message or C<$format> is replaced with C<"$!"> (the latest error message). C<$priority> can specify a level, or a level and a facility. Levels and facilities can be given as strings or as macros. When using the C mechanism, priorities C and C are mapped to event type C, C and C to C and C to C to C. If you didn't use C before using C, C will try to guess the C<$ident> by extracting the shortest prefix of C<$format> that ends in a C<":">. B # informational level syslog("info", $message); syslog(LOG_INFO, $message); # information level, Local0 facility syslog("info|local0", $message); syslog(LOG_INFO|LOG_LOCAL0, $message); =over 4 =item B C version v0.07 and older passed the C<$message> as the formatting string to C even when no formatting arguments were provided. If the code calling C might execute with older versions of this module, make sure to call the function as C instead of C. This protects against hostile formatting sequences that might show up if $message contains tainted data. =back =item B Sets the log mask for the current process to C<$mask_priority> and returns the old mask. If the mask argument is 0, the current log mask is not modified. See L<"Levels"> for the list of available levels. You can use the C function to allow all levels up to a given priority (but it only accept the numeric macros as arguments). B Only log errors: setlogmask( LOG_MASK(LOG_ERR) ); Log everything except informational messages: setlogmask( ~(LOG_MASK(LOG_INFO)) ); Log critical messages, errors and warnings: setlogmask( LOG_MASK(LOG_CRIT) | LOG_MASK(LOG_ERR) | LOG_MASK(LOG_WARNING) ); Log all messages up to debug: setlogmask( LOG_UPTO(LOG_DEBUG) ); =item B Sets the socket type and options to be used for the next call to C or C. Returns true on success, C on failure. Being Perl-specific, this function has evolved along time. It can currently be called as follow: =over =item * C =item * C (added in Perl 5.004_02) =item * C (added in C 0.25) =item * C (added in C 0.28) =back The available options are: =over =item * C - equivalent to C<$sock_type>, selects the socket type (or "mechanism"). An array reference can be passed to specify several mechanisms to try, in the given order. =item * C - equivalent to C<$stream_location>, sets the stream location. Defaults to standard Unix location, or C<_PATH_LOG>. =item * C - equivalent to C<$sock_timeout>, sets the socket timeout in seconds. Defaults to 0 on all systems except S where it is set to 0.25 sec. =item * C - sets the hostname to send the messages to. Defaults to the local host. =item * C - sets the TCP or UDP port to connect to. Defaults to the first standard syslog port available on the system. =back The available mechanisms are: =over =item * C<"native"> - use the native C functions from your C library (added in C 0.15). =item * C<"eventlog"> - send messages to the Win32 events logger (Win32 only; added in C 0.19). =item * C<"tcp"> - connect to a TCP socket, on the C or C service. See also the C, C and C options. =item * C<"udp"> - connect to a UDP socket, on the C service. See also the C, C and C options. =item * C<"inet"> - connect to an INET socket, either TCP or UDP, tried in that order. See also the C, C and C options. =item * C<"unix"> - connect to a UNIX domain socket (in some systems a character special device). The name of that socket is given by the C option or, if omitted, the value returned by the C<_PATH_LOG> macro (if your system defines it), F or F, whichever is writable. =item * C<"stream"> - connect to the stream indicated by the C option, or, if omitted, the value returned by the C<_PATH_LOG> macro (if your system defines it), F or F, whichever is writable. For example Solaris and IRIX system may prefer C<"stream"> instead of C<"unix">. =item * C<"pipe"> - connect to the named pipe indicated by the C option, or, if omitted, to the value returned by the C<_PATH_LOG> macro (if your system defines it), or F (added in C 0.21). HP-UX is a system which uses such a named pipe. =item * C<"console"> - send messages directly to the console, as for the C<"cons"> option of C. =back The default is to try C, C, C, C, C, C, C. Under systems with the Win32 API, C will be added as the first mechanism to try if C is available. Giving an invalid value for C<$sock_type> will C. B Select the UDP socket mechanism: setlogsock("udp"); Send messages using the TCP socket mechanism on a custom port: setlogsock({ type => "tcp", port => 2486 }); Send messages to a remote host using the TCP socket mechanism: setlogsock({ type => "tcp", host => $loghost }); Try the native, UDP socket then UNIX domain socket mechanisms: setlogsock(["native", "udp", "unix"]); =over =item B Now that the "native" mechanism is supported by C and selected by default, the use of the C function is discouraged because other mechanisms are less portable across operating systems. Authors of modules and programs that use this function, especially its cargo-cult form C, are advised to remove any occurrence of it unless they specifically want to use a given mechanism (like TCP or UDP to connect to a remote host). =back =item B Closes the log file and returns true on success. =back =head1 THE RULES OF SYS::SYSLOG I You do not call C. I You B call C. I The program crashes, Cs, calls C, the log is over. I One facility, one priority. I One log at a time. I No C before C. I Logs will go on as long as they have to. I If this is your first use of Sys::Syslog, you must read the doc. =head1 EXAMPLES An example: openlog($program, 'cons,pid', 'user'); syslog('info', '%s', 'this is another test'); syslog('mail|warning', 'this is a better test: %d', time); closelog(); syslog('debug', 'this is the last test'); Another example: openlog("$program $$", 'ndelay', 'user'); syslog('notice', 'fooprogram: this is really done'); Example of use of C<%m>: $! = 55; syslog('info', 'problem was %m'); # %m == $! in syslog(3) Log to UDP port on C<$remotehost> instead of logging locally: setlogsock("udp", $remotehost); openlog($program, 'ndelay', 'user'); syslog('info', 'something happened over here'); =head1 CONSTANTS =head2 Facilities =over 4 =item * C - audit daemon (IRIX); falls back to C =item * C - security/authorization messages =item * C - security/authorization messages (private) =item * C - C output (FreeBSD); falls back to C =item * C - clock daemons (B and B) =item * C - system daemons without separate facility value =item * C - FTP daemon =item * C - kernel messages =item * C - installer subsystem (Mac OS X); falls back to C =item * C - launchd - general bootstrap daemon (Mac OS X); falls back to C =item * C - logalert facility; falls back to C =item * C through C - reserved for local use =item * C - line printer subsystem =item * C - mail subsystem =item * C - NetInfo subsystem (Mac OS X); falls back to C =item * C - USENET news subsystem =item * C - NTP subsystem (FreeBSD, NetBSD); falls back to C =item * C - Remote Access Service (VPN / PPP) (Mac OS X); falls back to C =item * C - remote authentication/authorization (Mac OS X); falls back to C =item * C - security subsystems (firewalling, etc.) (FreeBSD); falls back to C =item * C - messages generated internally by B =item * C (default) - generic user-level messages =item * C - UUCP subsystem =back =head2 Levels =over 4 =item * C - system is unusable =item * C - action must be taken immediately =item * C - critical conditions =item * C - error conditions =item * C - warning conditions =item * C - normal, but significant, condition =item * C - informational message =item * C - debug-level message =back =head1 DIAGNOSTICS =over =item C B<(F)> You gave C an invalid value for C<$sock_type>. =item C B<(W)> You asked C to use the Win32 event logger but the operating system running the program isn't Win32 or does not provides Win32 compatible facilities. =item C B<(F)> C failed to connect to the specified socket. =item C B<(W)> You asked C to use a stream socket, but the given path is not writable. =item C B<(W)> You asked C to use a stream socket, but didn't provide a path, and C was unable to find an appropriate one. =item C B<(W)> You asked C to use a TCP socket, but the service is not available on the system. =item C B<(F)> You forgot to give C the indicated argument. =item C B<(F)> You specified an invalid level or facility. =item C B<(F)> You specified too many levels. =item C B<(F)> You specified too many facilities. =item C B<(F)> You forgot to specify a level. =item C B<(W)> You asked C to use a UDP socket, but the service is not available on the system. =item C B<(W)> You asked C to use a UNIX socket, but C was unable to find an appropriate an appropriate device. =back =head1 HISTORY C is a core module, part of the standard Perl distribution since 1990. At this time, modules as we know them didn't exist, the Perl library was a collection of F<.pl> files, and the one for sending syslog messages with was simply F, included with Perl 3.0. It was converted as a module with Perl 5.0, but had a version number only starting with Perl 5.6. Here is a small table with the matching Perl and C versions. Sys::Syslog Perl ----------- ---- undef 5.0.0 ~ 5.5.4 0.01 5.6.* 0.03 5.8.0 0.04 5.8.1, 5.8.2, 5.8.3 0.05 5.8.4, 5.8.5, 5.8.6 0.06 5.8.7 0.13 5.8.8 0.22 5.10.0 0.27 5.8.9, 5.10.1 ~ 5.14.2 0.29 5.16.0, 5.16.1 =head1 SEE ALSO =head2 Other modules L - Perl implementation of the Log4j API L - Dispatches messages to one or more outputs L - Report a problem, with exceptions and language support =head2 Manual Pages L SUSv3 issue 6, IEEE Std 1003.1, 2004 edition, L GNU C Library documentation on syslog, L Solaris 10 documentation on syslog, L Mac OS X documentation on syslog, L IRIX 6.5 documentation on syslog, L AIX 5L 5.3 documentation on syslog, L HP-UX 11i documentation on syslog, L Tru64 5.1 documentation on syslog, L Stratus VOS 15.1, L =head2 RFCs I, L -- Please note that this is an informational RFC, and therefore does not specify a standard of any kind. I, L =head2 Articles I, L =head2 Event Log Windows Event Log, L =head1 AUTHORS & ACKNOWLEDGEMENTS Tom Christiansen EFE and Larry Wall EFE. UNIX domain sockets added by Sean Robinson EFE with support from Tim Bunce EFE and the C mailing list. Dependency on F replaced with XS code by Tom Hughes EFE. Code for Cs regenerated by Nicholas Clark EFE. Failover to different communication modes by Nick Williams EFE. Extracted from core distribution for publishing on the CPAN by SEbastien Aperghis-Tramoni Esebastien (at) aperghis.netE. XS code for using native C functions borrowed from C>, written by Marcus Harnisch EFE. Yves Orton suggested and helped for making C use the native event logger under Win32 systems. Jerry D. Hedden and Reini Urban provided greatly appreciated help to debug and polish C under Cygwin. =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Sys::Syslog You can also look for information at: =over 4 =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * RT: CPAN's request tracker L =item * Search CPAN L =item * MetaCPAN L =item * Perl Documentation L =back =head1 COPYRIGHT Copyright (C) 1990-2012 by Larry Wall and others. =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut =begin comment Notes for the future maintainer (even if it's still me..) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Using Google Code Search, I search who on Earth was relying on $host being public. It found 5 hits: * First was inside Indigo Star Perl2exe documentation. Just an old version of Sys::Syslog. * One real hit was inside DalWeathDB, a weather related program. It simply does a $Sys::Syslog::host = '127.0.0.1'; - L * Two hits were in TPC, a fax server thingy. It does a $Sys::Syslog::host = $TPC::LOGHOST; but also has this strange piece of code: # work around perl5.003 bug sub Sys::Syslog::hostname {} I don't know what bug the author referred to. - L - L * Last hit was in Filefix, which seems to be a FIDOnet mail program (!). This one does not use $host, but has the following piece of code: sub Sys::Syslog::hostname { use Sys::Hostname; return hostname; } I guess this was a more elaborate form of the previous bit, maybe because of a bug in Sys::Syslog back then? - L Links ----- Linux Fast-STREAMS - L II12021: SYSLOGD HOWTO TCPIPINFO (z/OS, OS/390, MVS) - L Getting the most out of the Event Viewer - L Log events to the Windows NT Event Log with JNI - L =end comment Sys-Syslog-0.33/Syslog.xs000644 000765 000000 00000004730 12012572732 016427 0ustar00maddinguewheel000000 000000 /* * Syslog.xs * * XS wrapper for the syslog(3) facility. * */ #if defined(_WIN32) # include #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef USE_PPPORT_H # include "ppport.h" #endif #ifndef HAVE_SYSLOG #define HAVE_SYSLOG 1 #endif #if defined(_WIN32) && !defined(__CYGWIN__) # undef HAVE_SYSLOG # include "fallback/syslog.h" #else # if defined(I_SYSLOG) || PATCHLEVEL < 6 # include # endif #endif static SV *ident_svptr; #ifndef LOG_FAC #define LOG_FACMASK 0x03f8 #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #endif #ifndef LOG_PRIMASK #define LOG_PRIMASK 0x07 #endif #ifndef LOG_PRI #define LOG_PRI(p) ((p) & LOG_PRIMASK) #endif #ifndef LOG_MAKEPRI #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) #endif #ifndef LOG_MASK #define LOG_MASK(pri) (1 << (pri)) #endif #ifndef LOG_UPTO #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) #endif #include "const-c.inc" MODULE = Sys::Syslog PACKAGE = Sys::Syslog INCLUDE: const-xs.inc int LOG_FAC(p) INPUT: int p int LOG_PRI(p) INPUT: int p int LOG_MAKEPRI(fac,pri) INPUT: int fac int pri int LOG_MASK(pri) INPUT: int pri int LOG_UPTO(pri) INPUT: int pri #ifdef HAVE_SYSLOG void openlog_xs(ident, option, facility) INPUT: SV* ident int option int facility PREINIT: STRLEN len; char* ident_pv; CODE: ident_svptr = newSVsv(ident); ident_pv = SvPV(ident_svptr, len); openlog(ident_pv, option, facility); void syslog_xs(priority, message) INPUT: int priority const char * message CODE: syslog(priority, "%s", message); int setlogmask_xs(mask) INPUT: int mask CODE: RETVAL = setlogmask(mask); OUTPUT: RETVAL void closelog_xs() PREINIT: U32 refcnt; CODE: if (!ident_svptr) return; closelog(); refcnt = SvREFCNT(ident_svptr); if (refcnt) { SvREFCNT_dec(ident_svptr); if (refcnt == 1) ident_svptr = NULL; } #else /* HAVE_SYSLOG */ void openlog_xs(ident, option, facility) INPUT: SV* ident int option int facility CODE: void syslog_xs(priority, message) INPUT: int priority const char * message CODE: int setlogmask_xs(mask) INPUT: int mask CODE: void closelog_xs() CODE: #endif /* HAVE_SYSLOG */ Sys-Syslog-0.33/t/000755 000765 000120 00000000000 12147530001 015011 5ustar00maddingueadmin000000 000000 Sys-Syslog-0.33/win32/000755 000765 000120 00000000000 12147530001 015510 5ustar00maddingueadmin000000 000000 Sys-Syslog-0.33/win32/compile.pl000644 000765 000765 00000017757 12142302544 020406 0ustar00maddinguemaddingue000000 000000 #!perl use strict; use warnings; use File::Basename; use File::Copy; use File::Path; my $name = shift || 'PerlLog'; # get the version from the message file open(my $msgfh, '<', "$name.mc") or die "fatal: Can't read file '$name.mc': $!\n"; my $top = <$msgfh>; close($msgfh); my ($version) = $top =~ /Sys::Syslog Message File (\d+\.\d+\.\d+)/ or die "error: File '$name.mc' doesn't have a version number\n"; # compile the message text files system("mc -d $name.mc"); system("rc $name.rc"); system(qq{ link -nodefaultlib -incremental:no -release /nologo -base:0x60000000 } .qq{ -comment:"Perl Syslog Message File v$version" } .qq{ -machine:i386 -dll -noentry -out:$name.dll $name.res }); # uuencode the resource file open(my $rsrc, '<', "$name.RES") or die "fatal: Can't read resource file '$name.RES': $!"; binmode($rsrc); my $uudata = pack "u", do { local $/; <$rsrc> }; close($rsrc); open(my $uufh, '>', "$name\_RES.uu") or die "fatal: Can't write file '$name\_RES.uu': $!"; print $uufh $uudata; close($uufh); # uuencode the DLL open(my $dll, '<', "$name.dll") or die "fatal: Can't read DLL '$name.dll': $!"; binmode($dll); $uudata = pack "u", do { local $/; <$dll> }; close($dll); open($uufh, '>', "$name\_dll.uu") or die "fatal: Can't write file '$name\_dll.uu': $!"; print $uufh $uudata; close($uufh); # parse the generated header to extract the constants open(my $header, '<', "$name.h") or die "fatal: Can't read header file '$name.h': $!"; my %vals; my $max = 0; while (<$header>) { if (/^#define\s+(\w+)\s+(\d+)$/ || /^#define\s+(\w+)\s+\(\(DWORD\)(\d+)L\)/) { $vals{$1} = $2; if (substr($1, 0, 1) eq 'C') { $max = $2 if $max < $2; } } } close($header); my ($hash, $f2c, %fac); for my $name (sort { substr($a,0,1) cmp substr($b,0,1) || $vals{$a} <=> $vals{$b} } keys %vals) { $hash .= " $name => $vals{$name},\n" ; if ($name =~ /^CAT_(\w+)$/) { $fac{$1} = $vals{$name}; } } for my $name (sort {$fac{$a} <=> $fac{$b}} keys %fac) { $f2c .= " Sys::Syslog::LOG_$name() => '$name',\n"; } # write the Sys::Syslog::Win32 module open my $out, '>', "Win32.pm" or die "fatal: Can't write Win32.pm: $!"; my $template = join '', ; $template =~ s/__CONSTANT__/$hash/; $template =~ s/__F2C__/$f2c/; $template =~ s/__NAME_VER__/$name/; $template =~ s/__VER__/$version/; $max = sprintf "0x%08x", $max; $template =~ s/__MAX__/'$max'/g; $template =~ s/__TIME__/localtime()/ge; print $out $template; close $out; print "Updated Win32.pm and relevant message files\n"; __END__ package Sys::Syslog::Win32; use strict; use warnings; use Carp; use File::Spec; # === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === # # This file was generated by Sys-Syslog/win32/compile.pl on __TIME__ # Any changes being made here will be lost the next time Sys::Syslog # is installed. # # Do NOT USE THIS MODULE DIRECTLY: this is a utility module for Sys::Syslog. # It may change at any time to fit the needs of Sys::Syslog therefore no # warranty is made WRT to its API. You Have Been Warned. # # === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === our $Source; my $logger; my $Registry; use Win32::EventLog; use Win32::TieRegistry 0.20 ( TiedRef => \$Registry, Delimiter => "/", ArrayValues => 1, SplitMultis => 1, AllowLoad => 1, qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ KEY_READ KEY_WRITE KEY_ALL_ACCESS ), ); my $is_Cygwin = $^O =~ /Cygwin/i; my $is_Win32 = $^O =~ /Win32/i; my %const = ( __CONSTANT__ ); my %id2name = ( __F2C__ ); my @priority2eventtype = ( EVENTLOG_ERROR_TYPE(), # LOG_EMERG EVENTLOG_ERROR_TYPE(), # LOG_ALERT EVENTLOG_ERROR_TYPE(), # LOG_CRIT EVENTLOG_ERROR_TYPE(), # LOG_ERR EVENTLOG_WARNING_TYPE(), # LOG_WARNING EVENTLOG_WARNING_TYPE(), # LOG_NOTICE EVENTLOG_INFORMATION_TYPE(), # LOG_INFO EVENTLOG_INFORMATION_TYPE(), # LOG_DEBUG ); # # _install() # -------- # Used to set up a connection to the eventlog. # sub _install { return $logger if $logger; # can't just use basename($0) here because Win32 path often are a # a mix of / and \, and File::Basename::fileparse() can't handle that, # while File::Spec::splitpath() can.. Go figure.. my (undef, undef, $basename) = File::Spec->splitpath($0); ($Source) ||= $basename; $Source.=" [SSW:__VER__]"; #$Registry->Delimiter("/"); # is this needed? my $root = 'LMachine/SYSTEM/CurrentControlSet/Services/Eventlog/Application/'; my $dll = 'Sys/Syslog/__NAME_VER__.dll'; if (!$Registry->{$root.$Source} || !$Registry->{$root.$Source.'/CategoryMessageFile'}[0] || !-e $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ) { # find the resource DLL, which should be along Syslog.dll my ($file) = grep { -e $_ } map { ("$_/$dll" => "$_/auto/$dll") } @INC; $dll = $file if $file; # on Cygwin, convert the Unix path into absolute Windows path if ($is_Cygwin) { if ($] > 5.009005) { chomp($file = Cygwin::posix_to_win_path($file, 1)); } else { local $ENV{PATH} = ''; chomp($dll = `/usr/bin/cygpath --absolute --windows "$dll"`); } } $dll =~ s![\\/]+!\\!g; # must be backslashes! die "fatal: Can't find resource DLL for Sys::Syslog\n" if !$dll; $Registry->{$root.$Source} = { '/EventMessageFile' => [ $dll, REG_EXPAND_SZ ], '/CategoryMessageFile' => [ $dll, REG_EXPAND_SZ ], '/CategoryCount' => [ __MAX__, REG_DWORD ], #'/TypesSupported' => [ __MAX__, REG_DWORD ], }; warn "Configured eventlog to use $dll for $Source\n" if $Sys::Syslog::DEBUG; } #Carp::confess("Registry has the wrong value for '$Source', possibly mismatched dll!\nMine:$dll\nGot :$Registry->{$root.$Source.'/CategoryMessageFile'}[0]\n") # if $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ne $dll; # we really should do something useful with this but for now # we set it to "" to prevent Win32::EventLog from warning my $host = ""; $logger = Win32::EventLog->new($Source, $host) or Carp::confess("Failed to connect to the '$Source' event log"); return $logger; } # # _syslog_send() # ------------ # Used to convert syslog messages into eventlog messages # sub _syslog_send { my ($buf, $numpri, $numfac) = @_; $numpri ||= EVENTLOG_INFORMATION_TYPE(); $numfac ||= Sys::Syslog::LOG_USER(); my $name = $id2name{$numfac}; my $opts = { EventType => $priority2eventtype[$numpri], EventID => $const{"MSG_$name"}, Category => $const{"CAT_$name"}, Strings => "$buf\0", Data => "", }; if ($Sys::Syslog::DEBUG) { require Data::Dumper; warn Data::Dumper->Dump( [$numpri, $numfac, $name, $opts], [qw(numpri numfac name opts)] ); } return $logger->Report($opts); } =head1 NAME Sys::Syslog::Win32 - Win32 support for Sys::Syslog =head1 DESCRIPTION This module is a back-end plugin for C, for supporting the Win32 event log. It is not expected to be directly used by any module other than C therefore it's API may change at any time and no warranty is made with regards to backward compatibility. You Have Been Warned. In order to execute this script and compile the Win32 support files, you need some helper programs: mc.exe, rc.exe and link.exe mc.exe and rc.exe can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=11310 link.exe is usually shipped with Visual Studio. =head1 SEE ALSO L =head1 AUTHORS SEbastien Aperghis-Tramoni and Yves Orton =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; Sys-Syslog-0.33/win32/PerlLog.mc000644 000765 000765 00000021437 11553024201 020270 0ustar00maddinguemaddingue000000 000000 ; // Sys::Syslog Message File 1.0.0 MessageIdTypedef = DWORD SeverityNames = ( Success = 0x0:STATUS_SEVERITY_SUCCESS Informational = 0x1:STATUS_SEVERITY_INFORMATIONAL Warning = 0x2:STATUS_SEVERITY_WARNING Error = 0x3:STATUS_SEVERITY_ERROR ) LanguageNames = ( English = 0x0409:MSG00409 ) LanguageNames = ( French = 0x040C:MSG0040C ) ; // ================================================================= ; // The following are facility name definitions MessageId = 0x0001 SymbolicName = CAT_KERN Language = English Kernel . Language = French Kernel . MessageId = 0x0002 SymbolicName = CAT_USER Language = English User . Language = French User . MessageId = 0x0003 SymbolicName = CAT_MAIL Language = English Mail . Language = French Mail . MessageId = 0x0004 SymbolicName = CAT_DAEMON Language = English Daemon . Language = French Daemon . MessageId = 0x0005 SymbolicName = CAT_AUTH Language = English Auth . Language = French Auth . MessageId = 0x0006 SymbolicName = CAT_SYSLOG Language = English Syslog . Language = French Syslog . MessageId = 0x0007 SymbolicName = CAT_LPR Language = English LPR . Language = French LPR . MessageId = 0x0008 SymbolicName = CAT_NEWS Language = English News . Language = French News . MessageId = 0x0009 SymbolicName = CAT_UUCP Language = English UUCP . Language = French UUCP . MessageId = 0x000a SymbolicName = CAT_CRON Language = English Cron . Language = French Cron . MessageId = 0x000b SymbolicName = CAT_AUTHPRIV Language = English AuthPrivate . Language = French AuthPrivate . MessageId = 0x000c SymbolicName = CAT_FTP Language = English FTP . Language = French FTP . MessageId = 0x000d SymbolicName = CAT_LOCAL0 Language = English Local0 . Language = French Local0 . MessageId = 0x000e SymbolicName = CAT_LOCAL1 Language = English Local1 . Language = French Local1 . MessageId = 0x000f SymbolicName = CAT_LOCAL2 Language = English Local2 . Language = French Local2 . MessageId = 0x0010 SymbolicName = CAT_LOCAL3 Language = English Local3 . Language = French Local3 . MessageId = 0x0011 SymbolicName = CAT_LOCAL4 Language = English Local4 . Language = French Local4 . MessageId = 0x0012 SymbolicName = CAT_LOCAL5 Language = English Local5 . Language = French Local5 . MessageId = 0x0013 SymbolicName = CAT_LOCAL6 Language = English Local6 . Language = French Local6 . MessageId = 0x0014 SymbolicName = CAT_LOCAL7 Language = English Local7 . Language = French Local7 . ; // Mac OS X specific facilities ------------------------------------ MessageId = 0x0015 SymbolicName = CAT_NETINFO Language = English NetInfo . Language = French NetInfo . MessageId = 0x0016 SymbolicName = CAT_REMOTEAUTH Language = English RemoteAuth . Language = French RemoteAuth . MessageId = 0x0017 SymbolicName = CAT_RAS Language = English RAS . Language = French RAS . MessageId = 0x0018 SymbolicName = CAT_INSTALL Language = English Install . Language = French Install . MessageId = 0x0019 SymbolicName = CAT_LAUNCHD Language = English Launchd . Language = French Launchd . ; //modern BSD specific facilities ---------------------------------- MessageId = 0x001a SymbolicName = CAT_CONSOLE Language = English Console . Language = French Console . MessageId = 0x001b SymbolicName = CAT_NTP Language = English NTP . Language = French NTP . MessageId = 0x001c SymbolicName = CAT_SECURITY Language = English Security . Language = French Sécurité . ; // IRIX specific facilities ---------------------------------------- MessageId = 0x001d SymbolicName = CAT_AUDIT Language = English Audit . Language = French Audit . MessageId = 0x001e SymbolicName = CAT_LFMT Language = English LogAlert . Language = French LogAlert . ; // ================================================================= ; // The following are message definitions. MessageId = 0x0080 SymbolicName = MSG_KERNEL Language = English Kernel message: %1 . Language = French Message du noyau : %1 . MessageId = 0x0081 SymbolicName = MSG_USER Language = English User message: %1 . Language = French Message utilisateur : %1 . MessageId = 0x0082 SymbolicName = MSG_MAIL Language = English Mail subsystem message: %1 . Language = French Message du sous-systčme de courrier : %1 . MessageId = 0x0083 SymbolicName = MSG_DAEMON Language = English Message from a system daemon without separate facility value: %1 . Language = French Message d'un daemon sans catégorie spécifique : %1 . MessageId = 0x0084 SymbolicName = MSG_AUTH Language = English Security/authorization message: %1 . Language = French Message de sécurite ou d'authorisation : %1 . MessageId = 0x0085 SymbolicName = MSG_SYSLOG Language = English Message generated internally by syslogd: %1 . Language = French Message interne généré par le daemon syslogd : %1 . MessageId = 0x0086 SymbolicName = MSG_LPR Language = English Line printer subsystem message: %1 . Language = French Message du sous-systčme d'impression : %1 . MessageId = 0x0087 SymbolicName = MSG_NEWS Language = English USENET news subsystem message: %1 . Language = French Message du sous-systčme de nouvelles USENET : %1 . MessageId = 0x0088 SymbolicName = MSG_UUCP Language = English UUCP subsystem message: %1 . Language = French Message du sous-systčme UUCP : %1 . MessageId = 0x0089 SymbolicName = MSG_CRON Language = English Message generated by the clock daemons (cron and at): %1 . Language = French Message généré par les daemons d'exécution programmée (cron et at) : %1 . MessageId = 0x008A SymbolicName = MSG_AUTHPRIV Language = English Security or authorization private message: %1 . Language = French Message privé de sécurité ou d'authorisation : %1 . MessageId = 0x008B SymbolicName = MSG_FTP Language = English FTP daemon message: %1 . Language = French Message du daemon FTP : %1 . MessageId = 0x008C SymbolicName = MSG_LOCAL0 Language = English Local message on channel 0: %1 . Language = French Message local sur le canal 0 : %1 . MessageId = 0x008D SymbolicName = MSG_LOCAL1 Language = English Local message on channel 1: %1 . Language = French Message local sur le canal 1 : %1 . MessageId = 0x008E SymbolicName = MSG_LOCAL2 Language = English Local message on channel 2: %1 . Language = French Message local sur le canal 2 : %1 . MessageId = 0x008F SymbolicName = MSG_LOCAL3 Language = English Local message on channel 3: %1 . Language = French Message local sur le canal 3 : %1 . MessageId = 0x0090 SymbolicName = MSG_LOCAL4 Language = English Local message on channel 4: %1 . Language = French Message local sur le canal 4 : %1 . MessageId = 0x0091 SymbolicName = MSG_LOCAL5 Language = English Local message on channel 5: %1 . Language = French Message local sur le canal 5 : %1 . MessageId = 0x0092 SymbolicName = MSG_LOCAL6 Language = English Local message on channel 6: %1 . Language = French Message local sur le canal 6 : %1 . MessageId = 0x0093 SymbolicName = MSG_LOCAL7 Language = English Local message on channel 7: %1 . Language = French Message local sur le canal 7 : %1 . ; // Mac OS X specific facilities ------------------------------------ MessageId = 0x0094 SymbolicName = MSG_NETINFO Language = English NetInfo subsystem message: %1 . Language = French Message du sous-systčme NetInfo : %1 . MessageId = 0x0095 SymbolicName = MSG_REMOTEAUTH Language = English Remote authentication or authorization message: %1 . Language = French Message d'authentification ou d'authorisation distante : %1 . MessageId = 0x0096 SymbolicName = MSG_RAS Language = English Message generated by the Remote Access Service (VPN / PPP): %1 . Language = French Message généré par le Service d'Accčs Distant (Remote Access Service) (VPN / PPP) : %1 . MessageId = 0x0097 SymbolicName = MSG_INSTALL Language = English Installer subsystem message: %1 . Language = French Message du sous-systčme d'installation : %1 . MessageId = 0x0098 SymbolicName = MSG_LAUNCHD Language = English Message generated by launchd, the general bootstrap daemon: %1 . Language = French Message généré par launchd, le daemon générique de démarrage : %1 . ; //modern BSD specific facilities ---------------------------------- MessageId = 0x0099 SymbolicName = MSG_CONSOLE Language = English Message for the console: %1 . Language = French Message pour la console : %1 . MessageId = 0x009a SymbolicName = MSG_NTP Language = English NTP subsystem message: %1 . Language = French Message du sous-systčme NTP : %1 . MessageId = 0x009b SymbolicName = MSG_SECURITY Language = English Security subsystem message (firewalling, etc.): %1 . Language = French Message du sous-systčme de sécurité (pare-feu, etc.) : %1 . ; // IRIX specific facilities ---------------------------------------- MessageId = 0x009c SymbolicName = MSG_AUDIT Language = English Audit daemon message: %1 . Language = French Message du daemon d'audit NTP : %1 . MessageId = 0x009d SymbolicName = MSG_LFMT Language = English Logalert facility: %1 . Language = French Message de logalert : %1 . Sys-Syslog-0.33/win32/PerlLog.RES000644 000765 000765 00000013270 11344055004 020321 0ustar00maddinguemaddingue000000 000000 ˙˙˙˙ź ˙˙ ˙˙0 L€ˆ„Œ˜ ššx ŤŤ źź| Kernel User Mail Daemon Auth Syslog LPR News UUCP Cron AuthPrivate FTP Local0 Local1 Local2 Local3 Local4 Local5 Local6 Local7 NetInfo RemoteAuth RAS Install Launchd 4Message du noyau : %1 <Message utilisateur : %1 \Message du sous-systŚme de courrier : %1 pMessage d'un daemon sans cat˜gorie sp˜cifique : %1 `Message de s˜curite ou d'authorisation : %1 lMessage interne g˜n˜r˜ par le daemon syslogd : %1 \Message du sous-systŚme d'impression : %1 lMessage du sous-systŚme de nouvelles USENET : %1 LMessage du sous-systŚme UUCP : %1 LMessage local sur le canal 0 : %1 LMessage local sur le canal 1 : %1 LMessage local sur le canal 2 : %1 LMessage local sur le canal 3 : %1 LMessage local sur le canal 4 : %1 LMessage local sur le canal 5 : %1 LMessage local sur le canal 6 : %1 LMessage local sur le canal 7 : %1 TMessage du sous-systŚme NetInfo : %1 €Message d'authentification ou d'authorisation distante : %1 ¸Message g˜n˜r˜ par le Service d'AccŚs Distant (Remote Access Service) (VPN / PPP) : %1 `Message du sous-systŚme d'installation : %1 ŒMessage g˜n˜r˜ par launchd, le daemon g˜n˜rique de emarrage : %1 ˜Message g˜n˜r˜ par les daemons d'ex˜cution programm˜e (cron et at) : %1 lMessage priv˜ de s˜curit˜ ou d'authorisation : %1 @Message du daemon FTP : %1 œ ˙˙ ˙˙0 L€ˆ„Œ˜8šš„ ŤŤ źźd Kernel User Mail Daemon Auth Syslog LPR News UUCP Cron AuthPrivate FTP Local0 Local1 Local2 Local3 Local4 Local5 Local6 Local7 NetInfo RemoteAuth RAS Install Launchd 0Kernel message: %1 ,User message: %1 @Mail subsystem message: %1 ŒMessage from a system daemon without separate facility value: %1 PSecurity/authorization message: %1 `Message generated internally by syslogd: %1 PLine printer subsystem message: %1 LUSENET news subsystem message: %1 @UUCP subsystem message: %1 HLocal message on channel 0: %1 HLocal message on channel 1: %1 HLocal message on channel 2: %1 HLocal message on channel 3: %1 HLocal message on channel 4: %1 HLocal message on channel 5: %1 HLocal message on channel 6: %1 HLocal message on channel 7: %1 DNetInfo subsystem message: %1 pRemote authentication or authorization message: %1 ˆMessage generated by the Remote Access Service (VPN / PPP): %1 HInstaller subsystem message: %1 ˆMessage generated by launchd, the general bootstrap daemon: %1 |Message generated by the clock daemons (cron and at): %1 dSecurity or authorization private message: %1 8FTP daemon message: %1 Sys-Syslog-0.33/win32/PerlLog_dll.uu000644 000765 000765 00000024526 11553024264 021170 0ustar00maddinguemaddingue000000 000000 M35J0``,````$````__\``+@`````````0``````````````````````````` M````````````````````L`````X?N@X`M`G-(;@!3,TA5&AI\6B=K+4XDX[6Z)VLM3B5)I8VC;RU.)``````````!010`` M3`$"`!LK3D4``````````.``#B$+`0<````````<```````````````0```` M$```````8``0`````@``!``````````$``````````!``````@``IAX```(` M`````!```!``````$```$````````!```````````````````````````!`` M`+`8`````````````````````````#````@````````````````````````` M```````````````````````````````````````````````````````````` M`````````````````````````"YR`"8`V,`=0!T M`&D`;P!N`"``<`!R`&\`9P!R`&$`;0!M`)@#90`@`"@`8P!R`&\`;@`@`&4` M=``@`&$`=``I`"``.@`@`"4`,0`-``H```!L``$`30!E`',`0!S`&P`;P!G``T`"@`````` M$``!`$P`4`!2``T`"@```!0``0!.`&4`=P!S``T`"@``````%``!`%4`50!# M`%``#0`*```````4``$`0P!R`&\`;@`-``H``````"```0!!`'4`=`!H`%`` M<@!I`'8`80!T`&4`#0`*````$``!`$8`5`!0``T`"@```!@``0!,`&\`8P!A M`&P`,``-``H``````!@``0!,`&\`8P!A`&P`,0`-``H``````!@``0!,`&\` M8P!A`&P`,@`-``H``````!@``0!,`&\`8P!A`&P`,P`-``H``````!@``0!, M`&\`8P!A`&P`-``-``H``````!@``0!,`&\`8P!A`&P`-0`-``H``````!@` M`0!,`&\`8P!A`&P`-@`-``H``````!@``0!,`&\`8P!A`&P`-P`-``H````` M`!@``0!.`&4`=`!)`&X`9@!O``T`"@```"```0!2`&4`;0!O`'0`90!!`'4` M=`!H``T`"@``````$``!`%(`00!3``T`"@```!@``0!)`&X`0`@`'8`80!L`'4`90`Z`"`` M)0`Q``T`"@``````4``!`%,`90!C`'4`<@!I`'0`>0`O`&$`=0!T`&@`;P!R M`&D`>@!A`'0`:0!O`&X`(`!M`&4`0`@`&(`>0`@`',`>0!S`&P`;P!G`&0`.@`@`"4` M,0`-``H```!0``$`3`!I`&X`90`@`'``<@!I`&X`=`!E`'(`(`!S`'4`8@!S M`'D`0!S`'0`90!M`"``;0!E`',`0`@`'0`:`!E`"``8P!L`&\`8P!K`"``9`!A`&4`;0!O`&X````````````````````````````````````````` Sys-Syslog-0.33/win32/PerlLog_RES.uu000644 000765 000765 00000017520 11344055004 021034 0ustar00maddinguemaddingue000000 000000 M`````"````#__P``__\```````````````````````"\"P``(````/__"P#_ M_P$``````#``#`0```````````8````!````&0```$P```"`````B````(0" M``",````F````*`%``":"```F@@``'@*``"K"```JP@``!`+``"\"```O`@` M`'P+```8``$`2P!E`'(`;@!E`&P`#0`*```````4``$`50!S`&4`<@`-``H` M`````!0``0!-`&$`:0!L``T`"@``````&``!`$0`80!E`&T`;P!N``T`"@`` M````%``!`$$`=0!T`&@`#0`*```````8``$`4P!Y`',`;`!O`&<`#0`*```` M```0``$`3`!0`%(`#0`*````%``!`$X`90!W`',`#0`*```````4``$`50!5 M`$,`4``-``H``````!0``0!#`'(`;P!N``T`"@``````(``!`$$`=0!T`&@` M4`!R`&D`=@!A`'0`90`-``H````0``$`1@!4`%``#0`*````&``!`$P`;P!C M`&$`;``P``T`"@``````&``!`$P`;P!C`&$`;``Q``T`"@``````&``!`$P` M;P!C`&$`;``R``T`"@``````&``!`$P`;P!C`&$`;``S``T`"@``````&``! M`$P`;P!C`&$`;``T``T`"@``````&``!`$P`;P!C`&$`;``U``T`"@`````` M&``!`$P`;P!C`&$`;``V``T`"@``````&``!`$P`;P!C`&$`;``W``T`"@`` M````&``!`$X`90!T`$D`;@!F`&\`#0`*````(``!`%(`90!M`&\`=`!E`$$` M=0!T`&@`#0`*```````0``$`4@!!`%,`#0`*````&``!`$D`;@!S`'0`80!L M`&P`#0`*````&``!`$P`80!U`&X`8P!H`&0`#0`*````-``!`$T`90!S`',` M80!G`&4`(`!D`'4`(`!N`&\`>0!A`'4`(``Z`"``)0`Q``T`"@```#P``0!- M`&4`0!S`'0`I@-M`&4`(`!D`&4`(`!C`&\`=0!R`'(`:0!E`'(`(``Z`"`` M)0`Q``T`"@``````<``!`$T`90!S`',`80!G`&4`(`!D`"<`=0!N`"``9`!A M`&4`;0!O`&X`(`!S`&$`;@!S`"``8P!A`'0`F`-G`&\`<@!I`&4`(`!S`'`` MF`-C`&D`9@!I`'$`=0!E`"``.@`@`"4`,0`-``H``````&```0!-`&4`0!S`&P`;P!G`&0`(``Z M`"``)0`Q``T`"@```%P``0!-`&4`0!S`'0`I@-M`&4`(`!D`"<`:0!M`'``<@!E`',`0!S`'0`90!M`"`` M;0!E`',`0!S`'0`90!M`"``9`!A`&4`;0!O`&X` M(`!W`&D`=`!H`&\`=0!T`"``0!S`'0`90!M`"``;0!E`',`0!S`'0`90!M`"``;0!E`',`0!S`'0`90!M`"``;0!E`',`@!A`'0`:0!O`&X`(`!M`&4`0`@ M`&P`80!U`&X`8P!H`&0`+``@`'0`:`!E`"``9P!E`&X`90!R`&$`;``@`&(` M;P!O`'0` \$Registry, Delimiter => "/", ArrayValues => 1, SplitMultis => 1, AllowLoad => 1, qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ KEY_READ KEY_WRITE KEY_ALL_ACCESS ), ); my $is_Cygwin = $^O =~ /Cygwin/i; my $is_Win32 = $^O =~ /Win32/i; my %const = ( CAT_KERN => 1, CAT_USER => 2, CAT_MAIL => 3, CAT_DAEMON => 4, CAT_AUTH => 5, CAT_SYSLOG => 6, CAT_LPR => 7, CAT_NEWS => 8, CAT_UUCP => 9, CAT_CRON => 10, CAT_AUTHPRIV => 11, CAT_FTP => 12, CAT_LOCAL0 => 13, CAT_LOCAL1 => 14, CAT_LOCAL2 => 15, CAT_LOCAL3 => 16, CAT_LOCAL4 => 17, CAT_LOCAL5 => 18, CAT_LOCAL6 => 19, CAT_LOCAL7 => 20, CAT_NETINFO => 21, CAT_REMOTEAUTH => 22, CAT_RAS => 23, CAT_INSTALL => 24, CAT_LAUNCHD => 25, CAT_CONSOLE => 26, CAT_NTP => 27, CAT_SECURITY => 28, CAT_AUDIT => 29, CAT_LFMT => 30, MSG_KERNEL => 128, MSG_USER => 129, MSG_MAIL => 130, MSG_DAEMON => 131, MSG_AUTH => 132, MSG_SYSLOG => 133, MSG_LPR => 134, MSG_NEWS => 135, MSG_UUCP => 136, MSG_CRON => 137, MSG_AUTHPRIV => 138, MSG_FTP => 139, MSG_LOCAL0 => 140, MSG_LOCAL1 => 141, MSG_LOCAL2 => 142, MSG_LOCAL3 => 143, MSG_LOCAL4 => 144, MSG_LOCAL5 => 145, MSG_LOCAL6 => 146, MSG_LOCAL7 => 147, MSG_NETINFO => 148, MSG_REMOTEAUTH => 149, MSG_RAS => 150, MSG_INSTALL => 151, MSG_LAUNCHD => 152, MSG_CONSOLE => 153, MSG_NTP => 154, MSG_SECURITY => 155, MSG_AUDIT => 156, MSG_LFMT => 157, STATUS_SEVERITY_SUCCESS => 0, STATUS_SEVERITY_INFORMATIONAL => 1, STATUS_SEVERITY_WARNING => 2, STATUS_SEVERITY_ERROR => 3, ); my %id2name = ( Sys::Syslog::LOG_KERN() => 'KERN', Sys::Syslog::LOG_USER() => 'USER', Sys::Syslog::LOG_MAIL() => 'MAIL', Sys::Syslog::LOG_DAEMON() => 'DAEMON', Sys::Syslog::LOG_AUTH() => 'AUTH', Sys::Syslog::LOG_SYSLOG() => 'SYSLOG', Sys::Syslog::LOG_LPR() => 'LPR', Sys::Syslog::LOG_NEWS() => 'NEWS', Sys::Syslog::LOG_UUCP() => 'UUCP', Sys::Syslog::LOG_CRON() => 'CRON', Sys::Syslog::LOG_AUTHPRIV() => 'AUTHPRIV', Sys::Syslog::LOG_FTP() => 'FTP', Sys::Syslog::LOG_LOCAL0() => 'LOCAL0', Sys::Syslog::LOG_LOCAL1() => 'LOCAL1', Sys::Syslog::LOG_LOCAL2() => 'LOCAL2', Sys::Syslog::LOG_LOCAL3() => 'LOCAL3', Sys::Syslog::LOG_LOCAL4() => 'LOCAL4', Sys::Syslog::LOG_LOCAL5() => 'LOCAL5', Sys::Syslog::LOG_LOCAL6() => 'LOCAL6', Sys::Syslog::LOG_LOCAL7() => 'LOCAL7', Sys::Syslog::LOG_NETINFO() => 'NETINFO', Sys::Syslog::LOG_REMOTEAUTH() => 'REMOTEAUTH', Sys::Syslog::LOG_RAS() => 'RAS', Sys::Syslog::LOG_INSTALL() => 'INSTALL', Sys::Syslog::LOG_LAUNCHD() => 'LAUNCHD', Sys::Syslog::LOG_CONSOLE() => 'CONSOLE', Sys::Syslog::LOG_NTP() => 'NTP', Sys::Syslog::LOG_SECURITY() => 'SECURITY', Sys::Syslog::LOG_AUDIT() => 'AUDIT', Sys::Syslog::LOG_LFMT() => 'LFMT', ); my @priority2eventtype = ( EVENTLOG_ERROR_TYPE(), # LOG_EMERG EVENTLOG_ERROR_TYPE(), # LOG_ALERT EVENTLOG_ERROR_TYPE(), # LOG_CRIT EVENTLOG_ERROR_TYPE(), # LOG_ERR EVENTLOG_WARNING_TYPE(), # LOG_WARNING EVENTLOG_WARNING_TYPE(), # LOG_NOTICE EVENTLOG_INFORMATION_TYPE(), # LOG_INFO EVENTLOG_INFORMATION_TYPE(), # LOG_DEBUG ); # # _install() # -------- # Used to set up a connection to the eventlog. # sub _install { return $logger if $logger; # can't just use basename($0) here because Win32 path often are a # a mix of / and \, and File::Basename::fileparse() can't handle that, # while File::Spec::splitpath() can.. Go figure.. my (undef, undef, $basename) = File::Spec->splitpath($0); ($Source) ||= $basename; $Source.=" [SSW:1.0.1]"; #$Registry->Delimiter("/"); # is this needed? my $root = 'LMachine/SYSTEM/CurrentControlSet/Services/Eventlog/Application/'; my $dll = 'Sys/Syslog/PerlLog.dll'; if (!$Registry->{$root.$Source} || !$Registry->{$root.$Source.'/CategoryMessageFile'}[0] || !-e $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ) { # find the resource DLL, which should be along Syslog.dll my ($file) = grep { -e $_ } map { ("$_/$dll" => "$_/auto/$dll") } @INC; $dll = $file if $file; # on Cygwin, convert the Unix path into absolute Windows path if ($is_Cygwin) { if ($] > 5.009005) { chomp($file = Cygwin::posix_to_win_path($file, 1)); } else { local $ENV{PATH} = ''; chomp($dll = `/usr/bin/cygpath --absolute --windows "$dll"`); } } $dll =~ s![\\/]+!\\!g; # must be backslashes! die "fatal: Can't find resource DLL for Sys::Syslog\n" if !$dll; $Registry->{$root.$Source} = { '/EventMessageFile' => [ $dll, REG_EXPAND_SZ ], '/CategoryMessageFile' => [ $dll, REG_EXPAND_SZ ], '/CategoryCount' => [ '0x0000001e', REG_DWORD ], #'/TypesSupported' => [ '0x0000001e', REG_DWORD ], }; warn "Configured eventlog to use $dll for $Source\n" if $Sys::Syslog::DEBUG; } #Carp::confess("Registry has the wrong value for '$Source', possibly mismatched dll!\nMine:$dll\nGot :$Registry->{$root.$Source.'/CategoryMessageFile'}[0]\n") # if $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ne $dll; # we really should do something useful with this but for now # we set it to "" to prevent Win32::EventLog from warning my $host = ""; $logger = Win32::EventLog->new($Source, $host) or Carp::confess("Failed to connect to the '$Source' event log"); return $logger; } # # _syslog_send() # ------------ # Used to convert syslog messages into eventlog messages # sub _syslog_send { my ($buf, $numpri, $numfac) = @_; $numpri ||= EVENTLOG_INFORMATION_TYPE(); $numfac ||= Sys::Syslog::LOG_USER(); my $name = $id2name{$numfac}; my $opts = { EventType => $priority2eventtype[$numpri], EventID => $const{"MSG_$name"}, Category => $const{"CAT_$name"}, Strings => "$buf\0", Data => "", }; if ($Sys::Syslog::DEBUG) { require Data::Dumper; warn Data::Dumper->Dump( [$numpri, $numfac, $name, $opts], [qw(numpri numfac name opts)] ); } return $logger->Report($opts); } =head1 NAME Sys::Syslog::Win32 - Win32 support for Sys::Syslog =head1 DESCRIPTION This module is a back-end plugin for C, for supporting the Win32 event log. It is not expected to be directly used by any module other than C therefore it's API may change at any time and no warranty is made with regards to backward compatibility. You Have Been Warned. =head1 SEE ALSO L =head1 AUTHORS SEbastien Aperghis-Tramoni and Yves Orton =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; Sys-Syslog-0.33/t/00-load.t000644 000765 000765 00000000253 11344055004 017221 0ustar00maddinguemaddingue000000 000000 #!perl -wT use strict; use Test::More tests => 1; use_ok( 'Sys::Syslog' ); diag( "Testing Sys::Syslog $Sys::Syslog::VERSION, Perl $], $^X" ) unless $ENV{PERL_CORE}; Sys-Syslog-0.33/t/constants.t000644 000765 000765 00000002304 11552333176 020112 0ustar00maddinguemaddingue000000 000000 #!perl -wT use strict; use File::Spec; use Test::More; my $macrosall = 'macros.all'; open(MACROS, $macrosall) or plan skip_all => "can't read '$macrosall': $!"; my @names = map {chomp;$_} ; close(MACROS); plan tests => @names * 2 + 2; my $callpack = my $testpack = 'Sys::Syslog'; eval "use $callpack"; eval "${callpack}::This()"; like( $@, "/^This is not a valid $testpack macro/", "trying a non-existing macro"); eval "${callpack}::NOSUCHNAME()"; like( $@, "/^NOSUCHNAME is not a valid $testpack macro/", "trying a non-existing macro"); # Testing all macros if(@names) { for my $name (@names) { SKIP: { $name =~ /^(\w+)$/ or skip "invalid name '$name'", 2; $name = $1; my $v = eval "${callpack}::$name()"; if(defined $v and $v =~ /^\d+$/) { is( $@, '', "calling the constant $name as a function" ); like( $v, '/^\d+$/', "checking that $name is a number ($v)" ); } else { like( $@, "/^Your vendor has not defined $testpack macro $name/", "calling the constant via its name" ); skip "irrelevant test in this case", 1 } } } } Sys-Syslog-0.33/t/data-validation.t000644 000765 000765 00000005747 12147341273 021153 0ustar00maddinguemaddingue000000 000000 #!perl -w # -------------------------------------------------------------------- # The aim of this test is to start a syslog server (TCP or UDP) using # the one available in POE, make Sys::Syslog connect to it by manually # select the corresponding mechanism, send some messages and, inside # the POE syslog server, check that these message are correctly crafted. # -------------------------------------------------------------------- use strict; my $port; BEGIN { # override getservbyname() *CORE::GLOBAL::getservbyname = sub ($$) { my @v = CORE::getservbyname($_[0], $_[1]); if (@v) { $v[2] = $port; } else { @v = ($_[0], "", $port, $_[1]); } return wantarray ? @v : $port } } use File::Spec; use Test::More; use Socket; use Sys::Syslog qw(:standard :extended :macros); # check than POE is available plan skip_all => "POE is not available" unless eval "use POE; 1"; # check than POE::Component::Server::Syslog is available and recent enough plan skip_all => "POE::Component::Server::Syslog is not available" unless eval "use POE::Component::Server::Syslog; 1"; plan skip_all => "POE::Component::Server::Syslog is too old" if POE::Component::Server::Syslog->VERSION < 1.14; plan tests => 1; $port = 5140; my $proto = "tcp"; my $ident = "pocosyslog"; my $text = "Close the world, txEn eht nepO."; $SIG{ALRM} = sub { ok( 0, "test took too much time to execute" ); exit }; alarm 30; my $pid = fork(); if ($pid) { # parent: setup a syslog server POE::Component::Server::Syslog->spawn( Alias => 'syslog', Type => $proto, BindAddress => '127.0.0.1', BindPort => $port, InputState => \&client_input, ErrorState => \&client_error, ); $SIG{CHLD} = sub { wait() }; POE::Kernel->sig_child($pid); POE::Kernel->run; } else { # child: send a message to the syslog server setup in the parent sleep 2; openlog($ident, "ndelay,pid", "local0"); setlogsock($proto); syslog(info => $text); closelog(); exit } sub client_input { my $message = $_[&ARG0]; delete $message->{'time'}; # too hazardous to test is_deeply( $message, { host => scalar gethostbyaddr(inet_aton('127.0.0.1'), AF_INET), pri => &LOG_LOCAL0 + &LOG_INFO, facility => &LOG_LOCAL0 >> 3, severity => &LOG_INFO, msg => "$ident\[$pid]: $text\n\0", }, "checking syslog message" ); POE::Kernel->post(syslog => "shutdown"); POE::Kernel->stop; } sub client_error { my $message = $_[&ARG0]; require Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Indent = 0; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Sortkeys = 1; fail "checking syslog message"; diag "[client_error] message = ", Data::Dumper::Dumper($message); POE::Kernel->post(syslog => "shutdown"); POE::Kernel->stop; } Sys-Syslog-0.33/t/distchk.t000644 000765 000765 00000000300 11344055004 017507 0ustar00maddinguemaddingue000000 000000 #!perl -w use strict; use Test::More; plan skip_all => "Test::Distribution required for checking distribution" unless eval "use Test::Distribution not => [qw(versions podcover use)]; 1"; Sys-Syslog-0.33/t/facilities-routing.t000644 000765 000120 00000010307 12025621305 021003 0ustar00maddingueadmin000000 000000 #!perl -w # -------------------------------------------------------------------- # Try to send messages with all combinations of facilities and levels # to a POE syslog server. # -------------------------------------------------------------------- use strict; use warnings; use Test::More; use Socket; use Sys::Syslog 0.30 qw< :standard :extended :macros >; # check than POE is available plan skip_all => "POE is not available" unless eval "use POE; 1"; # check than POE::Component::Server::Syslog is available and recent enough plan skip_all => "POE::Component::Server::Syslog is not available" unless eval "use POE::Component::Server::Syslog; 1"; plan skip_all => "POE::Component::Server::Syslog is too old" if POE::Component::Server::Syslog->VERSION < 1.14; my $host = "127.0.0.1"; my $port = 5140; my $proto = "udp"; my $ident = "pocosyslog"; my @levels = qw< emerg alert crit err warning notice info debug >; my @facilities = qw< auth cron daemon ftp kern lpr mail news syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 >; my %received; my $parent_pid = $$; my $child_pid = fork(); if ($child_pid) { # parent: setup a syslog server POE::Component::Server::Syslog->spawn( Alias => 'syslog', Type => $proto, BindAddress => $host, BindPort => $port, InputState => \&client_input, ErrorState => \&client_error, ); # signal handlers POE::Kernel->sig_child($child_pid, sub { wait() }); $SIG{TERM} = sub { POE::Kernel->post(syslog => "shutdown"); POE::Kernel->stop; }; # run everything plan tests => @facilities * @levels * 2; POE::Kernel->run; # check if some messages are missing my @miss = sort grep { $received{$_} < 2 } keys %received; diag "@miss" if @miss; } else { # child: send messages to the syslog server sleep 2; my $delay = .01; setlogsock({ host => $host, type => $proto, port => $port }); # first way, set the facility each time with openlog() for my $facility (@facilities) { openlog($ident, "ndelay,pid", $facility); for my $level (@levels) { eval { syslog($level => "<$facility\:$level>") } or warn "error: syslog($level => '<$facility\:$level>'): $@"; select undef, undef, undef, $delay; } } # second way, set the facility once with openlog(), then set # the message facility with syslog() openlog($ident, "ndelay,pid", "user"); for my $facility (@facilities) { for my $level (@levels) { eval { syslog("$facility.$level" => "<$facility\:$level>") } or warn "error: syslog('$facility.$level' => '<$facility\:$level>'): $@"; select undef, undef, undef, $delay; } } sleep 2; # send SIGTERM to the parent kill 15 => $parent_pid; } sub client_input { my $message = $_[&ARG0]; # extract the sent facility and level from the message text my ($sent_facility, $sent_level) = $message->{msg} =~ /<(\w+):(\w+)>/; $received{"$sent_facility\:$sent_level"}++; # resolve their numeric values my ($sent_fac_num, $sent_lev_num); { no strict "refs"; $sent_fac_num = eval { my $n = uc "LOG_$sent_facility"; &$n } >> 3; $sent_lev_num = eval { my $n = uc "LOG_$sent_level"; &$n }; } is_deeply( { # received message facility => $message->{facility}, severity => $message->{severity}, }, { # sent message facility => $sent_fac_num, severity => $sent_lev_num, }, "sent - rcvd{facility}, " . "level=$message->{severity}>" ); } sub client_error { my $message = $_[&ARG0]; require Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Indent = 0; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Sortkeys = 1; fail "checking syslog message"; diag "[client_error] message = ", Data::Dumper::Dumper($message); kill 15 => $child_pid; POE::Kernel->post(syslog => "shutdown"); POE::Kernel->stop; } Sys-Syslog-0.33/t/pod.t000644 000765 000765 00000000552 11344055004 016651 0ustar00maddinguemaddingue000000 000000 #!perl -wT use strict; use Test::More; plan skip_all => "Test::Pod v1.14 required for testing POD" unless eval "use Test::Pod 1.14; 1"; all_pod_files_ok(); if ($ENV{AUTHOR_TESTS}) { if (eval "use Pod::Checker; 1") { my $checker = Pod::Checker->new(-warnings => 1); $checker->parse_from_file($_, \*STDERR) for all_pod_files(); } } Sys-Syslog-0.33/t/podcover.t000644 000765 000765 00000000446 11344055004 017712 0ustar00maddinguemaddingue000000 000000 #!perl -wT use strict; use Test::More; plan skip_all => "Test::Pod::Coverage 1.06 required for testing POD coverage" unless eval "use Test::Pod::Coverage 1.06; 1"; all_pod_coverage_ok({ also_private => [qw(^constant$ ^connect ^disconnect ^xlate$ ^LOG_ can_load silent_eval _xs$)] }); Sys-Syslog-0.33/t/podspell.t000644 000765 000765 00000001714 11344055004 017712 0ustar00maddinguemaddingue000000 000000 #!perl -w use strict; use Test::More; plan skip_all => "Pod spelling: for maintainer only" unless -d "releases"; plan skip_all => "Test::Spelling required for checking Pod spell" unless eval "use Test::Spelling; 1"; if (`type spell 2>/dev/null`) { # default } elsif (`type aspell 2>/dev/null`) { set_spell_cmd('aspell -l --lang=en'); } else { plan skip_all => "spell(1) command or compatible required for checking Pod spell" } add_stopwords(); all_pod_files_spelling_ok(); __END__ SAPER Sébastien Aperghis Tramoni Aperghis-Tramoni Christiansen Kobes Hedden Reini Harnisch AnnoCPAN CPAN README TODO AUTOLOADER API arrayref arrayrefs hashref hashrefs lookup hostname loopback netmask timestamp INET BPF IP TCP tcp UDP udp UUCP NTP FDDI Firewire HDLC IEEE IrDA LocalTalk PPP unix FreeBSD NetBSD Solaris IRIX endianness failover Failover logopts pathname syslogd Syslogging logmask AIX SUSv SUSv3 Tru Tru64 UX HP-UX VOS NetInfo VPN launchd logalert Sys-Syslog-0.33/t/portfs.t000644 000765 000765 00000000331 11344055004 017377 0ustar00maddinguemaddingue000000 000000 #!perl -wT use strict; use Test::More; plan skip_all => "Test::Portability::Files required for testing filenames portability" unless eval "use Test::Portability::Files; 1"; # run the selected tests run_tests(); Sys-Syslog-0.33/t/syslog.t000644 000765 000120 00000030557 12024462332 016535 0ustar00maddingueadmin000000 000000 #!perl -T use strict; use Config; use File::Spec; use Test::More; # we enable all Perl warnings, but we don't "use warnings 'all'" because # we want to disable the warnings generated by Sys::Syslog no warnings; use warnings qw(closure deprecated exiting glob io misc numeric once overflow pack portable recursion redefine regexp severe signal substr syntax taint uninitialized unpack untie utf8 void); # if someone is using warnings::compat, the previous trick won't work, so we # must manually disable warnings $^W = 0 if $] < 5.006; my $is_Win32 = $^O =~ /win32/i; my $is_Cygwin = $^O =~ /cygwin/i; # if testing in core, check that the module is at least available if ($ENV{PERL_CORE}) { plan skip_all => "Sys::Syslog was not build" unless $Config{'extensions'} =~ /\bSyslog\b/; } # we also need Socket plan skip_all => "Socket was not build" unless $Config{'extensions'} =~ /\bSocket\b/; my $tests; plan tests => $tests; # any remaining warning should be severly punished BEGIN { eval "use Test::NoWarnings"; $tests = $@ ? 0 : 1; } BEGIN { $tests += 1 } # ok, now loads them eval 'use Socket'; use_ok('Sys::Syslog', ':standard', ':extended', ':macros'); BEGIN { $tests += 1 } # check that the documented functions are correctly provided can_ok( 'Sys::Syslog' => qw(openlog syslog syslog setlogmask setlogsock closelog) ); BEGIN { $tests += 4 } # check the diagnostics # setlogsock() eval { setlogsock() }; like( $@, qr/^setlogsock\(\): Invalid number of arguments/, "calling setlogsock() with no argument" ); eval { setlogsock(undef) }; like( $@, qr/^setlogsock\(\): Invalid type; must be one of /, "calling setlogsock() with undef" ); eval { setlogsock(\"") }; like( $@, qr/^setlogsock\(\): Unexpected scalar reference/, "calling setlogsock() with a scalar reference" ); eval { setlogsock({}) }; like( $@, qr/^setlogsock\(\): No argument given/, "calling setlogsock() with an empty hash reference" ); BEGIN { $tests += 3 } # syslog() eval { syslog() }; like( $@, qr/^syslog: expecting argument \$priority/, "calling syslog() with no argument" ); eval { syslog(undef) }; like( $@, qr/^syslog: expecting argument \$priority/, "calling syslog() with one undef argument" ); eval { syslog('') }; like( $@, qr/^syslog: expecting argument \$format/, "calling syslog() with one empty argument" ); my $test_string = "uid $< is testing Perl $] syslog(3) capabilities"; my $r = 0; BEGIN { $tests += 8 } # try to open a syslog using a Unix or stream socket SKIP: { skip "can't connect to Unix socket: _PATH_LOG unavailable", 8 unless -e Sys::Syslog::_PATH_LOG(); # The only known $^O eq 'svr4' that needs this is NCR MP-RAS, # but assuming 'stream' in SVR4 is probably not that bad. my $sock_type = $^O =~ /^(solaris|irix|svr4|powerux)$/ ? 'stream' : 'unix'; eval { setlogsock($sock_type) }; is( $@, '', "setlogsock() called with '$sock_type'" ); TODO: { local $TODO = "minor bug"; SKIP: { skip "TODO $TODO", 1 if $] < 5.006002; ok( $r, "setlogsock() should return true: '$r'" ); } } # open syslog with a "local0" facility SKIP: { # openlog() $r = eval { openlog('perl', 'ndelay', 'local0') } || 0; skip "can't connect to syslog", 6 if $@ =~ /^no connection to syslog available/; is( $@, '', "openlog() called with facility 'local0'" ); ok( $r, "openlog() should return true: '$r'" ); # syslog() $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0; is( $@, '', "syslog() called with level 'info'" ); ok( $r, "syslog() should return true: '$r'" ); # closelog() $r = eval { closelog() } || 0; is( $@, '', "closelog()" ); ok( $r, "closelog() should return true: '$r'" ); } } BEGIN { $tests += 22 * 8 } # try to open a syslog using all the available connection methods my @passed = (); for my $sock_type (qw(native eventlog unix pipe stream inet tcp udp)) { SKIP: { skip "the 'stream' mechanism because a previous mechanism with similar interface succeeded", 22 if $sock_type eq 'stream' and grep {/pipe|unix/} @passed; # setlogsock() called with an arrayref $r = eval { setlogsock([$sock_type]) } || 0; skip "can't use '$sock_type' socket", 22 unless $r; is( $@, '', "[$sock_type] setlogsock() called with ['$sock_type']" ); ok( $r, "[$sock_type] setlogsock() should return true: '$r'" ); # setlogsock() called with a single argument $r = eval { setlogsock($sock_type) } || 0; skip "can't use '$sock_type' socket", 20 unless $r; is( $@, '', "[$sock_type] setlogsock() called with '$sock_type'" ); ok( $r, "[$sock_type] setlogsock() should return true: '$r'" ); # openlog() without option NDELAY $r = eval { openlog('perl', '', 'local0') } || 0; skip "can't connect to syslog", 18 if $@ =~ /^no connection to syslog available/; is( $@, '', "[$sock_type] openlog() called with facility 'local0' and without option 'ndelay'" ); ok( $r, "[$sock_type] openlog() should return true: '$r'" ); # openlog() with the option NDELAY $r = eval { openlog('perl', 'ndelay', 'local0') } || 0; skip "can't connect to syslog", 16 if $@ =~ /^no connection to syslog available/; is( $@, '', "[$sock_type] openlog() called with facility 'local0' with option 'ndelay'" ); ok( $r, "[$sock_type] openlog() should return true: '$r'" ); # syslog() with negative level, should fail $r = eval { syslog(-1, "$test_string by connecting to a $sock_type socket") } || 0; like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level -1" ); ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); # syslog() with invalid level, should fail $r = eval { syslog("plonk", "$test_string by connecting to a $sock_type socket") } || 0; like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level plonk" ); ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); # syslog() with levels "info" and "notice" (as a strings), should fail $r = eval { syslog('info,notice', "$test_string by connecting to a $sock_type socket") } || 0; like( $@, '/^syslog: too many levels given: notice/', "[$sock_type] syslog() called with level 'info,notice'" ); ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); # syslog() with facilities "local0" and "local1" (as a strings), should fail $r = eval { syslog('local0,local1', "$test_string by connecting to a $sock_type socket") } || 0; like( $@, '/^syslog: too many facilities given: local1/', "[$sock_type] syslog() called with level 'local0,local1'" ); ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); # syslog() with level "info" (as a string), should pass $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0; is( $@, '', "[$sock_type] syslog() called with level 'info' (string)" ); ok( $r, "[$sock_type] syslog() should return true: '$r'" ); # syslog() with level "info" (as a macro), should pass { local $! = 1; $r = eval { syslog(LOG_INFO(), "$test_string by connecting to a $sock_type socket, setting a fake errno: %m") } || 0; } is( $@, '', "[$sock_type] syslog() called with level 'info' (macro)" ); ok( $r, "[$sock_type] syslog() should return true: '$r'" ); push @passed, $sock_type; SKIP: { skip "skipping closelog() tests for 'console'", 2 if $sock_type eq 'console'; # closelog() $r = eval { closelog() } || 0; is( $@, '', "[$sock_type] closelog()" ); ok( $r, "[$sock_type] closelog() should return true: '$r'" ); } } } BEGIN { $tests += 10 } SKIP: { skip "not testing setlogsock('stream') on Win32", 10 if $is_Win32; skip "the 'unix' mechanism works, so the tests will likely fail with the 'stream' mechanism", 10 if grep {/unix/} @passed; skip "not testing setlogsock('stream'): _PATH_LOG unavailable", 10 unless -e Sys::Syslog::_PATH_LOG(); # setlogsock() with "stream" and an undef path $r = eval { setlogsock("stream", undef ) } || ''; is( $@, '', "setlogsock() called, with 'stream' and an undef path" ); if ($is_Cygwin) { if (-x "/usr/sbin/syslog-ng") { ok( $r, "setlogsock() on Cygwin with syslog-ng should return true: '$r'" ); } else { ok( !$r, "setlogsock() on Cygwin without syslog-ng should return false: '$r'" ); } } else { ok( $r, "setlogsock() should return true: '$r'" ); } # setlogsock() with "stream" and an empty path $r = eval { setlogsock("stream", '' ) } || ''; is( $@, '', "setlogsock() called, with 'stream' and an empty path" ); ok( !$r, "setlogsock() should return false: '$r'" ); # setlogsock() with "stream" and /dev/null $r = eval { setlogsock("stream", '/dev/null' ) } || ''; is( $@, '', "setlogsock() called, with 'stream' and '/dev/null'" ); ok( $r, "setlogsock() should return true: '$r'" ); # setlogsock() with "stream" and a non-existing file $r = eval { setlogsock("stream", 'test.log' ) } || ''; is( $@, '', "setlogsock() called, with 'stream' and 'test.log' (file does not exist)" ); ok( !$r, "setlogsock() should return false: '$r'" ); # setlogsock() with "stream" and a local file SKIP: { my $logfile = "test.log"; open(LOG, ">$logfile") or skip "can't create file '$logfile': $!", 2; close(LOG); $r = eval { setlogsock("stream", $logfile ) } || ''; is( $@, '', "setlogsock() called, with 'stream' and '$logfile' (file exists)" ); ok( $r, "setlogsock() should return true: '$r'" ); unlink($logfile); } } BEGIN { $tests += 3 + 4 * 3 } # setlogmask() { my $oldmask = 0; $oldmask = eval { setlogmask(0) } || 0; is( $@, '', "setlogmask() called with a null mask" ); $r = eval { setlogmask(0) } || 0; is( $@, '', "setlogmask() called with a null mask (second time)" ); is( $r, $oldmask, "setlogmask() must return the same mask as previous call"); my @masks = ( LOG_MASK(LOG_ERR()), ~LOG_MASK(LOG_INFO()), LOG_MASK(LOG_CRIT()) | LOG_MASK(LOG_ERR()) | LOG_MASK(LOG_WARNING()), ); for my $newmask (@masks) { $r = eval { setlogmask($newmask) } || 0; is( $@, '', "setlogmask() called with a new mask" ); is( $r, $oldmask, "setlogmask() must return the same mask as previous call"); $r = eval { setlogmask(0) } || 0; is( $@, '', "setlogmask() called with a null mask" ); is( $r, $newmask, "setlogmask() must return the new mask"); setlogmask($oldmask); } } BEGIN { $tests += 4 } SKIP: { # case: test the return value of setlogsock() # setlogsock("stream") on a non-existent file must fail eval { $r = setlogsock("stream", "plonk/log") }; is( $@, '', "setlogsock() didn't croak"); ok( !$r, "setlogsock() correctly failed with a non-existent stream path"); # setlogsock("tcp") must fail if the service is not declared my $service = getservbyname("syslog", "tcp") || getservbyname("syslogng", "tcp"); skip "can't test setlogsock() tcp failure", 2 if $service; eval { $r = setlogsock("tcp") }; is( $@, '', "setlogsock() didn't croak"); ok( !$r, "setlogsock() correctly failed when tcp services can't be resolved"); } BEGIN { $tests += 3 } SKIP: { # case: configure Sys::Syslog to use the stream mechanism on a # given file, but remove the file before openlog() is called, # so it fails. # create the log file my $log = "t/stream"; open my $fh, ">$log" or skip "can't write file '$log': $!", 3; close $fh; # configure Sys::Syslog to use it $r = eval { setlogsock("stream", $log) }; is( $@, "", "setlogsock('stream', '$log') -> $r" ); skip "can't test openlog() failure with a missing stream", 2 if !$r; # remove the log and check that openlog() fails unlink $log; $r = eval { openlog('perl', 'ndelay', 'local0') }; ok( !$r, "openlog() correctly failed with a non-existent stream" ); like( $@, '/not writable/', "openlog() correctly croaked with a non-existent stream" ); } Sys-Syslog-0.33/fallback/const-c.inc000644 000765 000765 00000042045 11344055004 021242 0ustar00maddinguemaddingue000000 000000 #define PERL_constant_NOTFOUND 1 #define PERL_constant_NOTDEF 2 #define PERL_constant_ISIV 3 #define PERL_constant_ISNO 4 #define PERL_constant_ISNV 5 #define PERL_constant_ISPV 6 #define PERL_constant_ISPVN 7 #define PERL_constant_ISSV 8 #define PERL_constant_ISUNDEF 9 #define PERL_constant_ISUV 10 #define PERL_constant_ISYES 11 #ifndef NVTYPE typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ #endif #ifndef aTHX_ #define aTHX_ /* 5.6 or later define this for threading support. */ #endif #ifndef pTHX_ #define pTHX_ /* 5.6 or later define this for threading support. */ #endif static int constant_7 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_ERR LOG_FTP LOG_LPR LOG_NTP LOG_PID LOG_RAS */ /* Offset 4 gives the best switch position. */ switch (name[4]) { case 'E': if (memEQ(name, "LOG_ERR", 7)) { /* ^ */ #ifdef LOG_ERR *iv_return = LOG_ERR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "LOG_FTP", 7)) { /* ^ */ #ifdef LOG_FTP *iv_return = LOG_FTP; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "LOG_LPR", 7)) { /* ^ */ #ifdef LOG_LPR *iv_return = LOG_LPR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "LOG_NTP", 7)) { /* ^ */ #ifdef LOG_NTP *iv_return = LOG_NTP; return PERL_constant_ISIV; #else *iv_return = LOG_DAEMON; return PERL_constant_ISIV; #endif } break; case 'P': if (memEQ(name, "LOG_PID", 7)) { /* ^ */ #ifdef LOG_PID *iv_return = LOG_PID; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "LOG_RAS", 7)) { /* ^ */ #ifdef LOG_RAS *iv_return = LOG_RAS; return PERL_constant_ISIV; #else *iv_return = LOG_AUTH; return PERL_constant_ISIV; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_8 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_AUTH LOG_CONS LOG_CRIT LOG_CRON LOG_INFO LOG_KERN LOG_LFMT LOG_MAIL LOG_NEWS LOG_USER LOG_UUCP */ /* Offset 6 gives the best switch position. */ switch (name[6]) { case 'C': if (memEQ(name, "LOG_UUCP", 8)) { /* ^ */ #ifdef LOG_UUCP *iv_return = LOG_UUCP; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "LOG_USER", 8)) { /* ^ */ #ifdef LOG_USER *iv_return = LOG_USER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "LOG_INFO", 8)) { /* ^ */ #ifdef LOG_INFO *iv_return = LOG_INFO; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "LOG_CRIT", 8)) { /* ^ */ #ifdef LOG_CRIT *iv_return = LOG_CRIT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "LOG_MAIL", 8)) { /* ^ */ #ifdef LOG_MAIL *iv_return = LOG_MAIL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'M': if (memEQ(name, "LOG_LFMT", 8)) { /* ^ */ #ifdef LOG_LFMT *iv_return = LOG_LFMT; return PERL_constant_ISIV; #else *iv_return = LOG_USER; return PERL_constant_ISIV; #endif } break; case 'N': if (memEQ(name, "LOG_CONS", 8)) { /* ^ */ #ifdef LOG_CONS *iv_return = LOG_CONS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "LOG_CRON", 8)) { /* ^ */ #ifdef LOG_CRON *iv_return = LOG_CRON; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "LOG_KERN", 8)) { /* ^ */ #ifdef LOG_KERN *iv_return = LOG_KERN; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "LOG_AUTH", 8)) { /* ^ */ #ifdef LOG_AUTH *iv_return = LOG_AUTH; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'W': if (memEQ(name, "LOG_NEWS", 8)) { /* ^ */ #ifdef LOG_NEWS *iv_return = LOG_NEWS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_9 (pTHX_ const char *name, IV *iv_return, const char **pv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_ALERT LOG_AUDIT LOG_DEBUG LOG_EMERG _PATH_LOG */ /* Offset 5 gives the best switch position. */ switch (name[5]) { case 'E': if (memEQ(name, "LOG_DEBUG", 9)) { /* ^ */ #ifdef LOG_DEBUG *iv_return = LOG_DEBUG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "LOG_ALERT", 9)) { /* ^ */ #ifdef LOG_ALERT *iv_return = LOG_ALERT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'M': if (memEQ(name, "LOG_EMERG", 9)) { /* ^ */ #ifdef LOG_EMERG *iv_return = LOG_EMERG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "LOG_AUDIT", 9)) { /* ^ */ #ifdef LOG_AUDIT *iv_return = LOG_AUDIT; return PERL_constant_ISIV; #else *iv_return = LOG_AUTH; return PERL_constant_ISIV; #endif } break; case '_': if (memEQ(name, "_PATH_LOG", 9)) { /* ^ */ #ifdef _PATH_LOG *pv_return = _PATH_LOG; return PERL_constant_ISPV; #else *pv_return = "/var/run/syslog"; return PERL_constant_ISPV; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_10 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_DAEMON LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_NDELAY LOG_NOTICE LOG_NOWAIT LOG_ODELAY LOG_PERROR LOG_SYSLOG */ /* Offset 9 gives the best switch position. */ switch (name[9]) { case '0': if (memEQ(name, "LOG_LOCAL", 9)) { /* 0 */ #ifdef LOG_LOCAL0 *iv_return = LOG_LOCAL0; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '1': if (memEQ(name, "LOG_LOCAL", 9)) { /* 1 */ #ifdef LOG_LOCAL1 *iv_return = LOG_LOCAL1; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '2': if (memEQ(name, "LOG_LOCAL", 9)) { /* 2 */ #ifdef LOG_LOCAL2 *iv_return = LOG_LOCAL2; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '3': if (memEQ(name, "LOG_LOCAL", 9)) { /* 3 */ #ifdef LOG_LOCAL3 *iv_return = LOG_LOCAL3; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '4': if (memEQ(name, "LOG_LOCAL", 9)) { /* 4 */ #ifdef LOG_LOCAL4 *iv_return = LOG_LOCAL4; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '5': if (memEQ(name, "LOG_LOCAL", 9)) { /* 5 */ #ifdef LOG_LOCAL5 *iv_return = LOG_LOCAL5; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '6': if (memEQ(name, "LOG_LOCAL", 9)) { /* 6 */ #ifdef LOG_LOCAL6 *iv_return = LOG_LOCAL6; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '7': if (memEQ(name, "LOG_LOCAL", 9)) { /* 7 */ #ifdef LOG_LOCAL7 *iv_return = LOG_LOCAL7; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "LOG_NOTIC", 9)) { /* E */ #ifdef LOG_NOTICE *iv_return = LOG_NOTICE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'G': if (memEQ(name, "LOG_SYSLO", 9)) { /* G */ #ifdef LOG_SYSLOG *iv_return = LOG_SYSLOG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "LOG_DAEMO", 9)) { /* N */ #ifdef LOG_DAEMON *iv_return = LOG_DAEMON; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "LOG_PERRO", 9)) { /* R */ #ifdef LOG_PERROR *iv_return = LOG_PERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "LOG_NOWAI", 9)) { /* T */ #ifdef LOG_NOWAIT *iv_return = LOG_NOWAIT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Y': if (memEQ(name, "LOG_NDELA", 9)) { /* Y */ #ifdef LOG_NDELAY *iv_return = LOG_NDELAY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "LOG_ODELA", 9)) { /* Y */ #ifdef LOG_ODELAY *iv_return = LOG_ODELAY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_11 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_CONSOLE LOG_FACMASK LOG_INSTALL LOG_LAUNCHD LOG_NETINFO LOG_PRIMASK LOG_WARNING */ /* Offset 6 gives the best switch position. */ switch (name[6]) { case 'C': if (memEQ(name, "LOG_FACMASK", 11)) { /* ^ */ #ifdef LOG_FACMASK *iv_return = LOG_FACMASK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "LOG_PRIMASK", 11)) { /* ^ */ #ifdef LOG_PRIMASK *iv_return = LOG_PRIMASK; return PERL_constant_ISIV; #else *iv_return = 7; return PERL_constant_ISIV; #endif } break; case 'N': if (memEQ(name, "LOG_CONSOLE", 11)) { /* ^ */ #ifdef LOG_CONSOLE *iv_return = LOG_CONSOLE; return PERL_constant_ISIV; #else *iv_return = LOG_USER; return PERL_constant_ISIV; #endif } break; case 'R': if (memEQ(name, "LOG_WARNING", 11)) { /* ^ */ #ifdef LOG_WARNING *iv_return = LOG_WARNING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "LOG_INSTALL", 11)) { /* ^ */ #ifdef LOG_INSTALL *iv_return = LOG_INSTALL; return PERL_constant_ISIV; #else *iv_return = LOG_USER; return PERL_constant_ISIV; #endif } break; case 'T': if (memEQ(name, "LOG_NETINFO", 11)) { /* ^ */ #ifdef LOG_NETINFO *iv_return = LOG_NETINFO; return PERL_constant_ISIV; #else *iv_return = LOG_DAEMON; return PERL_constant_ISIV; #endif } break; case 'U': if (memEQ(name, "LOG_LAUNCHD", 11)) { /* ^ */ #ifdef LOG_LAUNCHD *iv_return = LOG_LAUNCHD; return PERL_constant_ISIV; #else *iv_return = LOG_DAEMON; return PERL_constant_ISIV; #endif } break; } return PERL_constant_NOTFOUND; } static int constant (pTHX_ const char *name, STRLEN len, IV *iv_return, const char **pv_return) { /* Initially switch on the length of the name. */ /* When generated this function returned values for the list of names given in this section of perl code. Rather than manually editing these functions to add or remove constants, which would result in this comment and section of code becoming inaccurate, we recommend that you edit this section of code, and use it to regenerate a new set of constant functions which you then use to replace the originals. Regenerate these constant functions by feeding this entire source file to perl -x #!perl -w use ExtUtils::Constant qw (constant_types C_constant XS_constant); my $types = {map {($_, 1)} qw(IV PV)}; my @names = (qw(LOG_ALERT LOG_AUTH LOG_AUTHPRIV LOG_CONS LOG_CRIT LOG_CRON LOG_DAEMON LOG_DEBUG LOG_EMERG LOG_ERR LOG_FACMASK LOG_FTP LOG_INFO LOG_KERN LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NDELAY LOG_NEWS LOG_NOTICE LOG_NOWAIT LOG_ODELAY LOG_PERROR LOG_PID LOG_SYSLOG LOG_USER LOG_UUCP LOG_WARNING), {name=>"LOG_AUDIT", type=>"IV", default=>["IV", "LOG_AUTH"]}, {name=>"LOG_CONSOLE", type=>"IV", default=>["IV", "LOG_USER"]}, {name=>"LOG_INSTALL", type=>"IV", default=>["IV", "LOG_USER"]}, {name=>"LOG_LAUNCHD", type=>"IV", default=>["IV", "LOG_DAEMON"]}, {name=>"LOG_LFMT", type=>"IV", default=>["IV", "LOG_USER"]}, {name=>"LOG_NETINFO", type=>"IV", default=>["IV", "LOG_DAEMON"]}, {name=>"LOG_NFACILITIES", type=>"IV", default=>["IV", "30"]}, {name=>"LOG_NTP", type=>"IV", default=>["IV", "LOG_DAEMON"]}, {name=>"LOG_PRIMASK", type=>"IV", default=>["IV", "7"]}, {name=>"LOG_RAS", type=>"IV", default=>["IV", "LOG_AUTH"]}, {name=>"LOG_REMOTEAUTH", type=>"IV", default=>["IV", "LOG_AUTH"]}, {name=>"LOG_SECURITY", type=>"IV", default=>["IV", "LOG_AUTH"]}, {name=>"_PATH_LOG", type=>"PV", default=>["PV", "\"/var/run/syslog\""]}); print constant_types(); # macro defs foreach (C_constant ("Sys::Syslog", 'constant', 'IV', $types, undef, 3, @names) ) { print $_, "\n"; # C constant subs } print "#### XS Section:\n"; print XS_constant ("Sys::Syslog", $types); __END__ */ switch (len) { case 7: return constant_7 (aTHX_ name, iv_return); break; case 8: return constant_8 (aTHX_ name, iv_return); break; case 9: return constant_9 (aTHX_ name, iv_return, pv_return); break; case 10: return constant_10 (aTHX_ name, iv_return); break; case 11: return constant_11 (aTHX_ name, iv_return); break; case 12: /* Names all of length 12. */ /* LOG_AUTHPRIV LOG_SECURITY */ /* Offset 8 gives the best switch position. */ switch (name[8]) { case 'P': if (memEQ(name, "LOG_AUTHPRIV", 12)) { /* ^ */ #ifdef LOG_AUTHPRIV *iv_return = LOG_AUTHPRIV; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "LOG_SECURITY", 12)) { /* ^ */ #ifdef LOG_SECURITY *iv_return = LOG_SECURITY; return PERL_constant_ISIV; #else *iv_return = LOG_AUTH; return PERL_constant_ISIV; #endif } break; } break; case 14: if (memEQ(name, "LOG_REMOTEAUTH", 14)) { #ifdef LOG_REMOTEAUTH *iv_return = LOG_REMOTEAUTH; return PERL_constant_ISIV; #else *iv_return = LOG_AUTH; return PERL_constant_ISIV; #endif } break; case 15: if (memEQ(name, "LOG_NFACILITIES", 15)) { #ifdef LOG_NFACILITIES *iv_return = LOG_NFACILITIES; return PERL_constant_ISIV; #else *iv_return = 30; return PERL_constant_ISIV; #endif } break; } return PERL_constant_NOTFOUND; } Sys-Syslog-0.33/fallback/const-xs.inc000644 000765 000765 00000005007 11344055004 021447 0ustar00maddinguemaddingue000000 000000 void constant(sv) PREINIT: #ifdef dXSTARG dXSTARG; /* Faster if we have it. */ #else dTARGET; #endif STRLEN len; int type; IV iv; /* NV nv; Uncomment this if you need to return NVs */ const char *pv; INPUT: SV * sv; const char * s = SvPV(sv, len); PPCODE: /* Change this to constant(aTHX_ s, len, &iv, &nv); if you need to return both NVs and IVs */ type = constant(aTHX_ s, len, &iv, &pv); /* Return 1 or 2 items. First is error message, or undef if no error. Second, if present, is found value */ switch (type) { case PERL_constant_NOTFOUND: sv = sv_2mortal(newSVpvf("%s is not a valid Sys::Syslog macro", s)); PUSHs(sv); break; case PERL_constant_NOTDEF: sv = sv_2mortal(newSVpvf( "Your vendor has not defined Sys::Syslog macro %s, used", s)); PUSHs(sv); break; case PERL_constant_ISIV: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHi(iv); break; /* Uncomment this if you need to return NOs case PERL_constant_ISNO: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHs(&PL_sv_no); break; */ /* Uncomment this if you need to return NVs case PERL_constant_ISNV: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHn(nv); break; */ case PERL_constant_ISPV: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHp(pv, strlen(pv)); break; /* Uncomment this if you need to return PVNs case PERL_constant_ISPVN: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHp(pv, iv); break; */ /* Uncomment this if you need to return SVs case PERL_constant_ISSV: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHs(sv); break; */ /* Uncomment this if you need to return UNDEFs case PERL_constant_ISUNDEF: break; */ /* Uncomment this if you need to return UVs case PERL_constant_ISUV: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHu((UV)iv); break; */ /* Uncomment this if you need to return YESs case PERL_constant_ISYES: EXTEND(SP, 1); PUSHs(&PL_sv_undef); PUSHs(&PL_sv_yes); break; */ default: sv = sv_2mortal(newSVpvf( "Unexpected return type %d while processing Sys::Syslog macro %s, used", type, s)); PUSHs(sv); } Sys-Syslog-0.33/fallback/syslog.h000644 000765 000765 00000011605 11344055004 020670 0ustar00maddinguemaddingue000000 000000 /* * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_SYSLOG_H #define _SYS_SYSLOG_H 1 #define _PATH_LOG "" /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* security/authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ #define LOG_FTP (11<<3) /* ftp daemon */ #define LOG_NETINFO (12<<3) /* NetInfo */ #define LOG_REMOTEAUTH (13<<3) /* remote authentication/authorization */ #define LOG_INSTALL (14<<3) /* installer subsystem */ #define LOG_RAS (15<<3) /* Remote Access Service (VPN / PPP) */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_LAUNCHD (24<<3) /* launchd - general bootstrap daemon */ #define LOG_NFACILITIES 25 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ #endif /* sys/syslog.h */ Sys-Syslog-0.33/eg/syslog.pl000755 000765 000765 00000000464 11344055004 017714 0ustar00maddinguemaddingue000000 000000 #!/usr/bin/perl use strict; use Sys::Syslog; die "usage: $0 facility/priority message\n" unless @ARGV; my ($facility, $priority) = split '/', shift; my $message = join ' ', @ARGV; openlog($0, "ndelay,pid", $facility) or die "fatal: can't open syslog: $!\n"; syslog($priority, "%s", $message); closelog();