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

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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 9 Sep 2019 12:07:53 +0300
  • Cc: sharan.santhanam@xxxxxxxxx
  • Delivery-date: Mon, 09 Sep 2019 09:08:17 +0000
  • Ironport-phdr: 9a23:iGU7zBBOlyITNuVK1jilUyQJP3N1i/DPJgcQr6AfoPdwSPT5o8bcNUDSrc9gkEXOFd2Cra4d0ayP4/6rATxIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfK1+IA+roQjSt8QajpduJ6UswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9VoAyvqQFxzYDXZ4+aNvR+c7jBcd8GX2dNQtxcWzBdDo66coABD/ABPeFdr4TluVYOqgC+BRWtBOPp1zRGgGL23bUn0+88FgzJwAsgH8kSsHTVqtX5LqMSUf2tzKnV1jjMc+hW1S3l6IjVaR8tu+uMXbVpfMfX1EIhFBvFg02NpYHqIj+ZzOcAvmiB4+Z+S+6iiXQrpg9prjSyycogl5PFi4EVx1ze6yl0zog4KcelREN0f9KpFoZbuTuAOItsWMwiRnlluCM9yrIbp5G2ZDMKyJE7xx7HbPyHbpSI7grjVOmPJTd4g2poeKy6hxmo8EigzvfwWdWv0FpQtipFj8LDumoX1xzU8sSHS/198Vm92TuXygze5fxILVo3mKfbMZIt3KA8m5gJvUnNBiP2nV/5jK6SdkUq4Oio7OHnb636qZ+bLI90lgD+MqI0lsy7HOQ4KhUOUnOH9uSnzrHj5VD5T65Qgv0slanVqIraKtgDpq6lHw9V1Z4u6xO+Dzeg0dQYmmIHIEtYdx2ZkYjmJVXOLev8Dfe+mFSsjCxry+rJP7L/BJXBNH/DkK3ufbxl8U5T1BIzzcxD55JTErwBO/LzVVXrtNPCCB81KRe0zPzhCNVh1oMRQ2SPDbWcMK7Jt1+H+P4gI+2Wa4AOojryNeUltLbSiio8mFkcerLs0ZYJZXSQGvV9P17fcXfqxNAbHjQkpA07Gcftk0GDV3Z3em6vF/Y34SonCYTgCZrbW6imm/qZwS39BJoANTMOMUyFDXq9L9bMYPwLci/HesI=
  • Ironport-sdr: nOGkmAe/EJs12RXXCN0wC5XfXpXMgevql9X7uma1YV2bmEnRRDD3jvAjMHKt2emIteRxpJLucI K4o1G6mxDm9A==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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;
-- 
2.20.1


_______________________________________________
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®.