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

[Minios-devel] [UNIKRAFT PATCH 1/5] plat/linuxu: Add fstat and open host system calls



Add system call number for arm_32 and x86_64 for the fstat system call
Implement system call wrapper function for open and fstat
Add MAP_PRIVATE constant for use with mmap

Signed-off-by: Robert Hrusecky <roberth@xxxxxxxxxxxxx>
Signed-off-by: Omar Jamil <omarj2898@xxxxxxxxx>
Signed-off-by: Sachin Beldona <sachinbeldona@xxxxxxxxxx>
---
 plat/linuxu/include/linuxu/syscall-arm_32.h |  1 +
 plat/linuxu/include/linuxu/syscall-x86_64.h |  1 +
 plat/linuxu/include/linuxu/syscall.h        | 15 +++++++++++++++
 3 files changed, 17 insertions(+)

diff --git a/plat/linuxu/include/linuxu/syscall-arm_32.h 
b/plat/linuxu/include/linuxu/syscall-arm_32.h
index ef9323b..5d1b1e2 100644
--- a/plat/linuxu/include/linuxu/syscall-arm_32.h
+++ b/plat/linuxu/include/linuxu/syscall-arm_32.h
@@ -46,6 +46,7 @@
 #define __SC_MUNMAP    91
 #define __SC_EXIT       1
 #define __SC_IOCTL     54
+#define __SC_FSTAT    108
 #define __SC_RT_SIGPROCMASK   126
 #define __SC_ARCH_PRCTL       172
 #define __SC_RT_SIGACTION     174
diff --git a/plat/linuxu/include/linuxu/syscall-x86_64.h 
b/plat/linuxu/include/linuxu/syscall-x86_64.h
index 553f0ba..0dd280e 100644
--- a/plat/linuxu/include/linuxu/syscall-x86_64.h
+++ b/plat/linuxu/include/linuxu/syscall-x86_64.h
@@ -42,6 +42,7 @@
 #define __SC_WRITE   1
 #define __SC_OPEN    2
 #define __SC_CLOSE   3
+#define __SC_FSTAT   5
 #define __SC_MMAP    9
 #define __SC_MUNMAP 11
 #define __SC_RT_SIGACTION   13
diff --git a/plat/linuxu/include/linuxu/syscall.h 
b/plat/linuxu/include/linuxu/syscall.h
index 0dca7c5..c703b32 100644
--- a/plat/linuxu/include/linuxu/syscall.h
+++ b/plat/linuxu/include/linuxu/syscall.h
@@ -48,6 +48,13 @@
 #error "Unsupported architecture"
 #endif
 
+
+static inline int sys_open(const char *pathname, int flags, mode_t mode)
+{
+       return (int)syscall3(__SC_OPEN, (long)pathname, (long)flags,
+                            (long)mode);
+}
+
 static inline ssize_t sys_read(int fd, const char *buf, size_t len)
 {
        return (ssize_t) syscall3(__SC_READ,
@@ -64,6 +71,13 @@ static inline ssize_t sys_write(int fd, const char *buf, 
size_t len)
                                  (long) (len));
 }
 
+struct stat;
+
+static inline int sys_fstat(int fd, struct stat *statbuf)
+{
+       return (int)syscall2(__SC_FSTAT, (long)(fd), (long)(statbuf));
+}
+
 static inline int sys_exit(int status)
 {
        return (int) syscall1(__SC_EXIT,
@@ -81,6 +95,7 @@ static inline int sys_clock_gettime(k_clockid_t clk_id, 
struct k_timespec *tp)
  * Please note that on failure sys_mmap() is returning -errno
  */
 #define MAP_SHARED    (0x01)
+#define MAP_PRIVATE   (0x02)
 #define MAP_ANONYMOUS (0x20)
 #define PROT_NONE     (0x0)
 #define PROT_READ     (0x1)
-- 
2.24.0


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