[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/33: gnu: glibc: Add and update patches for the Hurd.
From: |
guix-commits |
Subject: |
08/33: gnu: glibc: Add and update patches for the Hurd. |
Date: |
Fri, 13 Mar 2020 02:45:51 -0400 (EDT) |
janneke pushed a commit to branch wip-hurd
in repository guix.
commit 26d4f78558f5ef00d94f2495a90fae4e1f4c741b
Author: Jan Nieuwenhuizen <address@hidden>
AuthorDate: Sun Mar 1 16:37:37 2020 +0100
gnu: glibc: Add and update patches for the Hurd.
* gnu/packages/patches/glibc-hurd-magic-pid.patch: Remove unused file.
* gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch: New file.
* gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch: New file.
* gnu/local.mk (dist_patch_DATA): Update them.
* gnu/packages/base.scm (glibc): Use two new patches.
---
gnu/local.mk | 5 +-
gnu/packages/base.scm | 4 +-
.../glibc-hurd-clock_gettime_monotonic.patch | 81 +++++++++
.../patches/glibc-hurd-clock_t_centiseconds.patch | 87 ++++++++++
gnu/packages/patches/glibc-hurd-magic-pid.patch | 190 ---------------------
5 files changed, 174 insertions(+), 193 deletions(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index f2fd8a4..ab5e165 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -11,7 +11,7 @@
# Copyright © 2016 Ben Woodcroft <address@hidden>
# Copyright © 2016, 2017, 2018, 2019 Alex Vong <address@hidden>
# Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <address@hidden>
-# Copyright © 2016, 2017, 2018, 2019 Jan (janneke) Nieuwenhuizen
<address@hidden>
+# Copyright © 2016, 2017, 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen
<address@hidden>
# Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <address@hidden>
# Copyright © 2017, 2018 Clément Lassieur <address@hidden>
# Copyright © 2017 Mathieu Othacehe <address@hidden>
@@ -954,7 +954,8 @@ dist_patch_DATA =
\
%D%/packages/patches/glibc-bootstrap-system-2.16.0.patch \
%D%/packages/patches/glibc-bootstrap-system.patch \
%D%/packages/patches/glibc-hidden-visibility-ldconfig.patch \
- %D%/packages/patches/glibc-hurd-magic-pid.patch \
+ %D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch \
+ %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch \
%D%/packages/patches/glibc-ldd-x86_64.patch \
%D%/packages/patches/glibc-locales.patch \
%D%/packages/patches/glibc-locales-2.28.patch \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 7d645f8..e981087 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -610,7 +610,9 @@ the store.")
"glibc-versioned-locpath.patch"
"glibc-allow-kernel-2.6.32.patch"
"glibc-reinstate-prlimit64-fallback.patch"
- "glibc-supported-locales.patch"))))
+ "glibc-supported-locales.patch"
+ "glibc-hurd-clock_t_centiseconds.patch"
+
"glibc-hurd-clock_gettime_monotonic.patch"))))
(build-system gnu-build-system)
;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
diff --git a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
new file mode 100644
index 0000000..b2a08d8
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
@@ -0,0 +1,81 @@
+Forward ported from a patch from Debian's glibc-2.29.
+
+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 <address@hidden>
+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 ac3547df3c..af8681ba4e 100644
+--- a/sysdeps/mach/clock_gettime.c
++++ b/sysdeps/mach/clock_gettime.c
+@@ -25,7 +25,7 @@
+ int
+ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ {
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME)
+ {
+ errno = EINVAL;
+ return -1;
+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/sysdeps/pthread/timer_create.c
++++ b/sysdeps/pthread/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
+
diff --git a/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch
b/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch
new file mode 100644
index 0000000..dbb9b13
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch
@@ -0,0 +1,87 @@
+Forward ported from
+
+ commit d57f2f9b4bd007846af2fb4217486ea572579010
+ Author: Richard Braun <address@hidden>
+ Date: Tue Aug 27 11:35:31 2013 +0200
+
+ Express CPU time (clock_t of times(2)) in centiseconds
+
+From 170c292b643fdc1eb56881e6592b07c0c019993e Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <address@hidden>
+Date: Mon, 2 Mar 2020 18:28:54 +0100
+Subject: [PATCH 1/2] Express CPU time (clock_t) in centiseconds
+
+---
+ sysdeps/mach/hurd/clock.c | 8 ++++----
+ sysdeps/mach/hurd/getclktck.c | 5 ++---
+ sysdeps/mach/hurd/setitimer.c | 2 +-
+ sysdeps/mach/hurd/times.c | 2 +-
+ 4 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/clock.c b/sysdeps/mach/hurd/clock.c
+index 7cb42df786..4db49b579d 100644
+--- a/sysdeps/mach/hurd/clock.c
++++ b/sysdeps/mach/hurd/clock.c
+@@ -44,10 +44,10 @@ clock (void)
+ if (err)
+ return __hurd_fail (err);
+
+- total = bi.user_time.seconds * 1000000 + bi.user_time.microseconds;
+- total += tti.user_time.seconds * 1000000 + tti.user_time.microseconds;
+- total += bi.system_time.seconds * 1000000 + bi.system_time.microseconds;
+- total += tti.system_time.seconds * 1000000 + tti.system_time.microseconds;
++ total = bi.user_time.seconds * 100 + bi.user_time.microseconds / 10000;
++ total += tti.user_time.seconds * 100 + tti.user_time.microseconds / 10000;
++ total += bi.system_time.seconds * 100 + bi.system_time.microseconds / 10000;
++ total += tti.system_time.seconds * 100 + tti.system_time.microseconds /
10000;
+
+ return total;
+ }
+diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
+index 943e36e805..5a3cf0930b 100644
+--- a/sysdeps/mach/hurd/getclktck.c
++++ b/sysdeps/mach/hurd/getclktck.c
+@@ -18,12 +18,11 @@
+
+ #include <time.h>
+
+-/* Return frequency of `times'.
+- Since Mach reports CPU times in microseconds, we always use 1 million. */
++/* Return frequency of `times'. */
+ int
+ __getclktck (void)
+ {
+- return 1000000;
++ return 100;
+ }
+
+ /* Before glibc 2.2, the Hurd actually did this differently, so we
+diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
+index b16f4ddd5d..8bf1464830 100644
+--- a/sysdeps/mach/hurd/setitimer.c
++++ b/sysdeps/mach/hurd/setitimer.c
+@@ -43,7 +43,7 @@ quantize_timeval (struct timeval *tv)
+ static time_t quantum = -1;
+
+ if (quantum == -1)
+- quantum = 1000000 / __getclktck ();
++ quantum = 100 / __getclktck ();
+
+ tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum;
+ if (tv->tv_usec >= 1000000)
+diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
+index 23ed992783..cbf6039b19 100644
+--- a/sysdeps/mach/hurd/times.c
++++ b/sysdeps/mach/hurd/times.c
+@@ -29,7 +29,7 @@
+ static inline clock_t
+ clock_from_time_value (const time_value_t *t)
+ {
+- return t->seconds * 1000000 + t->microseconds;
++ return t->seconds * 100 + t->microseconds / 10000;
+ }
+
+ /* Store the CPU time used by this process and all its
+--
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-hurd-magic-pid.patch
b/gnu/packages/patches/glibc-hurd-magic-pid.patch
deleted file mode 100644
index a6849f7..0000000
--- a/gnu/packages/patches/glibc-hurd-magic-pid.patch
+++ /dev/null
@@ -1,190 +0,0 @@
-This patch implements "magic" lookup for "pid/…", as used when looking up
-/proc/self.
-
-The patch comes from the 't/magic-pid' branch
-at <https://git.savannah.gnu.org/cgit/hurd/glibc.git>. It squashes
-commit 392e52286a302ca6157fbd221295e64ab6b6d8ba (by Justus Winter)
-and commit 392e52286a302ca6157fbd221295e64ab6b6d8ba (a subsequent fix by
-Samuel Thibault).
-
-From: Justus Winter <address@hidden>
-Subject: [PATCH] hurd: Handle `pid' magical lookup retry
-
- * hurd/lookup-retry.c: Handle `pid' magical lookup
- retry.
-
-diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
-index aee2ba8f93..6ed8de1653 100644
---- a/hurd/lookup-retry.c
-+++ b/hurd/lookup-retry.c
-@@ -25,6 +25,7 @@
- #include <string.h>
- #include <_itoa.h>
- #include <eloop-threshold.h>
-+#include <unistd.h>
-
- /* Translate the error from dir_lookup into the error the user sees. */
- static inline error_t
-@@ -59,6 +60,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- error_t err;
- char *file_name;
- int nloops;
-+ file_t lastdir = MACH_PORT_NULL;
-
- error_t lookup_op (file_t startdir)
- {
-@@ -107,14 +109,15 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- {
- case FS_RETRY_REAUTH:
- if (err = reauthenticate (*result))
-- return err;
-+ goto out;
- /* Fall through. */
-
- case FS_RETRY_NORMAL:
- if (nloops++ >= __eloop_threshold ())
- {
- __mach_port_deallocate (__mach_task_self (), *result);
-- return ELOOP;
-+ err = ELOOP;
-+ goto out;
- }
-
- /* An empty RETRYNAME indicates we have the final port. */
-@@ -174,7 +177,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
-
- if (err)
- __mach_port_deallocate (__mach_task_self (), *result);
-- return err;
-+ goto out;
- }
-
- startdir = *result;
-@@ -189,7 +192,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- if (*result != MACH_PORT_NULL)
- __mach_port_deallocate (__mach_task_self (), *result);
- if (nloops++ >= __eloop_threshold ())
-- return ELOOP;
-+ {
-+ err = ELOOP;
-+ goto out;
-+ }
- file_name = &retryname[1];
- break;
-
-@@ -208,7 +214,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- (*end != '/' && *end != '\0'))
- {
- errno = save;
-- return ENOENT;
-+ err = ENOENT;
-+ goto out;
- }
- if (! get_dtable_port)
- err = EGRATUITOUS;
-@@ -226,9 +233,12 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- }
- errno = save;
- if (err)
-- return err;
-+ goto out;
- if (*end == '\0')
-- return 0;
-+ {
-+ err = 0;
-+ goto out;
-+ }
- else
- {
- /* Do a normal retry on the remaining components. */
-@@ -255,9 +265,12 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO,
- (integer_t *) &hostinfo,
- &hostinfocnt))
-- return err;
-+ goto out;
- if (hostinfocnt != HOST_BASIC_INFO_COUNT)
-- return EGRATUITOUS;
-+ {
-+ err = EGRATUITOUS;
-+ goto out;
-+ }
- p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0);
- *--p = '/';
- p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0);
-@@ -293,10 +306,11 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- }
-
- case '\0':
-- return opentty (result);
-+ err = opentty (result);
-+ goto out;
- case '/':
- if (err = opentty (&startdir))
-- return err;
-+ goto out;
- strcpy (retryname, &retryname[4]);
- break;
- default:
-@@ -306,14 +320,48 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- goto bad_magic;
- break;
-
-+ case 'p':
-+ if (retryname[1] == 'i' && retryname[2] == 'd' &&
-+ (retryname[3] == '/' || retryname[3] == 0))
-+ {
-+ char *p, buf[1024]; /* XXX */
-+ size_t len;
-+ p = _itoa (__getpid (), &buf[sizeof buf], 10, 0);
-+ len = &buf[sizeof buf] - p;
-+ memcpy (buf, p, len);
-+ strcpy (buf + len, &retryname[3]);
-+ strcpy (retryname, buf);
-+
-+ /* Do a normal retry on the remaining components. */
-+ __mach_port_mod_refs (__mach_task_self (), lastdir,
-+ MACH_PORT_RIGHT_SEND, 1);
-+ startdir = lastdir;
-+ file_name = retryname;
-+ }
-+ else
-+ goto bad_magic;
-+ break;
-+
- default:
- bad_magic:
-- return EGRATUITOUS;
-+ err = EGRATUITOUS;
-+ goto out;
- }
- break;
-
- default:
-- return EGRATUITOUS;
-+ err = EGRATUITOUS;
-+ goto out;
-+ }
-+
-+ if (MACH_PORT_VALID (*result) && *result != lastdir)
-+ {
-+ if (MACH_PORT_VALID (lastdir))
-+ __mach_port_deallocate (__mach_task_self (), lastdir);
-+
-+ lastdir = *result;
-+ __mach_port_mod_refs (__mach_task_self (), lastdir,
-+ MACH_PORT_RIGHT_SEND, 1);
- }
-
- if (startdir != MACH_PORT_NULL)
-@@ -326,6 +374,10 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
- err = (*use_init_port) (dirport, &lookup_op);
- } while (! err);
-
-+out:
-+ if (MACH_PORT_VALID (lastdir))
-+ __mach_port_deallocate (__mach_task_self (), lastdir);
-+
- return err;
- }
- weak_alias (__hurd_file_name_lookup_retry, hurd_file_name_lookup_retry)
- branch wip-hurd created (now f101a30), guix-commits, 2020/03/13
- 03/33: gnu: hurd: Fix hurd-target?, add hurd-system?., guix-commits, 2020/03/13
- 01/33: gnu: flex-2.6.1: Build fix for the Hurd., guix-commits, 2020/03/13
- 10/33: gnu: cross-libc: Build fix for the Hurd., guix-commits, 2020/03/13
- 06/33: gnu: less: Build fix for the Hurd., guix-commits, 2020/03/13
- 13/33: gnu: pciutils: Build fixes for the Hurd., guix-commits, 2020/03/13
- 19/33: gnu: commencement: gcc-boot0: Build fix for the Hurd., guix-commits, 2020/03/13
- 04/33: gnu: java-jansi-native: Compile fix for the Hurd., guix-commits, 2020/03/13
- 11/33: gnu: shadow: Add linux-pam dependency for the Hurd., guix-commits, 2020/03/13
- 08/33: gnu: glibc: Add and update patches for the Hurd.,
guix-commits <=
- 20/33: gnu: commencement: gnumach-headers-boot0: Build from tarball., guix-commits, 2020/03/13
- 24/33: gnu: commencement: hurd-source: Update to latest git., guix-commits, 2020/03/13
- 23/33: gnu: commencement: glibc-intermediate: Build fixes for the Hurd., guix-commits, 2020/03/13
- 28/33: gnu: hurd: Update to hurd-headers version: 0.9-91a51672., guix-commits, 2020/03/13
- 25/33: gnu: commencement: gnumach-headers-boot0: Update to 1.8-116-g28b53508., guix-commits, 2020/03/13
- 29/33: daemon: Do not use clone on the Hurd., guix-commits, 2020/03/13
- 32/33: gnu: bootstrap: gcc-static: Use gcc-5., guix-commits, 2020/03/13
- 33/33: DRAFT gnu: bootstrap: Add support for the Hurd., guix-commits, 2020/03/13
- 16/33: gnu: screen: Build fix for the Hurd., guix-commits, 2020/03/13
- 05/33: gnu: make: Support for the Hurd., guix-commits, 2020/03/13