check for CLOCK_MONOTONIC

Björn JACKE samba at j3e.de
Tue Jun 6 14:20:59 GMT 2006


Hi,

3.0.23rc1 does currently not build on SLES8 for example, here's a 
patch ... but one question still remains: As far as I can see, 
there is no check if the used clock is available on that system at 
all. Even if CLOCK_MONOTONIC or CLOCK_PROCESS_CPUTIME_ID are 
defined they might return EINVAL, shouldn't we catch that one 
somewhere?

Cheers
Bjoern
-- 
Björn Jacke,  SerNet Service Network GmbH
Phone: +49-(0)551-370000-0,  Fax: +49-(0)551-370000-9
-------------- next part --------------
Index: source/profile/profile.c
===================================================================
--- source/profile/profile.c	(Revision 16057)
+++ source/profile/profile.c	(Arbeitskopie)
@@ -107,6 +107,7 @@
 	read_only = rdonly;
 
 #if defined(HAVE_CLOCK_GETTIME)
+#if defined(CLOCK_MONOTONIC)
 	if (this_is_smp()) {
 		/* This is faster that gettimeofday, but not fast enough to
 		 * leave it enabled in production.
@@ -122,7 +123,10 @@
 		 */
 		__profile_clock = CLOCK_PROCESS_CPUTIME_ID;
 	}
-#endif
+#else  /* CLOCK_MONOTONIC    */
+	__profile_clock = CLOCK_PROCESS_CPUTIME_ID;
+#endif /* CLOCK_MONOTONIC    */
+#endif /* HAVE_CLOCK_GETTIME */
 
  again:
 	/* try to use an existing key */


More information about the samba-technical mailing list