# test EBUSY for splicing from a spliced socket use strict; use warnings; use IO::Socket::IP; use BSD::Socket::Splice "SO_SPLICE"; our %args = ( errno => 'EBUSY', func => sub { my $sl = IO::Socket::IP->new( Proto => "tcp", Listen => 5, LocalAddr => "127.0.0.1", ) or die "socket listen failed: $!"; my $s = IO::Socket::IP->new( Proto => "tcp", PeerAddr => $sl->sockhost(), PeerPort => $sl->sockport(), ) or die "socket connect failed: $!"; my $ss = IO::Socket::IP->new( Proto => "tcp", PeerAddr => $sl->sockhost(), PeerPort => $sl->sockport(), ) or die "socket splice connect failed: $!"; $s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $ss->fileno())) or die "splice failed: $!"; my $so = IO::Socket::IP->new( Proto => "tcp", PeerAddr => $sl->sockhost(), PeerPort => $sl->sockport(), ) or die "socket other failed: $!"; $s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $so->fileno())) and die "splice from spliced socket succeeded"; }, );