The branch, master has been updated via 4f6d1728254c8503e71c6fdd008fb7264dec26c5 (commit) via 263b798db9bd6c26a51fbf38e4d5d693d234fa5f (commit) via aff48fba1825b2838818ab2f1d037fae32ae132a (commit) from d8c54fddda2dba3cbc5fc13e93431b152813892e (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4f6d1728254c8503e71c6fdd008fb7264dec26c5 Author: Björn Jacke <b...@sernet.de> Date: Thu Feb 12 11:14:18 2009 +0100 There are systems where nanosleep is in libc *and* in librt. Let's just do the test in librt when the first one failed. commit 263b798db9bd6c26a51fbf38e4d5d693d234fa5f Author: Björn Jacke <b...@sernet.de> Date: Wed Feb 11 21:19:01 2009 +0100 tidy up timestamp checks AC_CHECK_MEMBERS should be a sufficient check, there's no need to do manual compile tests. We can also assume that we have ctime and atime members when we have the mtime member. commit aff48fba1825b2838818ab2f1d037fae32ae132a Author: Björn Jacke <b...@sernet.de> Date: Thu Feb 12 12:29:35 2009 +0100 today valgrind is available on 64bit Linux, too ----------------------------------------------------------------------- Summary of changes: source3/configure.in | 315 ++----------------------------------------- source3/include/includes.h | 5 +- source3/lib/time.c | 66 +++++----- 3 files changed, 49 insertions(+), 337 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/configure.in b/source3/configure.in index 10ce6f6..d11ece1 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -703,18 +703,6 @@ CPPFLAGS="$old_CPPFLAGS" # subdirectory of headers. AC_CHECK_HEADERS(valgrind.h valgrind/valgrind.h valgrind/memcheck.h) -# check for linux on amd64 since valgrind is not quite there yet -case "$host_os" in - *linux*) - case "$UNAME_P" in - *x86_64*) - AC_DEFINE(HAVE_64BIT_LINUX,1,[Whether we are running on 64bit linux]) - ;; - esac - ;; -esac - - # # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT. # This causes configure to fail to detect it. Check for shadow separately on HPUX. @@ -1041,8 +1029,7 @@ AC_CHECK_FUNCS(getdents64) AC_CHECK_FUNCS(setenv strcasecmp fcvt fcvtl) AC_CHECK_FUNCS(syslog vsyslog timegm) AC_CHECK_FUNCS(setlocale nl_langinfo) -AC_CHECK_FUNCS(nanosleep) -AC_CHECK_LIB_EXT(rt, LIBS, nanosleep) +AC_CHECK_FUNCS(nanosleep,,[AC_CHECK_LIB_EXT(rt, LIBS, nanosleep)]) AC_CHECK_FUNCS(mlock munlock mlockall munlockall) AC_CHECK_FUNCS(memalign posix_memalign hstrerror) AC_CHECK_HEADERS(sys/mman.h) @@ -1311,301 +1298,29 @@ fi ################################################# # Check whether struct stat has timestamps with sub-second resolution. -# At least IRIX and Solaris have these. FREEBSD does as well, -# but with different members -# -# We check that -# all of st_mtim, st_atim and st_ctim exist -# all of the members are in fact of type struct timespec # -# There is some conflicting standards weirdness about whether we should use -# "struct timespec" or "timespec_t". Linux doesn't have timespec_t, so we -# prefer struct timespec. -AC_CACHE_CHECK([whether struct stat has timespec timestamps], - samba_cv_stat_timespec_hires, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t = s.st_mtimespec; - t = s.st_ctimespec; - t = s.st_atimespec; - ], - samba_cv_stat_timespec_hires=yes, samba_cv_stat_timespec_hires=no) - ]) - -if test x"$samba_cv_stat_timespec_hires" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_MTIMESPEC, 1, [whether struct stat contains st_mtimepec]) - AC_DEFINE(HAVE_STAT_ST_ATIMESPEC, 1, [whether struct stat contains st_atimespec]) - AC_DEFINE(HAVE_STAT_ST_CTIMESPEC, 1, [whether struct stat contains st_ctimespec]) - AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, [whether struct stat has sub-second timestamps]) -fi - - -AC_CACHE_CHECK([whether struct stat has sub-second timestamps], samba_cv_stat_hires, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t.tv_sec = s.st_mtim.tv_sec; - t.tv_nsec = s.st_mtim.tv_nsec; - t.tv_sec = s.st_ctim.tv_sec; - t.tv_nsec = s.st_ctim.tv_nsec; - t.tv_sec = s.st_atim.tv_sec; - t.tv_nsec = s.st_atim.tv_nsec; - ], - samba_cv_stat_hires=yes, samba_cv_stat_hires=no) - ]) +samba_cv_stat_hires=no +AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec], # Linux, Solaris + [samba_cv_stat_hires=yes]) +AC_CHECK_MEMBERS([struct stat.st_mtimensec], # BSD, if defined _POSIX_SOURCE + [samba_cv_stat_hires=yes]) +AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec], # BSD, if not defined _POSIX_SOURCE + [samba_cv_stat_hires=yes]) +AC_CHECK_MEMBERS([struct stat.st_mtime_n], # AIX + [samba_cv_stat_hires=yes]) +AC_CHECK_MEMBERS([struct stat.st_umtime], # Tru64 + [samba_cv_stat_hires=yes]) if test x"$samba_cv_stat_hires" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_MTIM, 1, [whether struct stat contains st_mtim]) - AC_DEFINE(HAVE_STAT_ST_ATIM, 1, [whether struct stat contains st_atim]) - AC_DEFINE(HAVE_STAT_ST_CTIM, 1, [whether struct stat contains st_ctim]) AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, [whether struct stat has sub-second timestamps]) fi -AC_CACHE_CHECK([whether struct stat has sub-second timestamps without struct timespec suffixed nsec], samba_cv_stat_hires_notimespec, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t.tv_sec = s.st_mtime; - t.tv_nsec = s.st_mtimensec; - t.tv_sec = s.st_ctime; - t.tv_nsec = s.st_ctimensec; - t.tv_sec = s.st_atime; - t.tv_nsec = s.st_atimensec; - ], - samba_cv_stat_hires_notimespec=yes, samba_cv_stat_hires_notimespec=no) - ]) - -if test x"$samba_cv_stat_hires_notimespec" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_MTIMENSEC, 1, [whether struct stat contains st_mtimensec]) - AC_DEFINE(HAVE_STAT_ST_ATIMENSEC, 1, [whether struct stat contains st_atimensec]) - AC_DEFINE(HAVE_STAT_ST_CTIMENSEC, 1, [whether struct stat contains st_ctimensec]) - AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, - [whether struct stat has sub-second timestamps without struct timespec suffixed nsec]) -fi - -dnl AIX stype sub-second timestamps: -AC_CACHE_CHECK([whether struct stat has sub-second timestamps without struct timespec suffixed _n], samba_cv_stat_hires_notimespec_n, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t.tv_sec = s.st_mtime; - t.tv_nsec = s.st_mtime_n; - t.tv_sec = s.st_ctime; - t.tv_nsec = s.st_ctime_n; - t.tv_sec = s.st_atime; - t.tv_nsec = s.st_atime_n; - ], - samba_cv_stat_hires_notimespec_n=yes, samba_cv_stat_hires_notimespec_n=no) - ]) - -if test x"$samba_cv_stat_hires_notimespec_n" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_MTIME_N, 1, [whether struct stat contains st_mtime_n]) - AC_DEFINE(HAVE_STAT_ST_ATIME_N, 1, [whether struct stat contains st_atime_n]) - AC_DEFINE(HAVE_STAT_ST_CTIME_N, 1, [whether struct stat contains st_ctime_n]) - AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, - [whether struct stat has sub-second timestamps without struct timespec suffixed _n]) -fi - -dnl Tru64 has _micro_second_ resolution: -AC_CACHE_CHECK([whether struct stat has sub-second timestamps in st_uXtime], samba_cv_stat_hires_uxtime, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t.tv_sec = s.st_mtime; - t.tv_nsec = s.st_umtime * 1000; - t.tv_sec = s.st_ctime; - t.tv_nsec = s.st_uctime * 1000; - t.tv_sec = s.st_atime; - t.tv_nsec = s.st_uatime * 1000; - ], - samba_cv_stat_hires_uxtime=yes, samba_cv_stat_hires_uxtime=no) - ]) - -if test x"$samba_cv_stat_hires_uxtime" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_UMTIME, 1, [whether struct stat contains st_umtime]) - AC_DEFINE(HAVE_STAT_ST_UATIME, 1, [whether struct stat contains st_uatime]) - AC_DEFINE(HAVE_STAT_ST_UCTIME, 1, [whether struct stat contains st_uctime]) - AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, - [whether struct stat has sub-second timestamps in st_uXtime]) -fi - -AC_CACHE_CHECK([whether struct stat has st_birthtimespec], samba_cv_stat_st_birthtimespec, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t = s.st_birthtimespec; - ], - samba_cv_stat_st_birthtimespec=yes, samba_cv_stat_st_birthtimespec=no) - ]) - -if test x"$samba_cv_stat_st_birthtimespec" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_BIRTHTIMESPEC, 1, [whether struct stat contains st_birthtimespec]) -fi - -AC_CACHE_CHECK([whether struct stat has st_birthtimensec], samba_cv_stat_st_birthtimensec, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct timespec t; - struct stat s = {0}; - t.tv_nsec = s.st_birthtimensec; - ], - samba_cv_stat_st_birthtimensec=yes, samba_cv_stat_st_birthtimensec=no) - ]) +# recent FreeBSD, NetBSD have creation timestamps called birthtime: +AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_birthtime], AC_CHECK_MEMBERS([struct stat.st_birthtimensec])) -if test x"$samba_cv_stat_st_birthtimensec" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_BIRTHTIMENSEC, 1, [whether struct stat contains st_birthtimensec]) -fi - -AC_CACHE_CHECK([whether struct stat has st_birthtime], samba_cv_stat_st_birthtime, - [ - AC_TRY_COMPILE( - [ -#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 -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - ], - [ - struct time_t t; - struct stat s = {0}; - t = s.st_birthtime; - ], - samba_cv_stat_st_birthtime=yes, samba_cv_stat_st_birthtime=no) - ]) - -if test x"$samba_cv_stat_st_birthtime" = x"yes" ; then - AC_DEFINE(HAVE_STAT_ST_BIRTHTIME, 1, [whether struct stat contains st_birthtime]) -fi AC_CACHE_CHECK([whether there is DOS flags support in the stat struct], samba_cv_stat_dos_flags, [ diff --git a/source3/include/includes.h b/source3/include/includes.h index 095fcaa..fc77534 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -241,8 +241,6 @@ typedef int ber_int_t; #include <aio.h> #endif -/* skip valgrind headers on 64bit AMD boxes */ -#ifndef HAVE_64BIT_LINUX /* Special macros that are no-ops except when run under Valgrind on * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */ #if HAVE_VALGRIND_MEMCHECK_H @@ -251,12 +249,11 @@ typedef int ber_int_t; #elif HAVE_VALGRIND_H #include <valgrind.h> #endif -#endif /* If we have --enable-developer and the valgrind header is present, * then we're OK to use it. Set a macro so this logic can be done only * once. */ -#if defined(DEVELOPER) && !defined(HAVE_64BIT_LINUX) +#if defined(DEVELOPER) #if (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H) #define VALGRIND #endif diff --git a/source3/lib/time.c b/source3/lib/time.c index e2cfe68..865456b 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -360,12 +360,12 @@ struct timespec get_create_timespec(const SMB_STRUCT_STAT *pst,bool fake_dirs) return ret; } -#if defined(HAVE_STAT_ST_BIRTHTIMESPEC) +#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) ret = pst->st_birthtimespec; -#elif defined(HAVE_STAT_ST_BIRTHTIMENSEC) +#elif defined(HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) ret.tv_sec = pst->st_birthtime; ret.tv_nsec = pst->st_birthtimenspec; -#elif defined(HAVE_STAT_ST_BIRTHTIME) +#elif defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) ret.tv_sec = pst->st_birthtime; ret.tv_nsec = 0; #else @@ -397,24 +397,24 @@ struct timespec get_atimespec(const SMB_STRUCT_STAT *pst) ret.tv_nsec = 0; return ret; #else -#if defined(HAVE_STAT_ST_ATIM) +#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) return pst->st_atim; -#elif defined(HAVE_STAT_ST_ATIMENSEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) struct timespec ret; ret.tv_sec = pst->st_atime; ret.tv_nsec = pst->st_atimensec; return ret; -#elif defined(HAVE_STAT_ST_ATIME_N) +#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) struct timespec ret; ret.tv_sec = pst->st_atime; ret.tv_nsec = pst->st_atime_n; return ret; -#elif defined(HAVE_STAT_ST_UATIME) +#elif defined(HAVE_STRUCT_STAT_ST_UMTIME) struct timespec ret; ret.tv_sec = pst->st_atime; ret.tv_nsec = pst->st_uatime * 1000; return ret; -#elif defined(HAVE_STAT_ST_ATIMESPEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) return pst->st_atimespec; #else #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT @@ -428,18 +428,18 @@ void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts) /* Old system - no ns timestamp. */ pst->st_atime = ts.tv_sec; #else -#if defined(HAVE_STAT_ST_ATIM) +#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) pst->st_atim = ts; -#elif defined(HAVE_STAT_ST_ATIMENSEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) pst->st_atime = ts.tv_sec; pst->st_atimensec = ts.tv_nsec; -#elif defined(HAVE_STAT_ST_ATIME_N) +#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) pst->st_atime = ts.tv_sec; pst->st_atime_n = ts.tv_nsec; -#elif defined(HAVE_STAT_ST_UATIME) +#elif defined(HAVE_STRUCT_STAT_ST_UMTIME) pst->st_atime = ts.tv_sec; pst->st_uatime = ts.tv_nsec / 1000; -#elif defined(HAVE_STAT_ST_ATIMESPEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) pst->st_atimespec = ts; #else #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT @@ -457,24 +457,24 @@ struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst) ret.tv_nsec = 0; return ret; #else -#if defined(HAVE_STAT_ST_MTIM) +#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) return pst->st_mtim; -#elif defined(HAVE_STAT_ST_MTIMENSEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) struct timespec ret; ret.tv_sec = pst->st_mtime; ret.tv_nsec = pst->st_mtimensec; return ret; -#elif defined(HAVE_STAT_ST_MTIME_N) +#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) struct timespec ret; ret.tv_sec = pst->st_mtime; ret.tv_nsec = pst->st_mtime_n; return ret; -#elif defined(HAVE_STAT_ST_UMTIME) +#elif defined(HAVE_STRUCT_STAT_ST_UMTIME) struct timespec ret; ret.tv_sec = pst->st_mtime; ret.tv_nsec = pst->st_umtime * 1000; return ret; -#elif defined(HAVE_STAT_ST_MTIMESPEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) return pst->st_mtimespec; #else #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT @@ -488,18 +488,18 @@ void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts) /* Old system - no ns timestamp. */ pst->st_mtime = ts.tv_sec; #else -#if defined(HAVE_STAT_ST_MTIM) +#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) pst->st_mtim = ts; -#elif defined(HAVE_STAT_ST_MTIMENSEC) +#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) pst->st_mtime = ts.tv_sec; pst->st_mtimensec = ts.tv_nsec; -#elif defined(HAVE_STAT_ST_MTIME_N) +#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) pst->st_mtime = ts.tv_sec; pst->st_mtime_n = ts.tv_nsec; -#elif defined(HAVE_STAT_ST_UMTIME) +#elif defined(HAVE_STRUCT_STAT_ST_UMTIME) pst->st_mtime = ts.tv_sec; pst->st_umtime = ts.tv_nsec / 1000; -#elif defined(HAVE_STAT_ST_MTIMESPEC) -- Samba Shared Repository