Fix a race in the kqueue-read test. If the writer thread managed to fill
authoranton <anton@openbsd.org>
Sat, 8 May 2021 06:53:19 +0000 (06:53 +0000)
committeranton <anton@openbsd.org>
Sat, 8 May 2021 06:53:19 +0000 (06:53 +0000)
commitfc11865a1bba5c0ce27991e80f018dd8862b48e7
treec7292d4f4a73bf81e760c835097c70f2d1f7760f
parent821603ee0eb6c0b795de75bb2599fc1fc1cccb7d
Fix a race in the kqueue-read test. If the writer thread managed to fill
up the pipe buffer, it will hang in write(2) waiting for the pipe to
become writeable again. While doing so, it cannot observe that the
kqueue thread as already finished implying that ctx_thread_alive() would
return false, meaning no further writes are wanted.

Therefore open the pipe in non blocking mode and just ignore EAGAIN
errors while writing.
regress/sys/kern/pipe/test-kqueue.c