diff options
-rw-r--r-- | .topdeps | 85 | ||||
-rw-r--r-- | .topmsg | 12 | ||||
-rw-r--r-- | hurd/hurd/threadvar.h | 15 | ||||
-rw-r--r-- | hurd/hurdsig.c | 49 | ||||
-rw-r--r-- | sysdeps/mach/hurd/f_setlk.h | 23 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/Makefile | 1 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/makecontext-helper.c | 69 |
7 files changed, 126 insertions, 128 deletions
@@ -1,3 +1,84 @@ -t/regenerate_configure +t/tls +t/tls-threadvar +t/tlsdesc.sym +t/bits_atomic.h_multiple_threads +t/_dl_random +t/gscope +t/socket_flags +t/socketpair_flags +t/pipe2 +t/____longjmp_chk +t/extern_inline +t/grantpt t/master_backports -t/tcbhead_t +t/cpuclock +t/host-independency +t/cancellation +t/pagesize +t/sysvshm +t/bigmem +t/locarchive +t/sendmsg-SCM_RIGHTS +t/thread-cancel +t/unlockpt-chroot +t/no-hp-timing +t/hurdsig-fixes +t/hurdsig-global-dispositions +t/hurdsig-SA_SIGINFO +t/hurdsig-fixes-2 +t/hurdsig-global-dispositions-versions +t/hooks +t/libpthread_depends +t/hurdsig-boot-fix +t/setitimer +t/single-select-timeout +t/pie-sbrk +t/remap_getcwd +t/poll_errors_fixes +t/exec-static +t/EIEIO-fr +t/context_functions +t/sigstate_thread_reference +t/tls_thread_leak +t/futimens +t/posix_thread +t/gai_misc +t/lockf64 +t/reboot-startup +t/WRLCK-upgrade +t/ifaddrs_v6 +t/io_select_timeout +t/vm_copy +t/gnumach +t/sendmsg-SCM_CREDS +t/mach-hurd-link +t/NO_HIDDEN +t/faccessat +t/eintr +cvs/errnos.d +cvs/mach-syscalls.mk +t/allocalim +cvs/auxv +cvs/gprof-tick +cvs/i686-link +cvs/libpthread.so +cvs/check-local-headers +cvs/IPV6_PKTINFO +t/bind_umask2 +t/bootstrap +t/gsync-libc +t/libc_cleanup +t/pthread_deps +cvs/mallocfork +t/timer_routines +cvs/build +t/no-werror +t/ONSTACK +t/EGREGIOUS-fr +t/NOFOLLOW +t/NOFOLLOW-DIRECTORY +t/libc_rwlock_recursive +t/magic-pid +t/thread-linkspace +t/UTIME +fixes-2.28 @@ -1,9 +1,7 @@ -Commited to git +From: Thomas Schwinge <thomas@schwinge.name> +Subject: Roger Whittaker -From: Samuel Thibault <samuel.thibault@ens-lyon.org> -Subject: [PATCH] hurd: Make libc able to call pthread stubs +Not for upstream submission. -* sysdeps/mach/hurd/bits/libc-lock.h [_LIBC]: Include -<bits/libc-lockP.h> - -Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> +Currently used by Thomas Schwinge for building cross toolchains / testing / +development. diff --git a/hurd/hurd/threadvar.h b/hurd/hurd/threadvar.h index c61e3bb9d9..414e452db5 100644 --- a/hurd/hurd/threadvar.h +++ b/hurd/hurd/threadvar.h @@ -22,6 +22,21 @@ #include <features.h> #include <tls.h> +/* The per-thread variables are found by ANDing this mask + with the value of the stack pointer and then adding this offset. + + In the multi-threaded case, cthreads initialization sets + __hurd_threadvar_stack_mask to ~(cthread_stack_size - 1), a mask which + finds the base of the fixed-size cthreads stack; and + __hurd_threadvar_stack_offset to a small offset that skips the data + cthreads itself maintains at the base of each thread's stack. + + In the single-threaded or libpthread case, __hurd_threadvar_stack_mask is + zero, so the stack pointer is ignored. */ + +extern unsigned long int __hurd_threadvar_stack_mask; +extern unsigned long int __hurd_threadvar_stack_offset; + /* The variables __hurd_sigthread_stack_base and __hurd_sigthread_stack_end define the bounds of the stack used by the signal thread, so that thread can always be specifically identified. */ diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 2f16ad5482..7bc4bc97aa 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -1237,55 +1237,6 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, ss = post_signal (ss, signo, detail, untraced, reply); if (! ss) return; - /* No pending signals left undelivered for this thread. - If we were sent signal 0, we need to check for pending - signals for all threads. */ - if (signo == 0) - { - __spin_unlock (&ss->lock); - __mutex_lock (&_hurd_siglock); - for (ss = _hurd_sigstates; ss != NULL; ss = ss->next) - { - __spin_lock (&ss->lock); - for (signo = 1; signo < NSIG; ++signo) - if (__sigismember (&ss->pending, signo) - && (!__sigismember (&ss->blocked, signo) - /* We "deliver" immediately pending blocked signals whose - action might be to ignore, so that if ignored they are - dropped right away. */ - || ss->actions[signo].sa_handler == SIG_IGN - || ss->actions[signo].sa_handler == SIG_DFL)) - { - __mutex_unlock (&_hurd_siglock); - goto deliver_pending; - } - __spin_unlock (&ss->lock); - } - __mutex_unlock (&_hurd_siglock); - } - else - { - /* No more signals pending; SS->lock is still locked. - Wake up any sigsuspend call that is blocking SS->thread. */ - if (ss->suspended != MACH_PORT_NULL) - { - /* There is a sigsuspend waiting. Tell it to wake up. */ - error_t err; - mach_msg_header_t msg; - msg.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0); - msg.msgh_remote_port = ss->suspended; - msg.msgh_local_port = MACH_PORT_NULL; - /* These values do not matter. */ - msg.msgh_id = 8675309; /* Jenny, Jenny. */ - ss->suspended = MACH_PORT_NULL; - err = __mach_msg (&msg, MACH_SEND_MSG, sizeof msg, 0, - MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - assert_perror (err); - } - __spin_unlock (&ss->lock); - } - } /* The signal was neither fatal nor traced. We still hold SS->lock. */ if (signo != 0 && ss->thread != MACH_PORT_NULL) diff --git a/sysdeps/mach/hurd/f_setlk.h b/sysdeps/mach/hurd/f_setlk.h new file mode 100644 index 0000000000..16c7a8ca8d --- /dev/null +++ b/sysdeps/mach/hurd/f_setlk.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2014-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 + 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/>. */ + +#ifndef _F_SETLK_H +#define _F_SETLK_H 1 + +extern int __f_setlk (int fd, int type, int whence, __off64_t start, __off64_t len, int wait); + +#endif /* f_setlk.h */ diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile index 1a53065ae7..bebadd087a 100644 --- a/sysdeps/mach/hurd/i386/Makefile +++ b/sysdeps/mach/hurd/i386/Makefile @@ -9,7 +9,6 @@ endif ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym -sysdep_routines += makecontext-helper endif ifeq ($(subdir),csu) diff --git a/sysdeps/mach/hurd/i386/makecontext-helper.c b/sysdeps/mach/hurd/i386/makecontext-helper.c deleted file mode 100644 index 6db3b7e018..0000000000 --- a/sysdeps/mach/hurd/i386/makecontext-helper.c +++ /dev/null @@ -1,69 +0,0 @@ -/* 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> - - -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; - } -} |