This flag allows conveniently setting O_NONBLOCK without having to use
a separate `fcntl` call.
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #754
struct dentry *vfs_dentry;
struct vnode *vfs_vnode;
- if (unlikely(flags & ~(EFD_CLOEXEC | EFD_SEMAPHORE)))
+ if (unlikely(flags & ~(EFD_CLOEXEC | EFD_SEMAPHORE | EFD_NONBLOCK)))
return -EINVAL;
/* Reserve a file descriptor number */
/* Only the dentry should hold a reference; release ours */
vput(vfs_vnode);
+ if (flags & EFD_NONBLOCK) {
+ ret = fcntl(vfs_fd, F_SETFL, O_NONBLOCK);
+ /* Setting the O_NONBLOCK here must not fail */
+ UK_ASSERT(ret != -1);
+ }
+
return vfs_fd;
ERR_VFS_INSTALL: