aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/dtable.c2
-rw-r--r--hurd/hurd.h4
-rw-r--r--hurd/hurd/fd.h5
-rw-r--r--hurd/hurd/id.h2
-rw-r--r--hurd/hurd/signal.h5
-rw-r--r--hurd/hurdmalloc.c13
-rw-r--r--hurd/hurdpid.c2
-rw-r--r--hurd/hurdrlimit.c2
-rw-r--r--hurd/hurdsig.c52
-rw-r--r--hurd/hurdsock.c2
-rw-r--r--hurd/hurdstartup.c10
-rw-r--r--hurd/msgportdemux.c6
12 files changed, 44 insertions, 61 deletions
diff --git a/hurd/dtable.c b/hurd/dtable.c
index 9f6ae2f..80d0247 100644
--- a/hurd/dtable.c
+++ b/hurd/dtable.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <limits.h>
-#include <cthreads.h> /* For `struct mutex'. */
+#include <lock-intern.h> /* For `struct mutex'. */
#include "set-hooks.h"
#include "hurdmalloc.h" /* XXX */
diff --git a/hurd/hurd.h b/hurd/hurd.h
index 8f1fdf4..c6e88a6 100644
--- a/hurd/hurd.h
+++ b/hurd/hurd.h
@@ -103,7 +103,6 @@ extern error_t _hurd_ports_use (int which, error_t (*operate) (mach_port_t));
/* Base address and size of the initial stack set up by the exec server.
- If using cthreads, this stack is deallocated in startup.
Not locked. */
extern vm_address_t _hurd_stack_base;
@@ -123,9 +122,6 @@ extern int _hurd_orphaned;
/* This variable is incremented every time the process IDs change. */
extern unsigned int _hurd_pids_changed_stamp;
-
-/* This condition is broadcast every time the process IDs change. */
-extern struct condition _hurd_pids_changed_sync;
/* Unix `data break', for brk and sbrk.
If brk and sbrk are not used, this info will not be initialized or used. */
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index d27be21..273406f 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -21,8 +21,6 @@
#define _HURD_FD_H 1
#include <features.h>
-#include <cthreads.h>
-
#include <hurd/hurd_types.h>
#include <hurd/port.h>
#include <sys/socket.h>
@@ -47,9 +45,12 @@ struct hurd_fd
/* Current file descriptor table. */
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+#include <lock-intern.h>
extern int _hurd_dtablesize;
extern struct hurd_fd **_hurd_dtable;
extern struct mutex _hurd_dtable_lock; /* Locks those two variables. */
+#endif
#include <hurd/signal.h>
diff --git a/hurd/hurd/id.h b/hurd/hurd/id.h
index bb796e1..944df21 100644
--- a/hurd/hurd/id.h
+++ b/hurd/hurd/id.h
@@ -24,7 +24,7 @@
#include <errno.h>
#include <bits/types/error_t.h>
-#include <cthreads.h> /* For `struct mutex'. */
+#include <lock-intern.h> /* For `struct mutex'. */
/* Structure describing authorization data for the process. */
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index ef6a8e6..c11f841 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -37,7 +37,6 @@
#include <bits/sigaction.h>
#include <hurd/msg.h>
-#include <cthreads.h> /* For `struct mutex'. */
#include <setjmp.h> /* For `jmp_buf'. */
#include <spin-lock.h>
struct hurd_signal_preemptor; /* <hurd/sigpreempt.h> */
@@ -120,8 +119,6 @@ struct hurd_sigstate
extern struct hurd_sigstate *_hurd_sigstates;
-extern struct mutex _hurd_siglock; /* Locks _hurd_sigstates. */
-
/* Get the sigstate of a given thread, taking its lock. */
extern struct hurd_sigstate *_hurd_thread_sigstate (thread_t);
@@ -320,7 +317,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
/* Function run by the signal thread to receive from the signal port. */
-extern void _hurd_msgport_receive (void);
+extern void *_hurd_msgport_receive (void *arg);
/* Set up STATE with a thread state that, when resumed, is
like `longjmp (_hurd_sigthread_fault_env, 1)'. */
diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c
index 65fb959..7046bce 100644
--- a/hurd/hurdmalloc.c
+++ b/hurd/hurdmalloc.c
@@ -4,6 +4,7 @@
#include "hurdmalloc.h" /* XXX see that file */
#include <mach.h>
+#include <mach/spin-lock.h>
#define vm_allocate __vm_allocate
#define vm_page_size __vm_page_size
@@ -79,8 +80,6 @@
#include <assert.h>
-#include <cthreads.h>
-
#define MCHECK
/*
@@ -221,7 +220,7 @@ malloc (size_t size)
i += 1;
n <<= 1;
}
- ASSERT(i < NBUCKETS);
+ assert(i < NBUCKETS);
fl = &malloc_free_list[i];
spin_lock(&fl->lock);
h = fl->head;
@@ -291,11 +290,11 @@ free (void *base)
* Sanity checks.
*/
if (i < 0 || i >= NBUCKETS) {
- ASSERT(0 <= i && i < NBUCKETS);
+ assert(0 <= i && i < NBUCKETS);
return;
}
if (fl != &malloc_free_list[i]) {
- ASSERT(fl == &malloc_free_list[i]);
+ assert(fl == &malloc_free_list[i]);
return;
}
/*
@@ -340,11 +339,11 @@ realloc (void *old_base, size_t new_size)
* Sanity checks.
*/
if (i < 0 || i >= NBUCKETS) {
- ASSERT(0 <= i && i < NBUCKETS);
+ assert(0 <= i && i < NBUCKETS);
return 0;
}
if (fl != &malloc_free_list[i]) {
- ASSERT(fl == &malloc_free_list[i]);
+ assert(fl == &malloc_free_list[i]);
return 0;
}
/*
diff --git a/hurd/hurdpid.c b/hurd/hurdpid.c
index 196177c..dd8281c 100644
--- a/hurd/hurdpid.c
+++ b/hurd/hurdpid.c
@@ -37,13 +37,11 @@ text_set_element (_hurd_proc_subinit, init_pids);
#include <hurd/msg_server.h>
#include "set-hooks.h"
-#include <cthreads.h>
DEFINE_HOOK (_hurd_pgrp_changed_hook, (pid_t));
/* These let user threads synchronize with an operation which changes ids. */
unsigned int _hurd_pids_changed_stamp;
-struct condition _hurd_pids_changed_sync;
kern_return_t
_S_msg_proc_newids (mach_port_t me,
diff --git a/hurd/hurdrlimit.c b/hurd/hurdrlimit.c
index 4216390..94f62b0 100644
--- a/hurd/hurdrlimit.c
+++ b/hurd/hurdrlimit.c
@@ -17,7 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <hurd.h>
-#include <cthreads.h>
+#include <lock-intern.h>
#include <hurd/resource.h>
/* This must be given an initializer, or the a.out linking rules will
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 3150091..2b778d6 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -19,11 +19,12 @@
#include <stdlib.h>
#include <string.h>
-#include <cthreads.h> /* For `struct mutex'. */
+#include <lock-intern.h> /* For `struct mutex'. */
#include <pthreadP.h>
#include <mach.h>
#include <mach/thread_switch.h>
#include <mach/mig_support.h>
+#include <mach/vm_param.h>
#include <hurd.h>
#include <hurd/id.h>
@@ -1477,8 +1478,8 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
/* Start the signal thread listening on the message port. */
-#pragma weak __cthread_fork
- if (!__cthread_fork)
+#pragma weak __pthread_create
+ if (!__pthread_create)
{
err = __thread_create (__mach_task_self (), &_hurd_msgport_thread);
assert_perror (err);
@@ -1503,41 +1504,40 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
}
else
{
- /* When cthreads is being used, we need to make the signal thread a
- proper cthread. Otherwise it cannot use mutex_lock et al, which
- will be the cthreads versions. Various of the message port RPC
+ pthread_t thread;
+ pthread_attr_t attr;
+ void *addr;
+ size_t size;
+
+ /* When pthread is being used, we need to make the signal thread a
+ proper pthread. Otherwise it cannot use mutex_lock et al, which
+ will be the pthread versions. Various of the message port RPC
handlers need to take locks, so we need to be able to call into
- cthreads code and meet its assumptions about how our thread and
- its stack are arranged. Since cthreads puts it there anyway,
+ pthread code and meet its assumptions about how our thread and
+ its stack are arranged. Since pthread puts it there anyway,
we'll let the signal thread's per-thread variables be found as for
- any normal cthread, and just leave the magic __hurd_sigthread_*
+ any normal pthread, and just leave the magic __hurd_sigthread_*
values all zero so they'll be ignored. */
-#pragma weak __cthread_detach
+
+#pragma weak __pthread_detach
#pragma weak __pthread_getattr_np
#pragma weak __pthread_attr_getstack
- __cthread_t thread = __cthread_fork (
- (cthread_fn_t) &_hurd_msgport_receive, 0);
- __cthread_detach (thread);
+ __pthread_create(&thread, NULL, &_hurd_msgport_receive, NULL);
- if (__pthread_getattr_np)
- {
- /* Record signal thread stack layout for fork() */
- pthread_attr_t attr;
- void *addr;
- size_t size;
-
- __pthread_getattr_np ((pthread_t) thread, &attr);
- __pthread_attr_getstack (&attr, &addr, &size);
- __hurd_sigthread_stack_base = (uintptr_t) addr;
- __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + size;
- }
+ /* Record signal thread stack layout for fork() */
+ __pthread_getattr_np (thread, &attr);
+ __pthread_attr_getstack (&attr, &addr, &size);
+ __hurd_sigthread_stack_base = (uintptr_t) addr;
+ __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + size;
+
+ __pthread_detach(thread);
/* XXX We need the thread port for the signal thread further on
in this thread (see hurdfault.c:_hurdsigfault_init).
Therefore we block until _hurd_msgport_thread is initialized
by the newly created thread. This really shouldn't be
necessary; we should be able to fetch the thread port for a
- cthread from here. */
+ pthread from here. */
while (_hurd_msgport_thread == 0)
__swtch_pri (0);
}
diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c
index f77c83e..e7222a8 100644
--- a/hurd/hurdsock.c
+++ b/hurd/hurdsock.c
@@ -23,7 +23,7 @@
#include <hurd/paths.h>
#include <stdio.h>
#include <_itoa.h>
-#include <cthreads.h> /* For `struct mutex'. */
+#include <lock-intern.h> /* For `struct mutex'. */
#include "hurdmalloc.h" /* XXX */
static struct mutex lock;
diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c
index b67de45..abe0dde 100644
--- a/hurd/hurdstartup.c
+++ b/hurd/hurdstartup.c
@@ -41,15 +41,7 @@ extern void __mach_init (void);
initialization so mig-generated stubs work, and then do an exec_startup
RPC on our bootstrap port, to which the exec server responds with the
information passed in the exec call, as well as our original bootstrap
- port, and the base address and size of the preallocated stack.
-
- If using cthreads, we are given a new stack by cthreads initialization and
- deallocate the stack set up by the exec server. On the new stack we call
- `start1' (above) to do the rest of the startup work. Since the stack may
- disappear out from under us in a machine-dependent way, we use a pile of
- static variables to communicate the information from exec_startup to start1.
- This is unfortunate but preferable to machine-dependent frobnication to copy
- the state from the old stack to the new one. */
+ port, and the base address and size of the preallocated stack. */
void
diff --git a/hurd/msgportdemux.c b/hurd/msgportdemux.c
index 7d5f6a5a..6b35076 100644
--- a/hurd/msgportdemux.c
+++ b/hurd/msgportdemux.c
@@ -51,14 +51,14 @@ msgport_server (mach_msg_header_t *inp,
}
/* This is the code that the signal thread runs. */
-void
-_hurd_msgport_receive (void)
+void *
+_hurd_msgport_receive (void *arg)
{
/* Get our own sigstate cached so we never again have to take a lock to
fetch it. There is much code in hurdsig.c that operates with some
sigstate lock held, which will deadlock with _hurd_thread_sigstate.
- Furthermore, in the cthreads case this is the convenient spot
+ Furthermore, in the pthread case this is the convenient spot
to initialize _hurd_msgport_thread (see hurdsig.c:_hurdsig_init). */
_hurd_msgport_thread = _hurd_self_sigstate ()->thread;