[Glibc-bsd-commits] r4748 - trunk/glibc-ports/kfreebsd/fbtl

Petr Salinger ps-guest at alioth.debian.org
Sun Jul 14 18:20:19 UTC 2013


Author: ps-guest
Date: 2013-07-14 18:20:19 +0000 (Sun, 14 Jul 2013)
New Revision: 4748

Modified:
   trunk/glibc-ports/kfreebsd/fbtl/clock_getres.c
Log:
the kernel returns resolution regardless whether the CPU timer is accessible, but POSIX/testsuite expects EINVAL in such case



Modified: trunk/glibc-ports/kfreebsd/fbtl/clock_getres.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/clock_getres.c	2013-07-14 12:33:13 UTC (rev 4747)
+++ trunk/glibc-ports/kfreebsd/fbtl/clock_getres.c	2013-07-14 18:20:19 UTC (rev 4748)
@@ -26,6 +26,9 @@
 int __syscall_clock_getres(clockid_t clock_id, struct timespec *tp);
 libc_hidden_proto (__syscall_clock_getres)
 
+int __syscall_clock_gettime(clockid_t clock_id, struct timespec *tp);
+libc_hidden_proto (__syscall_clock_gettime)
+
 /* Get resolution of clock.  */
 int
 __clock_getres (clockid_t clock_id, struct timespec *tp)
@@ -36,7 +39,22 @@
        CLOCK_THREAD_CPUTIME_ID and related timers
 
      for now just pass it to kernel       
-   */    
+   */
+  /* the negative clock_id means a CPU-timer, the resolution is same for all of them
+     the kernel returns resolution regardless whether the timer is accessible,
+     but POSIX/testsuite expects EINVAL
+   */
+   
+  if (clock_id < 0)
+  {
+    int rv;
+    /* we reuse user provided struct timespec */
+    rv = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp);
+    if (rv != 0)
+      return rv;
+    /* valid, now really get the resolution  */
+  }
+
   return INLINE_SYSCALL (clock_getres, 2, clock_id, tp);
 }
 strong_alias (__clock_getres, clock_getres)




More information about the Glibc-bsd-commits mailing list