I will test and send simplified patch, i.e. I'll patch directly clock.c

if we want to move that macro to compat.h, I'd postpone that for some
investigation

1) we will need to include "pthread.h" from compat.h (currently it's not
true)
2) we will need to make sure compat.h is included everywhere (I do not see
that include in clock.c)

вс, 5 мая 2024 г. в 12:24, Willy Tarreau <w...@1wt.eu>:

> On Sun, May 05, 2024 at 11:15:24AM +0200, ???? ??????? wrote:
> > ??, 5 ??? 2024 ?. ? 10:42, Willy Tarreau <w...@1wt.eu>:
> >
> > > On Sun, May 05, 2024 at 09:12:41AM +0200, Miroslav Zagorac wrote:
> > > > On 05. 05. 2024. 08:32, Willy Tarreau wrote:
> > > > > On Sun, May 05, 2024 at 07:49:55AM +0200, ???? ??????? wrote:
> > > > >> ??, 5 ??? 2024 ?. ? 02:05, Miroslav Zagorac <z...@fly-etf.net>:
> > > > >>> I think that this patch is not satisfactory because, for example,
> > > Solaris
> > > > >>> 11.4.0.0.1.15.0 (from 2018) has _POSIX_TIMERS and
> > > _POSIX_THREAD_CPUTIME
> > > > >>> defined, but does not have the pthread_getcpuclockid() function;
> > > while
> > > > >>> solaris
> > > > >>> 11.4.42.0.0.111.0 (from 2022) has that function.
> > > > >>>
> > > > >>
> > > > >> I'm trying to build on this vmactions/solaris-vm: Use Solaris in
> > > github
> > > > >> actions <https://github.com/vmactions/solaris-vm>
> > > > >> it does not have pthread_getcpuclockid()
> > > > >
> > > > > I'm wondering what the point of defining _POSIX_THREAD_CPUTIME can
> be
> > > > > then :-/
> > > > >
> > > >
> > > > The pthread_getcpuclockid() function is declared in the include file
> > > > /usr/include/pthread.h.  The only difference between the two
> "versions"
> > > of
> > > > Solaris 11.4 is that the newer version has a declaration and the
> older
> > > one
> > > > does not.
> > > >
> > > > However, _POSIX_THREAD_CPUTIME is defined in the
> /usr/include/unistd.h
> > > file as
> > > > -1 in the UNIX 03 block of options that are not supported in Solaris
> > > 11.4.
> > > >
> > > > /* Unsupported UNIX 03 options */
> > > > #if defined(_XPG6)
> > > > ..
> > > > #define _POSIX_THREAD_CPUTIME (-1)
> > > > ..
> > > > #endif
> > > >
> > > >
> > > > An explanation of that definition can be found here:
> > > >
> > > > https://docs.oracle.com/cd/E88353_01/html/E37842/unistd-3head.html
> > > >
> > > > "If a symbolic constant is defined with the value -1, the option is
> not
> > > > supported. Headers, data types, and function interfaces required only
> > > for the
> > > > option need not be supplied. An application that attempts to use
> anything
> > > > associated only with the option is considered to be requiring an
> > > extension.
> > > (...)
> > >
> > > Ah excellent, that's quite useful! We're already doing that with
> > > _POSIX_TIMERS. So I guess one just needs to try this instead:
> > >
> > > -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) &&
> > > defined(_POSIX_THREAD_CPUTIME
> > > +#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) &&
> > > defined(_POSIX_THREAD_CPUTIME && (_POSIX_THREAD_CPUTIME >= 0)
> > >
> >
> > that worked (I added closing bracket after second "defined")
>
> Ah yes indeed. Thanks for the test. Do you want to update you patch maybe,
> since you can test it ?
>
> Thanks,
> Willy
>

Reply via email to