On 04. 05. 2024. 17:36, Ilya Shipitsin wrote:
> this function is considered optional for POSIX and not implemented
> on Illumos
> 
> Reference: 
> https://www.gnu.org/software/gnulib/manual/html_node/pthread_005fgetcpuclockid.html
> According to 
> https://github.com/cpredef/predef/blob/master/OperatingSystems.md Illumos
> is identified by __illumos__ macro available since gcc-11
> ---
>  src/clock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/clock.c b/src/clock.c
> index ec2133c8b..f484c2d9c 100644
> --- a/src/clock.c
> +++ b/src/clock.c
> @@ -135,7 +135,7 @@ uint64_t now_cpu_time_thread(int thr)
>  /* set the clock source for the local thread */
>  void clock_set_local_source(void)
>  {
> -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && 
> defined(_POSIX_THREAD_CPUTIME)
> +#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && 
> defined(_POSIX_THREAD_CPUTIME) && !defined(__illumos__)
>  #ifdef USE_THREAD
>       pthread_getcpuclockid(pthread_self(), &per_thread_clock_id[tid]);
>  #else

Hello Ilya,

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.

Maybe it could be solved in a different way..


Best regards,

-- 
Miroslav Zagorac

What can change the nature of a man?

Reply via email to