[vlc-devel] [PATCH 1/4] Also check _POSIX_TIMERS > 0. Fix build on GNU/Hurd.

Rémi Denis-Courmont remi at remlab.net
Wed Feb 19 14:17:01 CET 2014


   Hello,

> Gabriele Giacone, le Tue 18 Feb 2014 00:54:12 +0100, a écrit :
> > diff --git a/src/posix/thread.c b/src/posix/thread.c
> > index 07fa71e..d49e94c 100644
> > --- a/src/posix/thread.c
> > +++ b/src/posix/thread.c
> > @@ -300,7 +300,7 @@ void vlc_cond_init (vlc_cond_t *p_condvar)
> >  
> >      if (unlikely(pthread_condattr_init (&attr)))
> >          abort ();
> > -#if (_POSIX_CLOCK_SELECTION > 0)
> > +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
> >      vlc_clock_setup ();
> >      pthread_condattr_setclock (&attr, vlc_clock_id);
> >  #endif

> Well, we do have pthread_condattr_setclock etc. (otherwise we
> wouldn't define _POSIX_CLOCK_SELECTION).

POSIX.2001 §2.1.3 says:

"If the symbolic constant _POSIX_CLOCK_SELECTION is defined, then the
symbolic constant _POSIX_TIMERS shall also be defined by the implementation
to have the value 200112L."

POSIX.2008 §2.1.3 says:

"The following symbolic constants shall be defined by the implementation
as follows: Symbolic constants defined with the value 200809L: (...)
_POSIX_CLOCK_SELECTION (...) _POSIX_TIMERS".

Either way, _POSIX_TIMERS == 0 and _POSIX_CLOCK_SELECTION == 200809L is an
illegal combination.

> From looking at the build error, it seems the actual error is that
> vlc_clock_id is not defined, i.e. the actual issue comes from the
> fact that the #if at the top of the file don't match the #if in the
> source code.

VLC relies on the fact that clock selection support implies timers
support. GNU/Hurd fails to provide that specified warranty. From my point
of view as VLC developer, this is a GNU/Hurd bug.

Besides, I'd note that clock selection makes no practical sense without
timers (for clock_gettime() and CLOCK_REALTIME). The easy fix is to stop
pretending that POSIX.2008 and POSIX clock selection are supported. A
better but more involved fix would supply POSIX timers (that should be
easy; monotonic clock is the "harder" part).

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list