summaryrefslogtreecommitdiff
path: root/regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
blob: 56806b933f16d3b2f6bf9ce6f4f2eb45e00a22a8 (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;
use BSD::Socket::Splice "SO_SPLICE";
use IO::Socket::UNIX;

our %args = (
    errno => 'EPROTONOSUPPORT',
    func => sub {
	my $s = IO::Socket::INET->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";
    },
);