summaryrefslogtreecommitdiff
path: root/regress/sys/kern/sosplice/error/args-ENOTCONN.pl
blob: 484e1fc5725aaf5a2955ad9b580210f9b0df2faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# test ENOTCONN for splicing from unconnected socket

use strict;
use warnings;
use IO::Socket;
use BSD::Socket::Splice "SO_SPLICE";

our %args = (
    errno => 'ENOTCONN',
    func => sub {
	my $s = IO::Socket::INET->new(
	    Proto => "tcp",
	) or die "socket failed: $!";

	my $ss = IO::Socket::INET->new(
	    Proto => "tcp",
	) or die "socket splice failed: $!";

	$s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $ss->fileno()))
	    and die "splice from unconnected socket succeeded";
    },
);