Skip to content

solarish: add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID#5274

Open
Toasterson wants to merge 1 commit into
rust-lang:mainfrom
Toasterson:solarish-cputime-clock-ids
Open

solarish: add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID#5274
Toasterson wants to merge 1 commit into
rust-lang:mainfrom
Toasterson:solarish-cputime-clock-ids

Conversation

@Toasterson

Copy link
Copy Markdown
Contributor

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

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

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).
@rustbot

rustbot commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

@rustbot rustbot added O-solarish O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-solarish O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants