Message ID | CAKo4hFJz3=0KAay54eH=9h6zWVR-sjMfTpBcZjHHACKYN8p8yw@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
Hi, Sergey Korolev wrote, > Hi, > > I found that MAKE_THREAD_CPUCLOCK really introduced in > Linux 2.6.12 with POSIX timers implementation. So it is safe to > change clockid computation for all kernels (that support POSIX timers). Will you sent a new patch? thanks Waldemar
Hi, Waldemar. No, I suppose my lastest patch is sufficient to fix a bug for all kernels >= 2.6.12. Regards, Sergey. On Sun, Apr 30, 2017 at 11:38 AM, Waldemar Brodkorb <wbx@uclibc-ng.org> wrote: > Hi, > Sergey Korolev wrote, > > > Hi, > > > > I found that MAKE_THREAD_CPUCLOCK really introduced in > > Linux 2.6.12 with POSIX timers implementation. So it is safe to > > change clockid computation for all kernels (that support POSIX timers). > > Will you sent a new patch? > > thanks > Waldemar >
Hi Sergey, Sergey Korolev wrote, > Hi, Waldemar. > > No, I suppose my lastest patch is sufficient to fix a bug for all kernels >= > 2.6.12. Thanks, I added your test-case to uclibc-ng-test and your patch to master uclibc-ng. best regards Waldemar
From 57326b60773d5cafa3aa219b60ff91a703a90964 Mon Sep 17 00:00:00 2001 From: Sergey Korolev <s.korolev@ndmsystems.com> Date: Tue, 25 Apr 2017 02:14:59 +0300 Subject: [PATCH] pthread_getcpuclockid.c: fix clockid computation For the linux kernel (since 2.6.12) MAKE_THREAD_CPUCLOCK macro-like computation should be used to get clockid. --- libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c index ca3570f..f4ed2dc 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c @@ -20,6 +20,8 @@ #include <sys/time.h> #include <tls.h> +#define CPUCLOCK_PERTHREAD_MASK 4 +#define CPUCLOCK_SCHED 2 int pthread_getcpuclockid ( @@ -46,7 +48,8 @@ pthread_getcpuclockid ( return ERANGE; /* Store the number. */ - *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE); + *clockid = ((~(clockid_t) (pd->tid)) << CLOCK_IDFIELD_SIZE) + | CPUCLOCK_SCHED | CPUCLOCK_PERTHREAD_MASK; return 0; #else -- 2.7.4