check for CLOCK_MONOTONIC

James Peach jpeach at samba.org
Thu Jun 8 01:13:16 GMT 2006


On Wed, 2006-06-07 at 13:01 +0200, Björn JACKE wrote:
> Hi,
> 
> On 2006-06-07 at 12:48 +1000 James Peach sent off:
> >I rejiggered your patch a bit, can you please re-test before I commit?
> 
> The checks for available clocks are not being done and even HAVE_CLOCK_GETTIME is undef'ed:
> 
> ...
> checking for clock_gettime... no
> checking for clock_gettime in -lrt... yes
> checking if libpthread is linked... yes
> checking for va_copy... yes
> ...
> 
> but config.h says:
> 
> /* Whether clock_gettime is available */
> /* #undef HAVE_CLOCK_GETTIME */

This is actually correct. If linking librt caused libpthread to also be
linked, then we run into a problem with the use of signals with kernel
oplocks on Linux (see the thread titled "Failed to setup
RT_SIGNAL_NOTIFY handler").

So in this case, we have to back out out use of librt and therefore
cannot enable clock_gettime. This is really unfortunate, but I don't
think that there's a lot we can do about it.

> you might try to turn around the parameters of your SMB_IS_LIBPTHREAD_LINKED check in configure.in. Like this it works for me:
> 
> ...
>                 SMB_IS_LIBPTHREAD_LINKED(
>                         [
>                             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)
>                         ],
>                         [ SMB_REMOVELIB(rt) ],
>                         )
> ...
> 
> What do you think?

I think that the patch is doing the right thing. Can you confirm that
librt is linked against libpthread on your system?

-- 
James Peach | jpeach at samba.org



More information about the samba-technical mailing list