diff options
Diffstat (limited to 'regress/sys/kern/sosplice/tcp/args-relay-write-forked.pl')
-rw-r--r-- | regress/sys/kern/sosplice/tcp/args-relay-write-forked.pl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/regress/sys/kern/sosplice/tcp/args-relay-write-forked.pl b/regress/sys/kern/sosplice/tcp/args-relay-write-forked.pl new file mode 100644 index 00000000000..5496bd3291e --- /dev/null +++ b/regress/sys/kern/sosplice/tcp/args-relay-write-forked.pl @@ -0,0 +1,38 @@ +# test concurrent write and splice + +use strict; +use warnings; +use POSIX; +use Time::HiRes; + +our %args = ( + client => { + len => 2**20, + }, + relay => { + func => sub { + defined(my $pid = fork()) + or die "relay func: fork failed: $!"; + if ($pid == 0) { + my $n; + do { + $n = syswrite(STDOUT, "\n foo bar\n"); + sleep .01; + } while (!defined($n) || $n); + POSIX::_exit(0); + } + # give the userland a moment to wite, even if splicing + sleep .1; + relay(@_); + kill 9, $pid; + }, + }, + server => { + func => sub { sleep 2; read_stream(@_); }, + # As syswrite() adds data to the socket, the content length is not + # correct. Disable the checks. + nocheck => 1, + }, + len => 1048576, + md5 => '6649bbec13f3d7efaedf01c0cfa54f88', +); |