cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.12k stars 605 forks source link

libc: add minimal implementation of clock_nanosleep() #1244

Closed wkozaczuk closed 1 year ago

wkozaczuk commented 1 year ago

This patch adds minimal implementation of clock_nanosleep() and corresponding syscall that is enough to support glibc implementation of the userland function nanosleep() which delegates to:

__syscall(clock_nanosleep, CLOCK_REALTIME, 0, req, rem)

In other words, the new clock_nanosleep() only implements scenario where clock_id is CLOCK_REALTIME and flags is 0.

Please note that there is a patch sent to the mailing list that implements the non-zero (TIMER_ABSTIME) scenario which is useful in realtime scheduler scenarios.