summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/args-maxunix.pl
blob: f670b888727bd822968c7db452d27eebf7b229ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# The client writes messages to MAXUNIX unix domain sockets.
# The syslogd -a writes them into a file and through a pipe.
# The syslogd -a passes them via UDP to the loghost.
# The server receives the messages on its UDP socket.
# Find the message in client, file, pipe, syslogd, server log.
# Check that the file log contains a message from every socket.
# Check that no error is printed.

use strict;
use warnings;
use IO::Socket::UNIX;
use constant MAXUNIX => 21;

our %args = (
    client => {
	func => sub {
	    my $self = shift;
	    write_unix($self);
	    foreach (1..(MAXUNIX-1)) {
		write_unix($self, "unix-$_.sock");
	    }
	    write_shutdown($self);
	},
    },
    syslogd => {
	options => [ map { ("-a" => "unix-$_.sock") } (1..(MAXUNIX-1)) ],
	loggrep => {
	    qr/out of descriptors/ => 0,
	},
    },
    file => {
	loggrep => {
	    get_testlog()." /dev/log unix socket" => 1,
	    (map { (get_testlog()." unix-$_.sock unix socket" => 1) }
		(1..(MAXUNIX-1))),
	    get_testlog()." unix-".MAXUNIX.".sock unix socket" => 0,
	},
    },
);

1;