]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/vfscore: Handle `FIONBIO` command in `pipe_ioctl()`
authorEduard Vintilă <eduard.vintila47@gmail.com>
Mon, 1 May 2023 16:13:55 +0000 (19:13 +0300)
committerUnikraft <monkey@unikraft.io>
Wed, 10 May 2023 05:56:21 +0000 (05:56 +0000)
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ă <eduard.vintila47@gmail.com>
Reviewed-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
Reviewed-by: Eduard-Florin Mihailescu <mihailescu.eduard@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #874

lib/vfscore/pipe.c

index 98442ed6754b4ae60e44bd6693e8c120e535bfbe..e8ca0d7333e0fd7c1784857858053990f8b32c86 100644 (file)
@@ -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;
        }