summaryrefslogtreecommitdiff
path: root/regress/sys/kern/splice/error-EOPNOTSUPP.pl
blob: 4d5831dc5004d7c36fa144ca00859a380f37d5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
# test EOPNOTSUPP for splicing from listen socket

use Errno;
use IO::Socket;
use BSD::Socket::Splice "SO_SPLICE";

my $s = IO::Socket::INET->new(
    Proto => "tcp",
    Listen => 1,
) 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 listen socket succeeded";
$!{EOPNOTSUPP}
    or die "error not EOPNOTSUPP: $!"