solarish: add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID#5274
Open
Toasterson wants to merge 1 commit into
Open
solarish: add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID#5274Toasterson wants to merge 1 commit into
Toasterson wants to merge 1 commit into
Conversation
illumos usr/src/uts/common/sys/time_impl.h defines CLOCK_THREAD_CPUTIME_ID=2 (alias CLOCK_PROF) and CLOCK_PROCESS_CPUTIME_ID=5, but libc never bound them for solarish, so any crate that references these clock ids (e.g. the cpu-time crate) fails to build on illumos/solaris. Also drops the stale comment claiming clock_gettime(3c) "doesn't seem to accept anything other than CLOCK_REALTIME" -- that was true prior to illumos-gate commit dea9f5e6a49 (2021-10-16, "14126 clock_gettime() could work with thread/proc clocks"), which taught clock_gettime(3c) to honor the thread/process CPU-time clocks; both Oracle Solaris 11.4 and current illumos document and accept them. Verified at runtime on OpenIndiana 2026.04 via clock_gettime(3c) with both clock ids (both return 0).
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This does two things described below for reference if somebody needs to verify those.
illumos usr/src/uts/common/sys/time_impl.h defines CLOCK_THREAD_CPUTIME_ID=2 (alias CLOCK_PROF) and
CLOCK_PROCESS_CPUTIME_ID=5, but libc never bound them for solarish, so any crate that references these clock ids (e.g. the cpu-time crate) fails to build on illumos/solaris. And since I needed that I implemented them :)
Also drops the stale comment claiming clock_gettime(3c) "doesn't seem to accept anything other than CLOCK_REALTIME". This got fixed with illumos-gate commit dea9f5e6a49 (2021-10-16, "14126 clock_gettime() could work with thread/proc clocks"), which taught clock_gettime(3c) to honor the thread/process CPU-time clocks; both Oracle Solaris 11.4 and current illumos document and accept them.
Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI
@rustbot label +stable-nominated