aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
blob: b02215550d9f7ee0211e37f10cd36cec97af4ee6 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
This is needed to run Python on the Hurd, especially during the build of
python-boot0.

Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff

Use the realtime clock for the monotonic clock. This is of course not a proper
implementation (which is being done in Mach), but will permit to fix at least
the iceweasel stack.

vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
former.

From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Mon, 2 Mar 2020 18:59:04 +0100
Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.

---
 sysdeps/mach/clock_gettime.c       | 2 +-
 sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
 sysdeps/posix/clock_getres.c       | 1 +
 sysdeps/pthread/timer_create.c     | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
index 6862fc8c..be1449bf 100644
--- a/sysdeps/mach/clock_gettime.c
+++ b/sysdeps/mach/clock_gettime.c
@@ -32,6 +32,7 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts)
   switch (clock_id) {
 
     case CLOCK_REALTIME:
+    case CLOCK_MONOTONIC:
       {
 	/* __host_get_time can only fail if passed an invalid host_t.
 	   __mach_host_self could theoretically fail (producing an
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 0050151332..27b3a28ab7 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -163,10 +163,10 @@
 #define _POSIX_THREAD_PROCESS_SHARED	-1
 
 /* The monotonic clock might be available.  */
-#define _POSIX_MONOTONIC_CLOCK	0
+#define _POSIX_MONOTONIC_CLOCK	200809L
 
-/* The clock selection interfaces are available.  */
-#define _POSIX_CLOCK_SELECTION	200809L
+/* The clock selection interfaces are not really available yet.  */
+#define _POSIX_CLOCK_SELECTION	-1
 
 /* Advisory information interfaces could be available in future.  */
 #define _POSIX_ADVISORY_INFO	0
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index fcd79fd554..1dd02aa449 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
   switch (clock_id)
     {
     case CLOCK_REALTIME:
+    case CLOCK_MONOTONIC:
       retval = realtime_getres (res);
       break;
 
diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c
index 9d8a9ea8ae..3430582c09 100644
--- a/rt/timer_create.c
+++ b/rt/timer_create.c
@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
       return -1;
     }
 
-  if (clock_id != CLOCK_REALTIME)
+  if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC)
     {
       __set_errno (EINVAL);
       return -1;
-- 
2.24.0

quot;)) (idris-path (string-split idris-library-path #\:)) (idris-path-files (apply append (map (lambda (path) (map (lambda (dir) (string-append path "/" dir)) (scandir path))) idris-path))) (idris-path-subdirs (filter (lambda (path) (and path (match (stat:type (stat path)) ('directory #t) (_ #f)))) idris-path-files)) (install-cmd (cons* idris-bin "--ibcsubdir" ibcsubdir "--build" ipkg ;; only trigger a build, as --ibcsubdir ;; already installs .ibc files. (apply append (map (lambda (path) (list "--idrispath" path)) idris-path-subdirs))))) ;; FIXME: Seems to be a bug in idris that causes a dubious failure. (apply system* install-cmd))))))) (define-public idris-lightyear (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a")) (package (name "idris-lightyear") (version (git-version "0.1" "1" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ziman/lightyear") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af")))) (build-system gnu-build-system) (native-inputs (list idris)) (arguments (idris-default-arguments name)) (home-page "https://github.com/ziman/lightyear") (synopsis "Lightweight parser combinator library for Idris") (description "Lightweight parser combinator library for Idris, inspired by Parsec. This package is used (almost) the same way as Parsec, except for one difference: backtracking.") (license license:bsd-2)))) (define-public idris-wl-pprint (let ((commit "1d365fcf4ba075859844dbc5eb96a90f57b9f338")) (package (name "idris-wl-pprint") (version (git-version "0.1" "1" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/shayan-najd/wl-pprint") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "0g7c3y9smifdz4sivi3qmvymhdr7v9kfq45fmfmmvkqcrix0spzn")))) (build-system gnu-build-system) (native-inputs (list idris)) (arguments (idris-default-arguments name)) (home-page "https://github.com/shayan-najd/wl-pprint") (synopsis "Pretty printing library") (description "A pretty printing library for Idris based on Phil Wadler's paper A Prettier Printer and on Daan Leijen's extensions in the Haskell wl-pprint library.") (license license:bsd-2)))) (define-public idris-bifunctors (let ((commit "53d06a6ccfe70c49c9ae8c8a4135981dd2173202")) (package (name "idris-bifunctors") (version (git-version "0.1" "1" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/HuwCampbell/Idris-Bifunctors") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "02vbsd3rmgnj0l1qq787709qcxjbr9890cbad4ykn27f77jk81h4")))) (build-system gnu-build-system) (native-inputs (list idris)) (arguments (idris-default-arguments name)) (home-page "https://github.com/HuwCampbell/Idris-Bifunctors") (synopsis "Bifunctor library") (description "This is a bifunctor library for Idris based off the excellent Haskell Bifunctors package from Edward Kmett.") (license license:bsd-3)))) (define-public idris-lens (let ((commit "26f012005f6849806cea630afe317e42cae97f29")) (package (name "idris-lens") (version (git-version "0.1" "1" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/HuwCampbell/idris-lens") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "06jzfj6rad08rk92w8jk5byi79svmyg0mrcqhibgx8rkjjy6vmai")))) (build-system gnu-build-system) (native-inputs (list idris)) (propagated-inputs (list idris-bifunctors)) (arguments (idris-default-arguments name)) (home-page "https://github.com/HuwCampbell/idris-lens") (synopsis "Van Laarhoven lenses for Idris") (description "Lenses are composable functional references. They allow accessing and modifying data within a structure.") (license license:bsd-3))))