Re: [PATCH resend] Reading POSIX CPU timer from outside the process.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dario Faggioli
Date: Tuesday, December 28, 2010 - 2:38 pm

On Tue, 2010-12-28 at 17:38 +0100, Oleg Nesterov wrote: 
Sorry then... :-(

Sure, you're right, this could have been more clear.

I tested all the clock_getres() calls that came to my mind (at least the
one that are possible from an userspace program), and they always worked
because of this (still in check_clock):

        const pid_t pid = CPUCLOCK_PID(which_clock);

        if (pid == 0)
                return 0;

Which triggers all the times, except when you actually try to get a CPU
clockid from outside the process, but that's not possible with getres.

Anyway, looking at the code again I agree, it may work, but it's not
something I really like! :-|

The whole point was about, given the current implementation of
clock_getcpuclockid done by glibc, can we remove that "failed with
success" (showed in the changelog) thing and come up with some
meaningful clockid for that situation? It's more than possible for the
answer to be no!!! :-P

Which won't work because CPUCLOCK_PERTHREAD(which_clock) is always false
in this case. 

Same as above... To the point that I'm now wondering if we ever take
this branch here...

BTW, again, I see your point, the fix might need to happen at glibc
level. I'll check that and come back if I find something interesting.

Thanks anyway,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa  (Italy)

http://retis.sssup.it/people/faggioli -- dario.faggioli@jabber.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Read THREAD_CPUTIME clock from other processes., Dario Faggioli, (Thu Dec 23, 9:21 am)
Re: [PATCH] Read THREAD_CPUTIME clock from other processes., Dario Faggioli, (Thu Dec 23, 10:38 am)
Re: [PATCH] Read THREAD_CPUTIME clock from other processes., Dario Faggioli, (Thu Dec 23, 10:43 am)
Re: [PATCH resend] Reading POSIX CPU timer from outside th ..., Dario Faggioli, (Tue Dec 28, 2:38 pm)