Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libc: make pthread_getcpuclockid() compatible with glibc
When we run tst-pthread-clock.cc on OSv with Linux dynamic linker, it uses the glibc version of pthread_getcpuclockid(). The glibc pthread_getcpuclockid() uses different scheme (same musl) to encode the clockid which is actually compatible with what Linux kernel expects when handling clock_gettime(). In the end, the tst-pthread-clock.cc fails when calling clock_gettime() with clock_id returned earlier by pthread_getcpuclockid(). To make this test work correctly on OSv with Linux dynamic linker, we change the scheme used by pthread_getcpuclockid() and clock_gettime() to follow what glibc and musl do (see https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getcpuclockid.c and https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h). With this patch one can run more tests on OSv with Linux dynamic linker: scripts/test.py --linux_ld -m modules/tests-with-linux-ld/usr.manifest \ -d tst-kill \ -d tst-sigaction \ -d tst-sigwait \ -d tst-stdio-rofs \ -d tst-wctype Signed-off-by: Waldemar Kozaczuk <[email protected]> Closes cloudius-systems#1286
- Loading branch information