Commit 62d5368b authored by Samuel Thibault's avatar Samuel Thibault

Update hurd patches from topgit

Mostly just comments, except:

  * debian/patches/hurd-i386/tg-context_functions.diff: Update from topgit.
  * debian/patches/hurd-i386/tg-sysvshm.diff: Update from topgit.
parent 8eb70102
......@@ -13,7 +13,9 @@ glibc (2.28-4) UNRELEASED; urgency=medium
[ Samuel Thibault ]
* debian/testsuite-xfail-debian.mk: whitelist failing new tests on hurd.
* patches/hurd-i386/git-fcntl64.diff: Fix 64bit implementation.
* debian/patches/hurd-i386/git-fcntl64.diff: Fix 64bit implementation.
* debian/patches/hurd-i386/tg-context_functions.diff: Update from topgit.
* debian/patches/hurd-i386/tg-sysvshm.diff: Update from topgit.
-- Aurelien Jarno <aurel32@debian.org> Mon, 17 Dec 2018 23:26:39 +0100
......
......@@ -11,6 +11,8 @@ Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/mach/hurd/fcntl.c (__libc_fcntl): Use __LOCK_ATOMIC along LOCK_SH and
LOCK_EX.
XXX: Adding to misc/sys/file.h is questionable
---
misc/sys/file.h | 1 +
sysdeps/mach/hurd/fcntl.c | 4 ++--
......
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [PATCH] Allow the kernel to start earlier than VM_MAX_ADDRESS
A bit hackish.
VM_MAX_ADDRESS shouldn't be hardcoded in libc, the kernel should be able to
decide about it dynamically. This fixes glibc into supporting that. It's however
a bit hackish.
---
sysdeps/mach/hurd/dl-sysdep.c | 26 ++++++++++++++++++++------
......
......@@ -4,7 +4,7 @@ Subject: [PATCH] bits_atomic.h_multiple_threads
TODO. bits/atomic.h for GNU Hurd.
Source: Debian, eglibc-2.10/debian/patches/hurd-i386/local-atomic-no-multiple_threads.diff, r3536.
Author: Samuel Thibault
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
We always at least start the sigthread anyway. For now, let's avoid forking
the file (which would mean having to maintain it).
......@@ -12,7 +12,7 @@ the file (which would mean having to maintain it).
Need to override sysdeps/i386/i486/bits/atomic.h to remove Linuxisms.
---
sysdeps/i386/i486/bits/atomic.h | 107 +++++++++++++---------------------------
sysdeps/i386/atomic-machine.h | 107 +++++++++++++++---------------------------
1 file changed, 37 insertions(+), 70 deletions(-)
Index: glibc-2.23/sysdeps/i386/atomic-machine.h
......
......@@ -20,20 +20,19 @@ stack to be used with makecontext).
--- a/sysdeps/mach/hurd/i386/Makefile
+++ b/sysdeps/mach/hurd/i386/Makefile
@@ -102,3 +102,8 @@
@@ -102,3 +102,7 @@
# callbacks whose parameters don't permit to get the context parameters.
check-execstack-xfail += ld.so libc.so libpthread.so
endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+sysdep_routines += makecontext-helper
+endif
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/getcontext.S
@@ -0,0 +1,74 @@
+/* Save current context.
+ Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
......@@ -107,84 +106,10 @@ stack to be used with makecontext).
+
+weak_alias (__getcontext, getcontext)
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/makecontext-helper.c
@@ -0,0 +1,71 @@
+/* Helper for makecontext: handle threadvars.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <hurd/threadvar.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
+
+#if 0
+
+void
+__makecontext_helper (ucontext_t *ucp)
+{
+ if (__hurd_threadvar_stack_mask == 0)
+ {
+ /* We are not using threads, so per init-first.c:init, the threadvars
+ live in a malloced space, addressed relative to the base of the
+ virtual address space. Just keep using that one. */
+ }
+ else
+ {
+ /* The following is only prepared to work with libpthread, which only
+ keeps the threadvars at the bottom of the stack -- contrary to
+ libthreads, which also puts additional data there. */
+
+ void *s = ucp->uc_stack.ss_sp;
+ size_t s_size = ucp->uc_stack.ss_size;
+
+ /* Is the new stack suitable? Check that that the last threadvar
+ occupies the last storage unit within the bounds of the new stack.
+ Alignment according to (sp & __hurd_threadvar_stack_mask) == sp is not
+ actually a requirement (though, in practice it often will be). */
+ if (__hurd_threadvar_location_from_sp (_HURD_THREADVAR_MAX, s)
+ != s + s_size)
+ {
+ /* Instead of having makecontext return an error, we bail out the
+ hard way, as we can't expect its caller to be able to properly
+ react to this situation. */
+ fprintf (stderr,
+ "*** makecontext: a stack at %p with size %#x is not "
+ "usable with threadvars\n",
+ s, s_size);
+ abort ();
+ }
+
+ /* Copy the threadvars to the new stack. */
+ void *t_old = __hurd_threadvar_location (0);
+ void *t_new = __hurd_threadvar_location_from_sp (0, s);
+ size_t t_size = __hurd_threadvar_max * sizeof (unsigned long int);
+ memcpy (t_new, t_old, t_size);
+ /* Account for the space taken by the threadvars. */
+ ucp->uc_stack.ss_size -= t_size;
+ }
+}
+#endif
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/makecontext.S
@@ -0,0 +1,130 @@
@@ -0,0 +1,122 @@
+/* Create new context.
+ Copyright (C) 2001,2002,2005,2007,2008,2009 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
......@@ -209,14 +134,6 @@ stack to be used with makecontext).
+
+ENTRY(__makecontext)
+ movl 4(%esp), %eax
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+ movl %eax, (%esp)
+ /* call HIDDEN_JUMPTARGET (__makecontext_helper) */
+ addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+
+ movl 4(%esp), %eax
+
+ /* Load the address of the function we are supposed to run. */
+ movl 8(%esp), %ecx
......@@ -317,7 +234,7 @@ stack to be used with makecontext).
+++ b/sysdeps/mach/hurd/i386/setcontext.S
@@ -0,0 +1,92 @@
+/* Install given context.
+ Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
......@@ -412,7 +329,7 @@ stack to be used with makecontext).
+++ b/sysdeps/mach/hurd/i386/swapcontext.S
@@ -0,0 +1,110 @@
+/* Save current context and install the given one.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
......
......@@ -16,6 +16,8 @@ or __io_select_timeout_request, depending on the timeout. Count the number of
ready descriptors (replies for which at least one type bit is set). Implement
the timeout locally when there is no file descriptor.
TODO: see XXX
---
hurd/Makefile | 3 +-
hurd/hurdselect.c | 116 +++++++++++++++++++++++++++++++++++------------------
......
Author: Richard Braun <rbraun@sceen.net>
From: Richard Braun <rbraun@sceen.net>
Subject: Fix Hurd implementation of setitimer.
Date: Wed Dec 26 16:31:14 2012 +0000
Fix Hurd implementation of setitimer.
The preemptor sigcode doesn't match since the POSIX sigcode SI_TIMER is
used when SIGALRM is sent. In addition, The inline version of
hurd_preempt_signals doesn't update _hurdsig_preempted_set. For these
......
......@@ -15,6 +15,34 @@ Subject: [PATCH] Implement SysV shared memory for GNU/Hurd.
* sysdeps/mach/hurd/shmdt.c: New file.
* sysdeps/mach/hurd/bits/posix_opt.h: Define _XOPEN_SHM to 1.
TODO:
> + char filename[sizeof (SHM_DIR) - 1 + SHM_NAMEMAX];
> + struct stat statbuf;
> +
> + sprintf (filename, SHM_DIR SHM_NAMEPRI, id);
> + /* SysV requires read access for IPC_STAT. */
> + fd = __open (filename, O_NORW);
> + if (fd < 0)
> + {
> + if (errno == ENOENT)
> + errno = EINVAL;
> + return -1;
> + }
Since this is repeated in more than one function, put it into an
internal subroutine. Then we have only one place doing the
name-generation logic.
> + case IPC_RMID:
> + res = __unlink (filename);
> + /* FIXME: Check error (mapping ENOENT to EINVAL). */
Fix it.
---
hurd/Makefile | 1
hurd/sysvshm.c | 97 ++++++++++++++
......@@ -235,8 +263,9 @@ Subject: [PATCH] Implement SysV shared memory for GNU/Hurd.
+}
--- /dev/null
+++ b/sysdeps/mach/hurd/shmat.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
@@ -0,0 +1,82 @@
+/* SysV shmat for Hurd.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
......@@ -250,9 +279,8 @@ Subject: [PATCH] Implement SysV shared memory for GNU/Hurd.
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <utime.h>
......@@ -293,7 +321,9 @@ Subject: [PATCH] Implement SysV shared memory for GNU/Hurd.
+ res = __fstat (fd, &statbuf);
+ if (res < 0)
+ {
+ err = errno;
+ __close (fd);
+ errno = err;
+ return (void *) -1;
+ }
+
......@@ -308,6 +338,7 @@ Subject: [PATCH] Implement SysV shared memory for GNU/Hurd.
+ if (err)
+ {
+ __munmap (addr, statbuf.st_size);
+ errno = err;
+ return (void *) -1;
+ }
+
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment