WebAssembly / WebAssembly/WASI

clocks: Cannot implement `clock_nanosleep(CLOCK_REALTIME, ...)` in C

Open
#857 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P-clocks
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Currently WASIp{2,3} WITs for wasi:clocks only support subscribing to the monotonic clock, not the wall clock. This means that it's required for C programs to sleep with CLOCK_MONOTONIC instead of CLOCK_REALTIME. This issue was papered over with the historical WASIp1-to-WASIp2 adapter and never surfaced, but the libc implementation is slightly different in that it rejects sleeping with CLOCK_REALTIME since that's not actually supported. I'm not aware of a reason to specifically not support this, so I wanted to file an issue to eventually add the same-style subscribe* functions to the wasi:clocks/wall-clock interface.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the wasi:clocks WITs, especially the wasi:clocks/wall-clock interface, and compare them with the monotonic-clock subscribe* functions. Trace the libc handling of clock_nanosleep and determine the interface changes needed so CLOCK_REALTIME is supported; done means the wall-clock subscription path and corresponding C behavior are implemented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.