xref: /openbsd-src/regress/usr.sbin/syslogd/args-sigpipe.pl (revision a6e54bb1f1917dad8d0bbbe315aa4e2576ee66ca)
1# The client writes a message to Sys::Syslog native method.
2# The syslogd writes it into a file and through a pipe.
3# The syslogd passes it via UDP to the loghost.
4# The server receives the message on its UDP socket.
5# Find the message in client, file, pipe, syslogd, server log.
6# Check that a SIGPIPE is ignored by syslogd.
7
8use strict;
9use warnings;
10
11our %args = (
12    client => {
13	func => sub { write_between2logs(shift, sub {
14	    my $self = shift;
15	    ${$self->{server}}->loggrep("Signal", 8)
16		or die ref($self), " no 'Signal' between logs";
17	})},
18	loggrep => { get_between2loggrep() },
19    },
20    syslogd => {
21	ktrace => {
22	    qr/syslogd  PSIG  SIGPIPE/ => 0,
23	    qr/syslogd  RET   execve JUSTRETURN/ => 2,
24	},
25	loggrep => { get_between2loggrep() },
26    },
27    server => {
28	func => sub { read_between2logs(shift, sub {
29	    my $self = shift;
30	    ${$self->{syslogd}}->kill_syslogd('PIPE');
31	    sleep 1;  # schedule syslogd
32	    print STDERR "Signal\n";
33	})},
34	loggrep => { get_between2loggrep() },
35    },
36    file => { loggrep => { get_between2loggrep() } },
37    pipe => { loggrep => { get_between2loggrep() } },
38);
39
401;
41