This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Some patches for new clock functions



I got some warnings when compiling and fixed them:
- Fixed some typos
- We weren't always setting retval
- memmem needs <string.h>

Andreas

2000-04-12  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/i386/i586/clock_getres.c (EXTRA_CLOCK_CASES): Set
	retval for error case.

	* sysdeps/unix/i386/i586/clock_gettime.c: Fix typo.
	(EXTRA_CLOCK_CASES): Set retval for error case.

	* sysdeps/unix/sysv/linux/i386/get_clockfreq.c: Include <string.h>
	for memmem declaration.

============================================================
Index: sysdeps/unix/i386/i586/clock_getres.c
--- sysdeps/unix/i386/i586/clock_getres.c	2000/04/11 16:14:22	1.2
+++ sysdeps/unix/i386/i586/clock_getres.c	2000/04/12 19:17:45
@@ -53,8 +53,11 @@
 	     lead to the same result.  */				      \
 	  freq = __get_clockfreq ();					      \
 	  if (__builtin_expect (freq == 0, 0))				      \
-	    /* Something went wrong.  */				      \
-	    break;							      \
+	    {								      \
+	      /* Something went wrong.  */				      \
+	      retval = -1;						      \
+	      break;							      \
+	    }								      \
 									      \
 	  nsec = MAX (1000000000ULL / freq, 1);				      \
 	}								      \
============================================================
Index: sysdeps/unix/i386/i586/clock_gettime.c
--- sysdeps/unix/i386/i586/clock_gettime.c	2000/04/11 16:15:31	1.2
+++ sysdeps/unix/i386/i586/clock_gettime.c	2000/04/12 19:17:45
@@ -27,7 +27,7 @@
 
 
 /* Function to determine processor frequency.  */
-extern unsigned long long int __get_glockfreq (void);
+extern unsigned long long int __get_clockfreq (void);
 
 /* Clock frequency of the processor.  We make it a 64-bit variable
    because some jokers are already playing with processors with more
@@ -52,8 +52,11 @@
 	     lead to the same result.  */				      \
 	  freq = __get_clockfreq ();					      \
 	  if (__builtin_expect (freq == 0, 0))				      \
-	    /* Something went wrong.  */				      \
-	    break;							      \
+	    {								      \
+	      /* Something went wrong.  */				      \
+	      retval = -1;						      \
+	      break;							      \
+	    }								      \
 	}								      \
 									      \
       /* Get the current counter.  */					      \
============================================================
Index: sysdeps/unix/sysv/linux/i386/get_clockfreq.c
--- sysdeps/unix/sysv/linux/i386/get_clockfreq.c	2000/04/11 16:16:07	1.2
+++ sysdeps/unix/sysv/linux/i386/get_clockfreq.c	2000/04/12 19:17:45
@@ -20,6 +20,7 @@
 #include <ctype.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <string.h>
 
 
 unsigned long long int

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de
    currently: aj@oss.sgi.com

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