|
|
Subscribe / Log in / New account

Stash in clockid?

Stash in clockid?

Posted Mar 7, 2025 11:55 UTC (Fri) by eru (subscriber, #2753)
Parent article: Timer IDs, CRIU, and ABI challenges

I wonder why the extension to choose timerid was not stashed into the clockid parameter by setting a higher bit ? There is room, the constants for clockid are small integers. This would have kept the effect local.


to post comments

Stash in clockid?

Posted Mar 7, 2025 15:08 UTC (Fri) by abatters (✭ supporter ✭, #6932) [Link] (1 responses)

There is already a hack to put file descriptors in clockids; see "Dynamic clocks" section of https://man7.org/linux/man-pages/man2/clock_gettime.2.html

Stash in clockid?

Posted Mar 7, 2025 16:54 UTC (Fri) by eru (subscriber, #2753) [Link]

There would still be room, since the clockid is a 32-bit value and file descriptors are never very large. The clock type values take the bottom 3 bits. If the sign bit is left alone, and we use bit 30 for the special flag, this still leaves 27 bits for the fd part, which is way more than enough.

Stash in clockid?

Posted Mar 7, 2025 15:12 UTC (Fri) by bushdave (guest, #58418) [Link] (1 responses)

That wouldn't be a compatible interface. In the POSIX API, the timer_t *id pointer is write-only for the system call. It is fair to assume that it points to uninitialized memory, with any combination of bits set.

Stash in clockid?

Posted Mar 7, 2025 15:13 UTC (Fri) by bushdave (guest, #58418) [Link]

Never mind, I understand now that I thought I read something I didnt.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds