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

[Minios-devel] [UNIKRAFT PATCH v3 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:58:01 +0300
  • Cc: sharan.santhanam@xxxxxxxxx
  • Delivery-date: Mon, 09 Sep 2019 09:58:16 +0000
  • Ironport-phdr: 9a23:pcJQpBHce5Td6Rs7RN0IbZ1GYnF86YWxBRYc798ds5kLTJ7zpciwAkXT6L1XgUPTWs2DsrQY0rCQ6vC+EjVQqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5sIBmssAnctcgbjYR/Jqsy1xDEvmZGd+NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLDTRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljjoMOjgk+2/Vl8NwlrpWrhK/qRJizYDaY4abO/hwfq7GYd8WWXBMUtpLWiBdHo+xaZYEAeobPeZfqonwv0UDrRylBQmwBePvzCJDiHnr3a0izuQqDAbL0xAnH9IVrHTUrdP1OL0WUeCo1KnI0C7OYO9N2Tvn8IjIbwsureuWXbJ3aMfcz1QkGQDdjliItIDoMC6Z2v4OvmWb9eZsS/yjhmw9pwx/ujSj28ghhpTTio8Wyl3I7zt1zYg7KNGiVUJ2bsCoHZ1NvC+ALYR2WNktQ2RwtSY/zb0JpIC0cTARyJQi2x7fc/uHc5WU4h77VOaePzN4hHV9dbKhgha960mgyunmWsaoy1ZGtDJFksTXuXwXzRzT7dCLSvp7/ki/xTaCzx3f5+5ZLUwulqfWK4QtzqAumpcRq0jOEDf6mEDsg6+XckUk9PKo6+PiYrj+upCcMJR0ih3/MqQogMC/Bfk4MhATX2WA5eu8z6fv/VXkQLpRlPE2iK7ZvIjAJcsHvq65HxNV0oE75ha6Djem1tUYnX4cLF5cZR2IkZbpNE/KIP3jCfe/gk+skCtwx/zcMbzuHJPNImLEkLf7crZ381RcxxYrzdBD+5JUDakMIOnzWkDrrtzXFBk5Pxavw+n9DtV9yoMeVniJAqCDNaPfqlmI6fwzLOmIfoAaoyzxJOY4562msXhsnF4bfK6ymJcadn28NvBnOFmCJ2rhhJEGC2hZkBA5SbnBj0aeUDgbQ2uqQupo7TYgFIOgS4PeXp2Fi6fHxDqxWIdRMDMVQmuQGGvlIt3XE8wHbzifd5ds
  • Ironport-sdr: J7uFfteeBv2lLjM7jkHrM85b3KR4AINlSZ0Ujvilg9mRicCnE/B2SzclsBT8SBQjhk9MI0u+VP 3TN54SdUrzdw==
  • 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®.