[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v3 3/4] lib/vfscore: sys_ioctl() - Handle FIOCLEX and FIONCLEX requests



Hello Costin,

This patch seems fine.

Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

Thanks & Regards

Sharan


On 9/9/19 11:58 AM, Costin Lupu wrote:

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
  lib/vfscore/syscalls.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/vfscore/syscalls.c b/lib/vfscore/syscalls.c
index 54adc2d2..d375774a 100644
--- a/lib/vfscore/syscalls.c
+++ b/lib/vfscore/syscalls.c
@@ -44,6 +44,7 @@
  #include <stdio.h>
  #include <errno.h>
  #include <fcntl.h>
+#include <sys/ioctl.h>
#include <dirent.h>
  #include <vfscore/prex.h>
@@ -381,14 +382,24 @@ sys_lseek(struct vfscore_file *fp, off_t off, int type, 
off_t *origin)
  int
  sys_ioctl(struct vfscore_file *fp, unsigned long request, void *buf)
  {
-       int error;
+       int error = 0;
DPRINTF(VFSDB_SYSCALL, ("sys_ioctl: fp=%p request=%lux\n", fp, request)); if ((fp->f_flags & (UK_FREAD | UK_FWRITE)) == 0)
                return EBADF;
- error = vfs_ioctl(fp, request, buf);
+       switch (request) {
+       case FIOCLEX:
+               fp->f_flags |= O_CLOEXEC;
+               break;
+       case FIONCLEX:
+               fp->f_flags &= ~O_CLOEXEC;
+               break;
+       default:
+               error = vfs_ioctl(fp, request, buf);
+               break;
+       }
DPRINTF(VFSDB_SYSCALL, ("sys_ioctl: comp error=%d\n", error));
        return error;

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.