summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/funcs.pl
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-09-09 08:48:47 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-09-09 08:48:47 +0000
commit02b5a612ffd485b39d832c2989d534b1b1707063 (patch)
tree73d19ffe45322d7b3c9a5f772b5ccb133cbaaea5 /regress/usr.sbin/syslogd/funcs.pl
parentf6180bfaa203662fa7c0ebc2e48f2a05761f61df (diff)
Test that syslogd can process 8 full size messages from sendsyslog(2)
or UDP socket or UNIX domain socket at once.
Diffstat (limited to 'regress/usr.sbin/syslogd/funcs.pl')
-rw-r--r--regress/usr.sbin/syslogd/funcs.pl13
1 files changed, 11 insertions, 2 deletions
diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl
index 1fe21a45c16..a11b63166c1 100644
--- a/regress/usr.sbin/syslogd/funcs.pl
+++ b/regress/usr.sbin/syslogd/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.23 2015/07/19 20:18:18 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.24 2015/09/09 08:48:46 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -85,7 +85,10 @@ sub write_message {
if (defined($self->{connectdomain})) {
my $msg = join("", @_);
- if ($self->{connectproto} eq "udp") {
+ if ($self->{connectdomain} eq "sendsyslog") {
+ sendsyslog($msg)
+ or die ref($self), " sendsyslog failed: $!";
+ } elsif ($self->{connectproto} eq "udp") {
# writing UDP packets works only with syswrite()
defined(my $n = syswrite(STDOUT, $msg))
or die ref($self), " write log line failed: $!";
@@ -101,6 +104,12 @@ sub write_message {
}
}
+sub sendsyslog {
+ my $msg = shift;
+ require 'sys/syscall.ph';
+ return syscall(&SYS_sendsyslog, $msg, length($msg)) != -1;
+}
+
sub write_shutdown {
my $self = shift;