From: Eduard Vintilă Date: Mon, 1 May 2023 16:13:55 +0000 (+0300) Subject: lib/vfscore: Handle `FIONBIO` command in `pipe_ioctl()` X-Git-Tag: RELEASE-0.13.0~35 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b240edc27abe95d22034d1b4ea7d582dd93098c2;p=unikraft%2Funikraft.git lib/vfscore: Handle `FIONBIO` command in `pipe_ioctl()` The current `ioctl` implementation for pipes does not handle the `FIONBIO` command, which leads to a negative error value being returned. This commit introduces a simple case which sets the FNONBLOCK flag when such a command is passed. Signed-off-by: Eduard Vintilă Reviewed-by: Tu Dinh Ngoc Reviewed-by: Eduard-Florin Mihailescu Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #874 --- diff --git a/lib/vfscore/pipe.c b/lib/vfscore/pipe.c index 98442ed67..e8ca0d733 100644 --- a/lib/vfscore/pipe.c +++ b/lib/vfscore/pipe.c @@ -462,6 +462,9 @@ static int pipe_ioctl(struct vnode *vnode, *((int *) data) = pipe_buf_get_available(pipe_buf); uk_mutex_unlock(&pipe_buf->rdlock); return 0; + case FIONBIO: + /* sys_ioctl() already sets f_flags, no need to do anything */ + return 0; default: return -EINVAL; }