Commit | Line | Data |
---|---|---|
974c42a7 JN |
1 | This is needed to run Python on the Hurd, especially during the build of |
2 | python-boot0. | |
3 | ||
4 | Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff | |
5 | ||
6 | Use the realtime clock for the monotonic clock. This is of course not a proper | |
7 | implementation (which is being done in Mach), but will permit to fix at least | |
8 | the iceweasel stack. | |
9 | ||
10 | vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but | |
11 | _POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the | |
12 | former. | |
13 | ||
14 | From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001 | |
15 | From: Jan Nieuwenhuizen <janneke@gnu.org> | |
16 | Date: Mon, 2 Mar 2020 18:59:04 +0100 | |
17 | Subject: [PATCH 2/2] Use realtime clock for the monotonic clock. | |
18 | ||
19 | --- | |
20 | sysdeps/mach/clock_gettime.c | 2 +- | |
21 | sysdeps/mach/hurd/bits/posix_opt.h | 6 +++--- | |
22 | sysdeps/posix/clock_getres.c | 1 + | |
23 | sysdeps/pthread/timer_create.c | 2 +- | |
24 | 4 files changed, 6 insertions(+), 5 deletions(-) | |
25 | ||
26 | diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c | |
27 | index ac3547df3c..af8681ba4e 100644 | |
28 | --- a/sysdeps/mach/clock_gettime.c | |
29 | +++ b/sysdeps/mach/clock_gettime.c | |
30 | @@ -25,7 +25,7 @@ | |
31 | int | |
32 | __clock_gettime (clockid_t clock_id, struct timespec *ts) | |
33 | { | |
34 | - if (clock_id != CLOCK_REALTIME) | |
35 | + if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME) | |
36 | { | |
37 | errno = EINVAL; | |
38 | return -1; | |
39 | diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h | |
40 | index 0050151332..27b3a28ab7 100644 | |
41 | --- a/sysdeps/mach/hurd/bits/posix_opt.h | |
42 | +++ b/sysdeps/mach/hurd/bits/posix_opt.h | |
43 | @@ -163,10 +163,10 @@ | |
44 | #define _POSIX_THREAD_PROCESS_SHARED -1 | |
45 | ||
46 | /* The monotonic clock might be available. */ | |
47 | -#define _POSIX_MONOTONIC_CLOCK 0 | |
48 | +#define _POSIX_MONOTONIC_CLOCK 200809L | |
49 | ||
50 | -/* The clock selection interfaces are available. */ | |
51 | -#define _POSIX_CLOCK_SELECTION 200809L | |
52 | +/* The clock selection interfaces are not really available yet. */ | |
53 | +#define _POSIX_CLOCK_SELECTION -1 | |
54 | ||
55 | /* Advisory information interfaces could be available in future. */ | |
56 | #define _POSIX_ADVISORY_INFO 0 | |
57 | diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c | |
58 | index fcd79fd554..1dd02aa449 100644 | |
59 | --- a/sysdeps/posix/clock_getres.c | |
60 | +++ b/sysdeps/posix/clock_getres.c | |
61 | @@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res) | |
62 | switch (clock_id) | |
63 | { | |
64 | case CLOCK_REALTIME: | |
65 | + case CLOCK_MONOTONIC: | |
66 | retval = realtime_getres (res); | |
67 | break; | |
68 | ||
69 | diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c | |
70 | index 9d8a9ea8ae..3430582c09 100644 | |
71 | --- a/sysdeps/pthread/timer_create.c | |
72 | +++ b/sysdeps/pthread/timer_create.c | |
73 | @@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) | |
74 | return -1; | |
75 | } | |
76 | ||
77 | - if (clock_id != CLOCK_REALTIME) | |
78 | + if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC) | |
79 | { | |
80 | __set_errno (EINVAL); | |
81 | return -1; | |
82 | -- | |
83 | 2.24.0 | |
84 |