Unix-Syslog-1.1/0000755000175100000010000000000011014101552012353 5ustar marcusbinUnix-Syslog-1.1/README0000644000175100000010000001301210700520550013234 0ustar marcusbin Unix::Syslog -- Perl interface to the UNIX system logger ======================================================== Copyright (c) 1999,2000,2001,2002,2007 Marcus Harnisch Disclaimer ========== The text below hasn't really changed in ages and unless someone points me to outdated or otherwise wrong information, I will not re-verify the statements. What you find here is historic and may or may not have any value to you. In particular statements about Sys::Syslog may be completely outdated -- or not. Introduction ============ This Module provides access to the system logger available on most UNIX system via Perl's XSUBs (Perl's C interface). I wrote this module because of some features I missed in Sys::Syslog (see FAQ below) and also to do my first steps into the secrets of Perl's XSUBs. Copyright and distribution ========================== This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 (see file Artistic in this directory). Check clause (4) for your rights to distribute this software. Installation ============ Unix::Syslog is a Perl module that makes use of XSUBs and hence requires a working C compiler and library. Execute the following commands to install this package (`make test' prints the results of a test suite. Execute `make install' only if the required tests finished successfully or if you know what you are doing): perl Makefile.PL make test make install Notes about the test suite ========================== Some of the tests may fail because the respective constants are not available on certain systems. You should be able to distinguish these tests from those that fail because of a malfunction by carefully reading the output of the test routines. The tests that write messages to syslog cannot return a success status since the underlying libc functions don't return appropriate information. To verify that these tests work correctly, you should configure syslogd so that the facility `local7' and priority `info' will be written to a file. OS dependent behaviour and portability ====================================== This package uses system specific functions. Programs that uses this package may not be portable in any case. If you plan to write portable code using this package, please consult the manuals of the systems you wish to run the software on. Then modify your program accordingly. As of version 0.99 Unix::Syslog provides two functions priorityname() and facilityname() that return the names of priority and facility, respectively. This functionality is only enabled if an according `#define' is enabled through Makefile.PL. By default this statement is commented out. Known bugs ========== OS Description Workaround --------------------------------------------------------------------------- Linux On systems using glibc2 (<= version 2.1), None possible. setting the log mask has no effect. Frequently Asked Questions ========================== 1. What is the benefit of using this module instead of Sys::Syslog? Sys::Syslog always opens a network connection to the syslog service. At least on Linux systems this may lead to some trouble, because o Linux syslogd (from package sysklogd) does not listen to the network by default. Most people working on stand-alone machines (including me) didn't see any reason why to enable this option. Others didn't enable it for security reasons. OS-independent, some sysadmins may run a firewall on their network that blocks connections to port 514/udp. o By default Linux syslogd doesn't forward messages which have already already received from the network to other log hosts. There are reasons not to enable this option unless it is really necessary. Looping messages resulting from a misconfiguration may break down your (log-)system. Peter Stamfest pointed out some other advantages of Unix::Syslog, I didn't came across my self. o LOG_PERROR works. o works with perl -Tw without warnings and problems due to tainted data as it is the case for Sys::Syslog in some special applications. [Especially when running a script as root] 2. Well, is there any reason to use Sys::Syslog any longer? Yes! In contrary to Unix::Syslog, Sys::Syslog works even if you don't have a syslog daemon running on your system as long as you are connected to a log host via a network and have access to the syslog.h header file of your log host to generate the initial files for Sys::Syslog (see Sys::Syslog(3) for details). Unix::Syslog only logs to your local syslog daemon which in turn may be configured to distribute the message over the network. 3. Are calls to the functions provided by Unix::Syslog compatible to those of Sys::Syslog? Currently not. Sys::Syslog requires strings to specify many of the arguments to the functions, while Unix::Syslog uses numeric constants accessed via macros as defined in syslog.h. Although the strings used by Sys::Syslog are also defined in syslog.h, it seems that most people got used to the numeric arguments. I will implement the string based calls if there are enough people ($min_people > 10**40) complaining about the lack of compatibility. Comments, Bug reports and Suggestions ===================================== Please direct anything you wish to tell me about this package to the address given below. Have fun, Marcus Harnisch Unix-Syslog-1.1/Changes0000644000175100000010000000711311014100276013652 0ustar marcusbin-*- mode: text -*- Revision history for Perl extension Unix::Syslog. 1.1 Sun May 18 21:13:38 2007 - Released version 1.1. - Clearly marked MSWin32 systems as unsupported. (How do 64bit Windows system identify themselves?) - Fixed bug that caused Perl to segfault when closelog() was called before openlog(). 1.0 Tue Oct 2 22:22:43 2007 - Bumped version number to 1.0. - License has changed to Artistic 2.0! - (Syslog.pm) Get rid of `require AutoLoader', which was wrong to begin with. 0.100 Wed Aug 28 17:09:37 2002 - (test.pl) Major changes due to complete misunderstanding of eval() - (Syslog.pm) Updated version number - (Makefile.PL) Cleanup 0.99 Wed Aug 14 21:05:43 2002 - Added functions priorityname() and facilityname(). - Updated docs. 0.98 Tue Jan 22 22:24:39 2002 - (Syslog.pm) Instead of quoting percent-signs in syslog()-wrapper, simply pass the string to libc-syslog() as string argument via %s. Reported by Gisle Aas . - (Syslog.xs) When calling libc-syslog() internally, pass message as string argument, not as format string. Copy ident-argument using some Perl-API functions. Just using a reference counter had unwanted side-effects. Reported by Gisle Aas . - (TODO) Declared only plan for extending Unix::Syslog for unfeasable with current versions of Perl. - Renamed distribution archive to Unix-Syslog-. I just discovered the `tardist' target in the Makefile :^) 0.97 Wed Dec 12 03:39:15 2001 - (Syslog.pm) Updated version number. - (Syslog.xs) Increase openlog()'s ident argument reference counter, in order to achieve correct behaviour in case openlog()'s first argument is a function call. Reported by David Landgren. - (test.pl) Check that the changes to Syslog.xs actually work. 0.96 Tue Sep 25 01:17:00 2001 - (test.pl) Add tests to clarify meaning of LOG_MASK and LOG_UPTO. 0.95 Wed Feb 07 21:43:00 2001 - (Syslog.pm) Fixed a message formatting bug in the syslog() wrapper (reported by Eric Kuzniar and partly fixed by Mike DeVaynes ). Multiple expansion (sprintf,syslog) of format string and arguments, in some cases resulted in malformed messages. - (test.pl) Added some tests related to that bug fix - (README) Added some details about the test suite. 0.94 Sun Aug 20 23:25:00 2000 - (Makefile.PL) Added '-lc' to LIBS which seems to be necessary to compile Unix::Syslog on NEC EWS4800 machines (reported by Oota Toshiya ). - (Syslog.pm) Fixed severe bug in documentation of setlogmask() and the according macros. - (README) FAQ synched with pod section in Syslog.pm 0.93 Wed Mar 15 19:20:40 2000 - Changed author's e-mail address to - Synched the version number of the module with the actual version of Unix::Syslog - Fixed some typos in the documentation 0.92 Sun Nov 28 15:24:15 1999 - (README): Corrected a big howler and some other stuff 0.91 Sun Oct 24 17:47:03 1999 - (README): Minor corrections 0.90 Sun Feb 20 19:32:34 1999 - Finally finished documentation 0.01 Thu Aug 6 20:51:16 1998 - original version; created by h2xs 1.18 Unix-Syslog-1.1/test.pl0000644000175100000010000001570410761504542013714 0ustar marcusbin# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..54\n"; } END {print "not ok 1\n" unless $loaded;} use Unix::Syslog qw(:macros :subs); $loaded = 1; print "ok 1\n"; ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): sub check_defined($$) { printf "%-20s", $_[0]; if (defined eval "$_[0]") { print " ok $_[1]\n"; return 0; } else { print " not ok $_[1]\n"; return 1; } } sub check_defined_skip($$) { printf "%-20s", $_[0]; if (defined eval "$_[0]") { print " ok $_[1]\n"; return 0; } else { print " skipped $_[1]\n"; return 1; } } my $n = 2; my $failures = 0; print "Testing priorities:\n"; $failures += check_defined('LOG_EMERG', $n++); $failures += check_defined('LOG_EMERG', $n++); $failures += check_defined('LOG_ALERT', $n++); $failures += check_defined('LOG_CRIT', $n++); $failures += check_defined('LOG_ERR', $n++); $failures += check_defined('LOG_WARNING', $n++); $failures += check_defined('LOG_NOTICE', $n++); $failures += check_defined('LOG_INFO', $n++); $failures += check_defined('LOG_DEBUG', $n++); $failures += check_defined('LOG_EMERG', $n++); $failures += check_defined('LOG_ALERT', $n++); $failures += check_defined('LOG_CRIT', $n++); $failures += check_defined('LOG_ERR', $n++); $failures += check_defined('LOG_WARNING', $n++); $failures += check_defined('LOG_NOTICE', $n++); $failures += check_defined('LOG_INFO', $n++); $failures += check_defined('LOG_DEBUG', $n++); print "\nTesting facilities\n"; $fac = 0; $failures += check_defined('LOG_KERN', $n++); $failures += check_defined('LOG_USER', $n++); $failures += check_defined('LOG_MAIL', $n++); $failures += check_defined('LOG_DAEMON', $n++); $failures += check_defined('LOG_AUTH', $n++); $failures += check_defined('LOG_SYSLOG', $n++); $failures += check_defined('LOG_LPR', $n++); $failures += check_defined('LOG_NEWS', $n++); $failures += check_defined('LOG_UUCP', $n++); $failures += check_defined('LOG_CRON', $n++); $failures += check_defined('LOG_LOCAL0', $n++); $failures += check_defined('LOG_LOCAL1', $n++); $failures += check_defined('LOG_LOCAL2', $n++); $failures += check_defined('LOG_LOCAL3', $n++); $failures += check_defined('LOG_LOCAL4', $n++); $failures += check_defined('LOG_LOCAL5', $n++); $failures += check_defined('LOG_LOCAL6', $n++); $failures += check_defined('LOG_LOCAL7', $n++); print "\nThese facilities are not defined on all systems:\n"; $failures += check_defined_skip('LOG_AUTHPRIV', $n++); $failures += check_defined_skip('LOG_FTP', $n++); print "\nThe number of available facilities is:\n"; $failures += check_defined('LOG_NFACILITIES ', $n++); $failures += check_defined('LOG_FACMASK', $n++); print "\nTesting options\n"; $failures += check_defined('LOG_PID', $n++); $failures += check_defined('LOG_CONS', $n++); $failures += check_defined('LOG_ODELAY', $n++); $failures += check_defined('LOG_NDELAY', $n++); $failures += check_defined('LOG_NOWAIT', $n++); print "\nThese options are not defined on all systems:\n"; $failures += check_defined_skip('LOG_PERROR', $n++); print "\nTesting macros for setlogmask()\n"; $failures += check_defined('LOG_MASK(1)', $n++); $failures += check_defined('LOG_UPTO(1)', $n++); print "\nThese macros are not defined on all systems:\n"; $failures += check_defined_skip('LOG_PRI(1)', $n++); $failures += check_defined_skip('LOG_MAKEPRI(1,1)', $n++); $failures += check_defined_skip('LOG_FAC(1)', $n++); print "\nOn some systems these functions are undefined and\n", "return just empty strings:\n"; $failures += check_defined_skip('priorityname(LOG_EMERG)', $n++); $failures += check_defined_skip('facilityname(LOG_KERN)', $n++); print "\nTesting setlogmask:\n"; print "Setting mask to ", LOG_MASK(LOG_INFO), "\n"; $oldmask = setlogmask(LOG_MASK(LOG_INFO)); $newmask = setlogmask($oldmask); print "New mask is $newmask "; if ($newmask != LOG_MASK(LOG_INFO)) { $failures++; print "not "; } print "ok ", $n++, "\n"; if ($failures == 0) { print "\n*** Congratulations! All tests passed.\n\n"; } else { print "\n*** Test results: ", $n-1-$failures, " tests of ", $n-1, " passed!\n\n"; } print < 'Unix::Syslog', 'VERSION_FROM' => 'Syslog.pm', # finds $VERSION 'LIBS' => ['-lc'], # e.g., '-lm' 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' # 'DEFINE' => '-DSYSLOG_NAMES', 'INC' => '', # e.g., '-I/usr/include/other' ); Unix-Syslog-1.1/META.yml0000644000175100000010000000045011014101552013623 0ustar marcusbin# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Unix-Syslog version: 1.1 version_from: Syslog.pm installdirs: site requires: distribution_type: module generated_by: ExtUtils::MakeMaker version 6.30 Unix-Syslog-1.1/Syslog.pm0000644000175100000010000002210711014101376014177 0ustar marcusbin# $Id: Syslog.pm,v 1.12 2008/05/18 19:26:54 marcus Exp $ # # Copyright (c) 1999,2000,2001,2002,2007 Marcus Harnisch # # This program is free software; you can redistribute it and/or modify # it under the terms of the Artistic License 2.0 (see file Artistic in # this directory). # # Check clause (4) for your rights to distribute this software. package Unix::Syslog; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @EXPORT_OK = qw(LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG LOG_KERN LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON LOG_AUTHPRIV LOG_FTP LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_PID LOG_CONS LOG_ODELAY LOG_NDELAY LOG_NOWAIT LOG_PERROR LOG_NFACILITIES LOG_FACMASK LOG_FAC LOG_MASK LOG_PRI LOG_UPTO LOG_MAKEPRI closelog openlog syslog setlogmask priorityname facilityname); %EXPORT_TAGS = ("macros" => [qw(LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG LOG_KERN LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON LOG_AUTHPRIV LOG_FTP LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_PID LOG_CONS LOG_ODELAY LOG_NDELAY LOG_NOWAIT LOG_PERROR LOG_NFACILITIES LOG_FACMASK LOG_FAC LOG_MASK LOG_PRI LOG_UPTO LOG_MAKEPRI)], "subs" => [qw(closelog openlog syslog setlogmask priorityname facilityname)]); $VERSION = '1.1'; bootstrap Unix::Syslog $VERSION; # Preloaded methods go here. sub syslog($$@) { my $priority = shift; my $format = shift; $format =~ s/((?:[^%]|^)(?:%%)*)%m/$1$!/g; my $msg = sprintf($format,@_); _isyslog($priority, $msg); } # openlog, closelog and setlogmask don't need a wrapper 1; __END__ # Below is the stub of documentation for your module. You better edit it! =head1 NAME Unix::Syslog - Perl interface to the UNIX syslog(3) calls =head1 SYNOPSIS use Unix::Syslog qw(:macros); # Syslog macros use Unix::Syslog qw(:subs); # Syslog functions openlog $ident, $option, $facility; syslog $priority, $format, @formatargs; closelog; $oldmask = setlogmask $mask_priority; =head1 DESCRIPTION This module provides an interface to the system logger B(8) via Perl's XSUBs. The implementation attempts to resemble the native libc-functions of your system, so that anyone being familiar with F should be able to use this module right away. In contrary to Sys::Syslog(3), this modules does not open a network connection to send the messages. This can help you to avoid opening security holes in your computer (see L<"FAQ">). The subs imported by the tag C are simply wrappers around the most important C<#defines> in your system's C header file F. The macros return integer values that are used to specify options, facilities and priorities in a more or less portable way. They also provide general information about your local syslog mechanism. Check syslog(3) and your local F for information about the macros, options and facilities available on your system. The following functions are provided: =over =item openlog $ident, $option, $facility opens a connection to the system logger. I<$ident> is an identifier string that B(8) prints into every message. It usually equals the process name. I<$option> is an integer value that is the result of ORed options. I<$facility> is an integer value that specifies the part of the system the message should be associated with (e.g. kernel message, mail subsystem). =item syslog $priority, $format, @formatargs Generates a log message and passes it to the system logger. If C is called without calling C first, probably system dependent default values will be used as arguments for an implicit call to C. I<$priority> is an integer value that specifies the priority of the message. Alternatively I<$priority> can be the ORed value of a priority and a facility. In that case a previously selected facility will be overridden. In the case that C is called without calling C first and I does not specify both a priority I a facility, a default facility will be used. This behaviour is most likely system dependent and the user should not rely on any particular value in that case. I<$format> is a format string in the style of printf(3). Additionally to the usual printf directives C<%m> can be specified in the string. It will be replaced implicitly by the contents of the Perl variable C<$!> (C<$ERRNO>). I<@formatargs> is a list of values that the format directives will be replaced with subsequently. =item closelog closes the connection to the system logger. =item setlogmask $mask_priority sets the priority mask and returns the old mask. Logging is enabled for the priorities indicated by the bits in the mask that are set and is disabled where the bits are not set. Macros are provided to specify valid and portable arguments to C. Usually the default log mask allows all messages to be logged. =item priorityname $priority returns a string containing the name of I<$priority> as string. If this functionality has not been enabled at installation, the function returns I. =item facilityname $facility returns a string containing the name of I<$facility> as string. If this functionality has not been enabled at installation, the function returns I. =back B: The behaviour of this module is system dependent. It is highly recommended to consult your system manual for available macros and the behaviour of the provided functions. =head1 RETURN VALUES The functions openlog(), syslog() and closelog() return the undefined value. The function setlogmask returns the previous mask value. =head1 EXAMPLES Open a channel to syslogd specifying an identifier (usually the process name) some options and the facility: C Generate log message of specified priority using a printf-type formatted string: C Set log priority mask to block all messages but those of priority C: C<$oldmask = setlogmask(LOG_MASK(LOG_DEBUG))> Set log priority mask to block all messages with a higher priority than C: C<$oldmask = setlogmask(LOG_UPTO(LOG_ERR))> Close channel to syslogd: C =head1 FAQ =over =item 1. What is the benefit of using this module instead of Sys::Syslog? Sys::Syslog always opens a network connection to the syslog service. At least on Linux systems this may lead to some trouble, because =over 4 =item * Linux syslogd (from package sysklogd) does not listen to the network by default. Most people working on stand-alone machines (including me) didn't see any reason why to enable this option. Others didn't enable it for security reasons. OS-independent, some sysadmins may run a firewall on their network that blocks connections to port 514/udp. =item * By default Linux syslogd doesn't forward messages which have already already received from the network to other log hosts. There are reasons not to enable this option unless it is really necessary. Looping messages resulting from a misconfiguration may break down your (log-)system. =back Peter Stamfest pointed out some other advantages of Unix::Syslog, I didn't came across my self. =over =item * LOG_PERROR works. =item * works with perl -Tw without warnings and problems due to tainted data as it is the case for Sys::Syslog in some special applications. [Especially when running a script as root] =back =item 2. Well, is there any reason to use Sys::Syslog any longer? Yes! In contrary to Unix::Syslog, Sys::Syslog works even if you don't have a syslog daemon running on your system as long as you are connected to a log host via a network and have access to the F header file of your log host to generate the initial files for Sys::Syslog (see Sys::Syslog(3) for details). Unix::Syslog only logs to your local syslog daemon which in turn may be configured to distribute the message over the network. =item 3. Are calls to the functions provided by Unix::Syslog compatible to those of Sys::Syslog? Currently not. Sys::Syslog requires strings to specify many of the arguments to the functions, while Unix::Syslog uses numeric constants accessed via macros as defined in F. Although the strings used by Sys::Syslog are also defined in F, it seems that most people got used to the numeric arguments. I will implement the string based calls if there are enough people (I<$min_people> > 10**40) complaining about the lack of compatibility. =back =head1 SEE ALSO syslog(3), Sys::Syslog(3), syslogd(8), perl(1) =head1 AUTHOR Marcus Harnisch =cut Unix-Syslog-1.1/Syslog.xs0000644000175100000010000000753011014030737014222 0ustar marcusbin#ifdef __cplusplus extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif #include static SV *ident_svptr = NULL; MODULE = Unix::Syslog PACKAGE = Unix::Syslog # $Id: Syslog.xs,v 1.8 2008/05/18 13:40:47 marcus Exp $ # # Copyright (c) 1999,2000,2001,2002,2007 Marcus Harnisch # # This program is free software; you can redistribute it and/or modify # it under the terms of the Artistic License 2.0 (see file Artistic in # this directory). # # Check clause (4) for your rights to distribute this software. PROTOTYPES: DISABLE # Log priorities int _LOG_PRIORITY() ALIAS: LOG_EMERG = LOG_EMERG LOG_ALERT = LOG_ALERT LOG_CRIT = LOG_CRIT LOG_ERR = LOG_ERR LOG_WARNING = LOG_WARNING LOG_NOTICE = LOG_NOTICE LOG_INFO = LOG_INFO LOG_DEBUG = LOG_DEBUG CODE: RETVAL = ix; OUTPUT: RETVAL # Log facilities int _LOG_FACILITY() ALIAS: LOG_KERN = LOG_KERN LOG_USER = LOG_USER LOG_MAIL = LOG_MAIL LOG_DAEMON = LOG_DAEMON LOG_AUTH = LOG_AUTH LOG_SYSLOG = LOG_SYSLOG LOG_LPR = LOG_LPR LOG_NEWS = LOG_NEWS LOG_UUCP = LOG_UUCP LOG_CRON = LOG_CRON LOG_LOCAL0 = LOG_LOCAL0 LOG_LOCAL1 = LOG_LOCAL1 LOG_LOCAL2 = LOG_LOCAL2 LOG_LOCAL3 = LOG_LOCAL3 LOG_LOCAL4 = LOG_LOCAL4 LOG_LOCAL5 = LOG_LOCAL5 LOG_LOCAL6 = LOG_LOCAL6 LOG_LOCAL7 = LOG_LOCAL7 CODE: RETVAL = ix; OUTPUT: RETVAL #if defined(LOG_AUTHPRIV) int LOG_AUTHPRIV() CODE: RETVAL = LOG_AUTHPRIV; OUTPUT: RETVAL #endif #if defined(LOG_FTP) int LOG_FTP() CODE: RETVAL = LOG_FTP; OUTPUT: RETVAL #endif # Arguments to setlogmask int LOG_MASK(pri) int pri CODE: RETVAL = LOG_MASK(pri); OUTPUT: RETVAL int LOG_UPTO(pri) int pri CODE: RETVAL = LOG_UPTO(pri); OUTPUT: RETVAL # Option flags int _LOG_OPTIONS() ALIAS: LOG_PID = LOG_PID LOG_CONS = LOG_CONS LOG_ODELAY = LOG_ODELAY LOG_NDELAY = LOG_NDELAY LOG_NOWAIT = LOG_NOWAIT CODE: RETVAL = ix; OUTPUT: RETVAL #if defined(LOG_PERROR) int LOG_PERROR() CODE: RETVAL = LOG_PERROR; OUTPUT: RETVAL #endif #if defined(LOG_PRI) int LOG_PRI(pri) int pri CODE: RETVAL = LOG_PRI(pri); OUTPUT: RETVAL #endif #if defined(LOG_MAKEPRI) int LOG_MAKEPRI(fac, pri) int fac int pri CODE: RETVAL = LOG_MAKEPRI(fac, pri); OUTPUT: RETVAL #endif #if defined(LOG_FAC) int LOG_FAC(p) int p CODE: RETVAL = LOG_FAC(p); OUTPUT: RETVAL #endif #ifdef SYSLOG_NAMES char* priorityname(p) int p INIT: int i; CODE: for (i=0; prioritynames[i].c_val != p && prioritynames[i].c_val != -1; i++) {} if (prioritynames[i].c_val == -1) RETVAL=""; else RETVAL=prioritynames[i].c_name; OUTPUT: RETVAL char* facilityname(f) int f INIT: int i; CODE: for (i=0; facilitynames[i].c_val != f && facilitynames[i].c_val != -1; i++) {} if (facilitynames[i].c_val == -1) RETVAL=""; else RETVAL=facilitynames[i].c_name; OUTPUT: RETVAL #else char* priorityname(p) int p CODE: XSRETURN_UNDEF; char* facilityname(f) int f CODE: XSRETURN_UNDEF; #endif # Miscellaneous constants int LOG_NFACILITIES() CODE: RETVAL = LOG_NFACILITIES; OUTPUT: RETVAL int LOG_FACMASK() CODE: RETVAL = LOG_FACMASK; OUTPUT: RETVAL # Open connection to system logger void openlog(ident, option, facility) 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); # Internal function to generate Log message void _isyslog(priority, message) int priority char *message CODE: syslog(priority, "%s", message); # Set log mask int setlogmask(mask) int mask CODE: setlogmask(mask); # Close connection to system logger void closelog() CODE: closelog(); if ((ident_svptr != NULL) && SvREFCNT(ident_svptr)) SvREFCNT_dec(ident_svptr); Unix-Syslog-1.1/MANIFEST0000644000175100000010000000023011014101552013477 0ustar marcusbinArtistic Changes MANIFEST Makefile.PL README Syslog.pm Syslog.xs test.pl META.yml Module meta-data (added by MakeMaker)