Skip to contentSkip to conversation

syscall clock_gettime

PATCH New Kirill A. Shutemov 1 participant 1 message Feb 19, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscall clock_gettime

Patch from Debian patchset in the attachment.

syscall.c renamed from syscall.c.orig +16 -0
@@ -3972,6 +3982,22 @@ long do_syscall(void *cpu_env, int num, 
     case TARGET_NR_getdomainname:
         goto unimplemented_nowarn;
 #endif
+#ifdef TARGET_NR_clock_gettime
+    case TARGET_NR_clock_gettime:
+    {
+        struct target_timespec* ttp = (struct target_timespec*)arg2;
+        struct timespec htp;
+        if(ttp) {
+          htp.tv_sec = tswapl(ttp->tv_sec);
+          htp.tv_nsec = tswapl(ttp->tv_nsec);
+          ret = get_errno(clock_gettime((clockid_t)arg1, &htp));
+          ttp->tv_sec = tswapl(htp.tv_sec);
+          ttp->tv_nsec = tswapl(htp.tv_nsec);
+        } else
+          ret = get_errno(clock_gettime((clockid_t)arg1, NULL));
+        break;
+    }
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
Makefile.target renamed from Makefile.target.orig +1 -1
Index: Makefile.target
===================================================================
@@ -166,7 +166,7 @@ endif
 #########################################################
 
 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-LIBS+=-lm
+LIBS+=-lm -lrt
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
 endif