[PATCH] Decode dynamic posix clocks.

Dmitry V. Levin ldv at altlinux.org
Sat Feb 1 00:43:26 UTC 2014


On Fri, Jan 31, 2014 at 12:01:03PM +0100, Stefan Sørensen wrote:
> +static void
> +printclockname(int clockid)
> +{
> +#ifdef CLOCKID_TO_FD
> +	if(clockid < 0)
> +		tprintf("CLOCKFD(%d)", CLOCKID_TO_FD(clockid));

I'm not sure this is quite correct:
all (clockid & CLOCKFD_MASK) bits would be lost.

BTW, CLOCKFD is not the only possible case, other values (CPUCLOCK_PROF,
CPUCLOCK_VIRT, and CPUCLOCK_SCHED) are also possible and probably worth
decoding, e.g.

	if (id < 0) {
		if ((id & CLOCKFD_MASK) == CLOCKFD)
			tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(id));
		else {
			tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(id));
			printxval(cpuclock, id & CLOCKFD_MASK, "CPUCLOCK_???");
			tprints(")");
		}
	}


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140201/22891911/attachment.bin>


More information about the Strace-devel mailing list