[SCM] Samba Shared Repository - branch master updated
Björn Jacke
bjacke at samba.org
Tue Aug 31 01:11:00 MDT 2010
The branch, master has been updated
via 8c6ca6e s3: we have clock_gettime everywhere, remove ifdefs
via 8589f46 s3: use clock_gettime() in timespec_current()
via 3df1037 libreplace: add clock_gettime replacement function for systems that don't have it
via 9f87bc4 libreplace/waf: look for clock_gettime
via 4e104f1 libreplace: move detection of clock_gettime to libreplace
via e866224 libreplace: move gettimeofday TZ arg check here
from c2e2be5 packaging: cifsutils are no longer part of Samba
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8c6ca6e25a4d33e4f9ae2ef13a3872cd533ba6f6
Author: Björn Jacke <bj at sernet.de>
Date: Tue Aug 24 11:14:19 2010 +0200
s3: we have clock_gettime everywhere, remove ifdefs
commit 8589f46b86b8acd0439e1325818cc69f9050240d
Author: Björn Jacke <bj at sernet.de>
Date: Mon Aug 30 16:51:56 2010 +0200
s3: use clock_gettime() in timespec_current()
commit 3df1037a74181ef314e2115ade836546a572ee48
Author: Björn Jacke <bj at sernet.de>
Date: Thu Aug 19 19:07:04 2010 +0200
libreplace: add clock_gettime replacement function for systems that don't have it
commit 9f87bc4588c2ac669f6e808158dca7ec8517a461
Author: Björn Jacke <bj at sernet.de>
Date: Fri Aug 27 00:13:07 2010 +0200
libreplace/waf: look for clock_gettime
commit 4e104f185e1aa12c0923e82d3991a658eb2b9474
Author: Björn Jacke <bj at sernet.de>
Date: Thu Aug 19 18:39:45 2010 +0200
libreplace: move detection of clock_gettime to libreplace
commit e8662248c8bf7dfc830ce34f301f30f59e600cd8
Author: Björn Jacke <bj at sernet.de>
Date: Mon Aug 30 14:35:49 2010 +0200
libreplace: move gettimeofday TZ arg check here
-----------------------------------------------------------------------
Summary of changes:
lib/replace/README | 1 +
lib/replace/libreplace.m4 | 43 ++++++++++++++++++++++++++++++++++++++++++
lib/replace/replace.c | 21 ++++++++++++++++++++
lib/replace/replace.h | 4 +++
lib/replace/system/config.m4 | 10 +++++++++
lib/replace/system/time.h | 6 +++++
lib/replace/wscript | 1 +
lib/util/time.m4 | 9 --------
source3/configure.in | 20 +-----------------
source3/include/smbprofile.h | 13 ------------
source3/lib/time.c | 5 +---
source3/m4/aclocal.m4 | 31 ------------------------------
source3/profile/profile.c | 7 ------
source4/configure.ac | 1 -
14 files changed, 89 insertions(+), 83 deletions(-)
delete mode 100644 lib/util/time.m4
Changeset truncated at 500 lines:
diff --git a/lib/replace/README b/lib/replace/README
index b2d2e4f..bf4e67f 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -33,6 +33,7 @@ opendir
readdir
telldir
seekdir
+clock_gettime
closedir
dlopen
dlclose
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 2303641..0d716e0 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -115,6 +115,12 @@ AC_CHECK_FUNCS(fdatasync,,[
[libreplace_cv_HAVE_FDATASYNC_IN_LIBRT=yes
AC_DEFINE(HAVE_FDATASYNC, 1, Define to 1 if there is support for fdatasync)])
])
+AC_CHECK_FUNCS(clock_gettime,libreplace_cv_have_clock_gettime=yes,[
+ AC_CHECK_LIB(rt, clock_gettime,
+ [libreplace_cv_HAVE_CLOCK_GETTIME_IN_LIBRT=yes
+ libreplace_cv_have_clock_gettime=yes
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, Define to 1 if there is support for clock_gettime)])
+])
AC_CHECK_FUNCS(get_current_dir_name)
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
@@ -288,6 +294,12 @@ m4_include(timegm.m4)
m4_include(repdir.m4)
m4_include(crypt.m4)
+if test x$libreplace_cv_have_clock_gettime = xyes ; then
+ SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
+ SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
+ SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
+fi
+
AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
echo "LIBREPLACE_BROKEN_CHECKS: END"
@@ -316,4 +328,35 @@ m4_include(libreplace_ld.m4)
m4_include(libreplace_network.m4)
m4_include(libreplace_macros.m4)
+
+dnl SMB_CHECK_CLOCK_ID(clockid)
+dnl Test whether the specified clock_gettime clock ID is available. If it
+dnl is, we define HAVE_clockid
+AC_DEFUN([SMB_CHECK_CLOCK_ID],
+[
+ AC_MSG_CHECKING(for $1)
+ AC_TRY_LINK([
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+ ],
+ [
+clockid_t clk = $1;
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_$1, 1,
+ [Whether the clock_gettime clock ID $1 is available])
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ])
+])
m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[m4_include(autoconf-2.60.m4)])
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 12716ea..f3459dd 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -760,3 +760,24 @@ int rep_strerror_r(int errnum, char *buf, size_t buflen)
return 0;
}
#endif
+
+#ifndef HAVE_CLOCK_GETTIME
+int rep_clock_gettime(clockid_t clk_id, struct timespec *tp)
+{
+ struct timeval tval;
+ switch (clk_id) {
+ case 0: /* CLOCK_REALTIME :*/
+#ifdef HAVE_GETTIMEOFDAY_TZ
+ gettimeofday(&tval,NULL);
+#else
+ gettimeofday(&tval);
+#endif
+ tp->tv_sec = tval.tv_sec;
+ tp->tv_nsec = tval.tv_usec * 1000;
+ break;
+ default:
+ return EINVAL;
+ }
+ return 0;
+}
+#endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 4efcb4c..055dd71 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -517,6 +517,10 @@ char *rep_get_current_dir_name(void);
int rep_strerror_r(int errnum, char *buf, size_t buflen);
#endif
+#if !defined(HAVE_CLOCK_GETTIME)
+#define clock_gettime rep_clock_gettime
+#endif
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
diff --git a/lib/replace/system/config.m4 b/lib/replace/system/config.m4
index b8568a5..04364bc 100644
--- a/lib/replace/system/config.m4
+++ b/lib/replace/system/config.m4
@@ -11,6 +11,16 @@ AC_CHECK_HEADERS(sys/time.h utime.h)
AC_HEADER_TIME
AC_CHECK_FUNCS(utime utimes)
+AC_CACHE_CHECK([if gettimeofday takes TZ argument],libreplace_cv_HAVE_GETTIMEOFDAY_TZ,[
+AC_TRY_RUN([
+#include <sys/time.h>
+#include <unistd.h>
+main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
+ libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=no,libreplace_cv_HAVE_GETTIMEOFDAY_TZ=yes)])
+if test x"$libreplace_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
+ AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
+fi
+
# wait
AC_HEADER_SYS_WAIT
diff --git a/lib/replace/system/time.h b/lib/replace/system/time.h
index 4abf295..ff26531 100644
--- a/lib/replace/system/time.h
+++ b/lib/replace/system/time.h
@@ -66,4 +66,10 @@ int rep_utime(const char *filename, const struct utimbuf *buf);
int rep_utimes(const char *filename, const struct timeval tv[2]);
#endif
+#ifndef HAVE_CLOCK_GETTIME
+#define CLOCK_REALTIME 0
+typedef int clockid_t;
+int rep_clock_gettime(clockid_t clk_id, struct timespec *tp);
+#endif
+
#endif
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 66b0e87..8c1c57f 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -173,6 +173,7 @@ def configure(conf):
define='DLOPEN_TAKES_UNSIGNED_FLAGS', headers='dlfcn.h dl.h')
conf.CHECK_FUNCS_IN('fdatasync', 'rt', checklibc=True)
+ conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True)
# these headers need to be tested as a group on freebsd
conf.CHECK_HEADERS(headers='sys/socket.h net/if.h', together=True)
diff --git a/lib/util/time.m4 b/lib/util/time.m4
deleted file mode 100644
index 675e201..0000000
--- a/lib/util/time.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
-AC_TRY_RUN([
-#include <sys/time.h>
-#include <unistd.h>
-main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
- samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=yes)])
-if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
- AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
-fi
diff --git a/source3/configure.in b/source3/configure.in
index d8bf554..1f4da24 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -121,7 +121,6 @@ fi
m4_include(../lib/socket_wrapper/config.m4)
m4_include(../lib/nss_wrapper/config.m4)
-m4_include(../lib/util/time.m4)
m4_include(m4/swat.m4)
@@ -2369,23 +2368,8 @@ if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
fi
-
-if test x"$samba_cv_WITH_PROFILE" = x"yes"; then
-
- # On some systems (eg. Linux) librt can pull in libpthread. We
- # don't want this to happen because libpthreads changes signal delivery
- # semantics in ways we are not prepared for. This breaks Linux oplocks
- # which rely on signals.
-
- AC_LIBTESTFUNC(rt, clock_gettime,
- [
- AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
- [Whether clock_gettime is available])
- SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
- SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
- SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
- ])
-
+if test x"$libreplace_cv_HAVE_CLOCK_GETTIME_IN_LIBRT" = xyes ; then
+ LIBS="$LIBS -lrt"
fi
AC_CACHE_CHECK([for broken readdir name],samba_cv_HAVE_BROKEN_READDIR_NAME,[
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index e9015ff..6076479 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -894,8 +894,6 @@ extern bool do_profile_times;
#define DEC_PROFILE_COUNT(x) profile_p->x--
#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
-#if defined(HAVE_CLOCK_GETTIME)
-
extern clockid_t __profile_clock;
static inline uint64_t profile_timestamp(void)
@@ -911,17 +909,6 @@ static inline uint64_t profile_timestamp(void)
return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
}
-#else
-
-static inline uint64_t profile_timestamp(void)
-{
- struct timeval tv;
- GetTimeOfDay(&tv);
- return (tv.tv_sec * 1000000) + tv.tv_usec;
-}
-
-#endif
-
/* end of helper macros */
#define DO_PROFILE_INC(x) \
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 71d6587..fad5d97 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -356,11 +356,8 @@ struct timeval convert_timespec_to_timeval(const struct timespec ts)
struct timespec timespec_current(void)
{
- struct timeval tv;
struct timespec ts;
- GetTimeOfDay(&tv);
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ clock_gettime(CLOCK_REALTIME, &ts);
return ts;
}
diff --git a/source3/m4/aclocal.m4 b/source3/m4/aclocal.m4
index 3ca44bd..b33658f 100644
--- a/source3/m4/aclocal.m4
+++ b/source3/m4/aclocal.m4
@@ -799,37 +799,6 @@ AC_DEFUN([SMB_CHECK_DMAPI],
])
-dnl SMB_CHECK_CLOCK_ID(clockid)
-dnl Test whether the specified clock_gettime clock ID is available. If it
-dnl is, we define HAVE_clockid
-AC_DEFUN([SMB_CHECK_CLOCK_ID],
-[
- AC_MSG_CHECKING(for $1)
- AC_TRY_LINK([
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
- ],
- [
-clockid_t clk = $1;
- ],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_$1, 1,
- [Whether the clock_gettime clock ID $1 is available])
- ],
- [
- AC_MSG_RESULT(no)
- ])
-])
-
dnl SMB_IF_RTSIGNAL_BUG([actions if true],
dnl [actions if false],
dnl [actions if cross compiling])
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index c8e7c38..4a61753 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -29,11 +29,9 @@
#ifdef WITH_PROFILE
static int shm_id;
static bool read_only;
-#if defined(HAVE_CLOCK_GETTIME)
clockid_t __profile_clock;
bool have_profiling_clock = False;
#endif
-#endif
struct profile_header *profile_h;
struct profile_stats *profile_p;
@@ -138,8 +136,6 @@ static void reqprofile_message(struct messaging_context *msg_ctx,
open the profiling shared memory area
******************************************************************/
-#ifdef HAVE_CLOCK_GETTIME
-
/* Find a clock. Just because the definition for a particular clock ID is
* present doesn't mean the system actually supports it.
*/
@@ -195,7 +191,6 @@ static void init_clock_gettime(void)
("could not find a working clock for profiling"));
return;
}
-#endif
bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
{
@@ -203,9 +198,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
read_only = rdonly;
-#ifdef HAVE_CLOCK_GETTIME
init_clock_gettime();
-#endif
again:
/* try to use an existing key */
diff --git a/source4/configure.ac b/source4/configure.ac
index 91d7a3b..f415d0b 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -20,7 +20,6 @@ m4_include(../lib/util/util.m4)
m4_include(../lib/util/fsusage.m4)
m4_include(../lib/util/xattr.m4)
m4_include(../lib/util/capability.m4)
-m4_include(../lib/util/time.m4)
m4_include(../lib/popt/samba.m4)
m4_include(../lib/util/charset/config.m4)
m4_include(lib/socket/config.m4)
--
Samba Shared Repository
More information about the samba-cvs
mailing list