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

[Minios-devel] [UNIKRAFT PATCH 16/22] lib/vfscore: introduce fdclose



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 lib/vfscore/main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 5c489a59..98506ad6 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -209,6 +209,25 @@ TRACEPOINT(trace_vfs_close, "%d", int);
 TRACEPOINT(trace_vfs_close_ret, "");
 TRACEPOINT(trace_vfs_close_err, "%d", int);
 
+int fdclose(int fd)
+{
+       struct vfscore_file *fp;
+
+       fp = vfscore_get_file(fd);
+       if (!fp)
+               return EBADF;
+
+       vfscore_put_fd(fd);
+       /* vfscore_get_file increases the f_count. The first fdrop is
+        * to decrement it back. The second is an actual reducing we
+        * are supposed to do while performing fdclose()
+        */
+       fdrop(fp);
+       fdrop(fp);
+
+       return 0;
+}
+
 int close(int fd)
 {
        int error;
-- 
2.19.2


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