瀏覽代碼

shim_types.h: __kernel_timespec, __kernel_itimerspec

From Linux 4.18.0, it's defined int uapi/time.h.
This patch makes it compile with Linux 4.18.0 or later.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
Isaku Yamahata 6 年之前
父節點
當前提交
aca39921de
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      LibOS/shim/include/shim_types.h

+ 8 - 5
LibOS/shim/include/shim_types.h

@@ -22,6 +22,7 @@
 #include <linux/aio_abi.h>
 #include <linux/perf_event.h>
 #include <linux/timex.h>
+#include <linux/version.h>
 
 #include <asm/posix_types.h>
 #include <asm/statfs.h>
@@ -48,20 +49,22 @@ typedef __kernel_timer_t    timer_t;
 typedef __kernel_fd_set     fd_set;
 
 /* linux/time.h */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
 struct __kernel_timespec {
     __kernel_time_t tv_sec;         /* seconds */
     long            tv_nsec;        /* nanoseconds */
 };
 
-struct __kernel_timeval {
-    __kernel_time_t         tv_sec;         /* seconds */
-    __kernel_suseconds_t    tv_usec;        /* microsecond */
-};
-
 struct __kernel_itimerspec {
     struct __kernel_timespec it_interval;    /* timer period */
     struct __kernel_timespec it_value;       /* timer expiration */
 };
+#endif
+
+struct __kernel_timeval {
+    __kernel_time_t         tv_sec;         /* seconds */
+    __kernel_suseconds_t    tv_usec;        /* microsecond */
+};
 
 struct __kernel_itimerval {
     struct __kernel_timeval it_interval;     /* time interval */