threads/180496: clock_gettime() does not return CPU-time for zombie processes
Petr Salinger
Petr.Salinger at seznam.cz
Fri Jul 12 21:10:02 UTC 2013
The following reply was made to PR threads/180496; it has been noted by GNATS.
From: Petr Salinger <Petr.Salinger at seznam.cz>
To: Konstantin Belousov <kostikbel at gmail.com>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: threads/180496: clock_gettime() does not return CPU-time for
zombie processes
Date: Fri, 12 Jul 2013 22:59:51 +0200 (CEST)
> Please try this. The clock_gettime() call on zombie clock worked
> for me.
Perfect. Many thanks.
> Note that the check for clock_getres() on the reapped process clock
> failed since we do not check for pid validity, all processes has
> the same clock. I do not see much sense in adding the useless check.
I agree that such check is technically useless.
I cannot imagine usage of such restriction.
The only reason of this check is wording of POSIX standard in
http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
"The clock_getres(), clock_gettime(), and clock_settime() functions shall
fail if:
[EINVAL]
The clock_id argument does not specify a known clock."
But this behaviour can be easily added in userspace wrapper.
Similarly as
" The clock_settime() function shall fail if:
[EINVAL]
The value of the clock_id argument is CLOCK_MONOTONIC."
The kernel returns EPERM for ordinary user.
Would be possible to MFC SYS_clock_getcpuclockid2
and related kernel changes into STABLE-9 ?
Thanks again
Petr
More information about the freebsd-threads
mailing list