summaryrefslogtreecommitdiff
path: root/regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
blob: e8c634d2a5a642906f0ddffd762ad2f187217889 (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
# test EPROTONOSUPPORT for splicing inet and unix sockets

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

our %args = (
    errno => 'EPROTONOSUPPORT',
    func => sub {
	my $s = IO::Socket::IP->new(
	    Proto => "udp",
	    LocalAddr => "127.0.0.1",
	) or die "socket bind failed: $!";

	my $ss = IO::Socket::UNIX->new(
	    Type => SOCK_STREAM,
	) or die "socket splice failed: $!";

	$s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $ss->fileno()))
	    and die "splice inet and unix sockets succeeded";
    },
);