1# The syslogd is started with reduced file descriptor limits.
2# The syslogd config is reread after SIGHUP.
3# The client writes a message to Sys::Syslog native method.
4# The syslogd writes it into a file and through a pipe.
5# The syslogd passes it via UDP to the loghost.
6# The server receives the message on its UDP socket.
7# Find the message in client, file, pipe, syslogd, server log.
8# Check the error messages and multiple log file content.
9
10use strict;
11use warnings;
12
13our %args = (
14    client => {
15	func => sub { write_between2logs(shift, sub {
16	    my $self = shift;
17	    ${$self->{server}}->loggrep("Signal", 8)
18		or die ref($self), " no 'Signal' between logs";
19	})},
20	loggrep => { get_between2loggrep() },
21    },
22    syslogd => {
23	options => ["-u"],
24	conf => join("", map { "*.*\t\$objdir/file-$_.log\n" } 0..19),
25	rlimit => {
26	    RLIMIT_NOFILE => 30,
27	},
28	loggrep => {
29	    # If not in startup, each failed PRIV_OPEN_LOG is logged
30	    # to tty, so PRIV_OPEN_TTY fails again.
31	    qr/syslogd: receive_fd: recvmsg: Message too long/ => '>='.(4+2*4),
32	    # During first initialization the lockpipe is open.  When
33	    # SIGHUP happens it is closed and one more file can be opened.
34	    qr/X FILE:/ => 1+14+1+15,
35	    qr/X UNUSED:/ => 6+5,
36	},
37    },
38    server => {
39	func => sub { read_between2logs(shift, sub {
40	    my $self = shift;
41	    ${$self->{syslogd}}->kill_syslogd('HUP');
42	    ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
43		or die ref($self), " no 'syslogd: restarted' between logs";
44	    print STDERR "Signal\n";
45	})},
46	loggrep => {
47	    get_between2loggrep(),
48	    qr/Signal/ => 1,
49	    qr/Accepted/ => 1,
50	},
51    },
52    multifile => [
53	(map { { loggrep => get_testgrep() } } 0..14),
54	(map { { loggrep => { qr/./s => 0 } } } 15..19),
55    ],
56    user => {
57	loggrep => {
58	    get_firstlog() => 1,
59	    get_testlog() => 0,
60	}
61    },
62);
63
641;
65