This is the mail archive of the glibc-bugs@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/220] IA64: return EINVAL if ITC is an unreliable time source on clock_gettime(CLOCK_PROCESS_TIMEID)


------- Additional Comments From clameter at sgi dot com  2004-06-14 20:50 -------
Sorry this was the wrong patch. This did far too much. Here is the right one:

Index: libc/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
===================================================================
--- libc.orig/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c	2004-05-27
18:26:58.170594467 -0700
+++ libc/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c	2004-06-09
11:27:09.270731016 -0700
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 
+extern int itc_usable;
 
 int
 clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
@@ -31,7 +32,6 @@
   if (pid != 0 && pid != getpid ())
     return EPERM;
 
-  static int itc_usable;
   int retval = ENOENT;
 
   if (__builtin_expect (itc_usable == 0, 0))
Index: libc/sysdeps/unix/clock_gettime.c
===================================================================
--- libc.orig/sysdeps/unix/clock_gettime.c	2004-06-09 11:30:47.381079907 -0700
+++ libc/sysdeps/unix/clock_gettime.c	2004-06-09 11:37:09.235567416 -0700
@@ -29,7 +29,7 @@
    because some jokers are already playing with processors with more
    than 4GHz.  */
 static hp_timing_t freq;
-
+int itc_usable;
 
 /* This function is defined in the thread library.  */
 extern int __pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq,
@@ -78,7 +78,9 @@
 #if HP_TIMING_AVAIL
       /* FALLTHROUGH.  */
     case CLOCK_PROCESS_CPUTIME_ID:
-      {
+      /* If itc usability has not been determined then do so now */
+      if (itc_usable==0) clock_getcpuclockid();
+      if (itc_usable>0) {
 	hp_timing_t tsc;
 
 	if (__builtin_expect (freq == 0, 0))
@@ -115,6 +117,9 @@
 
 	retval = 0;
       }
+    else
+	_set_errno(ENOENT);
+    
     break;
 #endif
     }

-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=220

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]