From 86fd2b88a37f29226a2e09f215373a04cc23c8c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eduard=20Vintil=C4=83?= Date: Sat, 11 Mar 2023 20:29:59 +0200 Subject: [PATCH] lib/posix-event: Update `uio_offset` and `uio_resid` on successful reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit updates (on a sucessful read) the `uio_offset` and `uio_resid` members of the `uio` structure passed to the `eventfd_vfscore_read` function. Without updating those members, the `read` function from the vfscore layer will always report that no bytes have been read at all. Signed-off-by: Eduard Vintilă Reviewed-by: Cezar Craciunoiu Reviewed-by: Delia Pavel Reviewed-by: Razvan Deaconescu Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #798 --- lib/posix-event/eventfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/posix-event/eventfd.c b/lib/posix-event/eventfd.c index 916103aec..bb14bb7b6 100644 --- a/lib/posix-event/eventfd.c +++ b/lib/posix-event/eventfd.c @@ -173,6 +173,9 @@ static int eventfd_vfscore_read(struct vnode *vnode, uk_mutex_unlock(&efd->lock); + buf->uio_resid = 0; + buf->uio_offset = sizeof(uint64_t); + return 0; } -- 2.39.5