]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-event: Update `uio_offset` and `uio_resid` on successful reads
authorEduard Vintilă <eduard.vintila47@gmail.com>
Sat, 11 Mar 2023 18:29:59 +0000 (20:29 +0200)
committerUnikraft <monkey@unikraft.io>
Wed, 26 Apr 2023 10:39:09 +0000 (10:39 +0000)
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ă <eduard.vintila47@gmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #798

lib/posix-event/eventfd.c

index 916103aecb788f0e3eebd031bfe7366469dae963..bb14bb7b6f74d0ce8100673c26cc9aad813e7d32 100644 (file)
@@ -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;
 }