summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorneal <neal>2008-08-16 13:40:45 +0000
committerneal <neal>2008-08-16 13:40:45 +0000
commit3806effa5d0eddb1262bb6eb7ab6d381570948dd (patch)
tree2b9bfc5317e91047e392cca8b999e1c589da08b3 /libpthread
parentd98fd43d82e69ca8d2b28c1e597ade33a555207e (diff)
2008-08-16 Neal H. Walfield <neal@gnu.org>
* sysdeps/l4/pt-block.c: Remove file. * sysdeps/l4/pt-docancel.c: Likewise. * sysdeps/l4/pt-pool-np.c: Likewise. * sysdeps/l4/pt-thread-alloc.c: Likewise. * sysdeps/l4/pt-thread-dealloc.c: Likewise. * sysdeps/l4/pt-thread-halt.c: Likewise. * sysdeps/l4/pt-thread-start.c: Likewise. * sysdeps/l4/pt-wakeup.c: Likewise. * sysdeps/l4/bits/pthread-np.h: Likewise.
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/ChangeLog12
-rw-r--r--libpthread/sysdeps/l4/bits/pthread-np.h35
-rw-r--r--libpthread/sysdeps/l4/pt-block.c47
-rw-r--r--libpthread/sysdeps/l4/pt-docancel.c42
-rw-r--r--libpthread/sysdeps/l4/pt-pool-np.c54
-rw-r--r--libpthread/sysdeps/l4/pt-thread-alloc.c43
-rw-r--r--libpthread/sysdeps/l4/pt-thread-dealloc.c32
-rw-r--r--libpthread/sysdeps/l4/pt-thread-halt.c45
-rw-r--r--libpthread/sysdeps/l4/pt-thread-start.c40
-rw-r--r--libpthread/sysdeps/l4/pt-wakeup.c54
10 files changed, 12 insertions, 392 deletions
diff --git a/libpthread/ChangeLog b/libpthread/ChangeLog
index fdd7b4b..e167d28 100644
--- a/libpthread/ChangeLog
+++ b/libpthread/ChangeLog
@@ -1,5 +1,17 @@
2008-08-16 Neal H. Walfield <neal@gnu.org>
+ * sysdeps/l4/pt-block.c: Remove file.
+ * sysdeps/l4/pt-docancel.c: Likewise.
+ * sysdeps/l4/pt-pool-np.c: Likewise.
+ * sysdeps/l4/pt-thread-alloc.c: Likewise.
+ * sysdeps/l4/pt-thread-dealloc.c: Likewise.
+ * sysdeps/l4/pt-thread-halt.c: Likewise.
+ * sysdeps/l4/pt-thread-start.c: Likewise.
+ * sysdeps/l4/pt-wakeup.c: Likewise.
+ * sysdeps/l4/bits/pthread-np.h: Likewise.
+
+2008-08-16 Neal H. Walfield <neal@gnu.org>
+
* sysdeps/l4/hurd/pt-docancel.c: New file.
2008-08-16 Neal H. Walfield <neal@gnu.org>
diff --git a/libpthread/sysdeps/l4/bits/pthread-np.h b/libpthread/sysdeps/l4/bits/pthread-np.h
deleted file mode 100644
index 6a02bdc..0000000
--- a/libpthread/sysdeps/l4/bits/pthread-np.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Non-portable functions. L4 version.
- Copyright (C) 2003, 2007 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/*
- * Never include this file directly; use <pthread.h> or <cthreads.h> instead.
- */
-
-#ifndef _BITS_PTHREAD_NP_H
-#define _BITS_PTHREAD_NP_H 1
-
-#include <l4.h>
-
-/* Add the thread TID to the internal kernel thread pool. */
-extern int pthread_pool_add_np (l4_thread_id_t tid);
-
-/* Get the first thread from the pool. */
-extern l4_thread_id_t pthread_pool_get_np (void);
-
-#endif /* bits/pthread-np.h */
diff --git a/libpthread/sysdeps/l4/pt-block.c b/libpthread/sysdeps/l4/pt-block.c
deleted file mode 100644
index 69e1d35..0000000
--- a/libpthread/sysdeps/l4/pt-block.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Block a thread. L4 version.
- Copyright (C) 2002 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <l4.h>
-
-#include <pt-internal.h>
-
-#include <hurd/stddef.h>
-
-/* Block THREAD. */
-void
-__pthread_block (struct __pthread *thread)
-{
- debug (5, "%x.%x/%x blocking",
- l4_thread_no (thread->threadid), l4_version (thread->threadid),
- thread->threadid);
-
- l4_accept (L4_UNTYPED_WORDS_ACCEPTOR);
- l4_msg_tag_t tag = l4_receive (l4_anythread);
- if (l4_ipc_failed (tag))
- {
- debug (1, "%x.%x failed to block: %d, offset: %x",
- l4_thread_no (l4_myself ()), l4_version (l4_myself ()),
- (l4_error_code () >> 1) & 0x7,
- l4_error_code () >> 4);
- assert (! l4_ipc_failed (tag));
- }
- else
- debug (5, "%x.%x unblocked",
- l4_thread_no (thread->threadid), l4_version (thread->threadid));
-}
diff --git a/libpthread/sysdeps/l4/pt-docancel.c b/libpthread/sysdeps/l4/pt-docancel.c
deleted file mode 100644
index a3965d0..0000000
--- a/libpthread/sysdeps/l4/pt-docancel.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Cancel a thread.
- Copyright (C) 2002, 2007 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <pthread.h>
-
-#include <pt-internal.h>
-
-static void
-call_exit (void)
-{
- pthread_exit (0);
-}
-
-int
-__pthread_do_cancel (struct __pthread *p)
-{
- assert (p->cancel_pending == 1);
- assert (p->cancel_state == PTHREAD_CANCEL_ENABLE);
-
- if (l4_is_thread_equal (l4_myself (), p->threadid))
- call_exit ();
- else
- l4_start_sp_ip (p->threadid, (l4_word_t) p->mcontext.sp,
- (l4_word_t) call_exit);
- return 0;
-}
diff --git a/libpthread/sysdeps/l4/pt-pool-np.c b/libpthread/sysdeps/l4/pt-pool-np.c
deleted file mode 100644
index e83022b..0000000
--- a/libpthread/sysdeps/l4/pt-pool-np.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Thread pool for L4 threads.
- Copyright (C) 2004, 2007 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <pt-internal.h>
-#include <l4/thread.h>
-
-static pthread_mutex_t pool_lock = PTHREAD_MUTEX_INITIALIZER;
-
-_L4_thread_id_t pool_list = l4_nilthread;
-
-/* Add the thread TID to the pthread kernel thread pool. */
-int
-pthread_pool_add_np (l4_thread_id_t tid)
-{
- __pthread_mutex_lock (&pool_lock);
- /* FIXME: Do error checking. */
- l4_set_user_defined_handle_of (tid, pool_list);
- pool_list = tid;
- __pthread_mutex_unlock (&pool_lock);
-
- return 0;
-}
-
-
-/* Get the first thread from the pool. */
-l4_thread_id_t
-pthread_pool_get_np (void)
-{
- _L4_thread_id_t tid;
-
- __pthread_mutex_lock (&pool_lock);
- /* FIXME: Do error checking. */
- tid = pool_list;
- if (tid != l4_nilthread)
- pool_list = l4_user_defined_handle_of (tid);
- __pthread_mutex_unlock (&pool_lock);
- return tid;
-}
diff --git a/libpthread/sysdeps/l4/pt-thread-alloc.c b/libpthread/sysdeps/l4/pt-thread-alloc.c
deleted file mode 100644
index ec69afb..0000000
--- a/libpthread/sysdeps/l4/pt-thread-alloc.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Allocate kernel thread. L4 version.
- Copyright (C) 2003, 2005 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include <pt-internal.h>
-
-int
-__pthread_thread_alloc (struct __pthread *thread)
-{
- error_t err;
-
- /* The main thread is already running of course. */
- if (__pthread_num_threads == 1)
- thread->threadid = l4_myself ();
- else
- {
- thread->threadid = pthread_pool_get_np ();
- if (thread->threadid != l4_nilthread)
- return 0;
-
- return EAGAIN;
- }
- return 0;
-}
diff --git a/libpthread/sysdeps/l4/pt-thread-dealloc.c b/libpthread/sysdeps/l4/pt-thread-dealloc.c
deleted file mode 100644
index c09e486..0000000
--- a/libpthread/sysdeps/l4/pt-thread-dealloc.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Deallocate the kernel thread resources. L4 version.
- Copyright (C) 2005 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <l4.h>
-
-#include <pt-internal.h>
-
-/* Deallocate any kernel resources associated with THREAD except don't
- halt the thread itself. On return, the thread will be marked as
- dead and __pthread_halt will be called. */
-void
-__pthread_thread_dealloc (struct __pthread *thread)
-{
-}
diff --git a/libpthread/sysdeps/l4/pt-thread-halt.c b/libpthread/sysdeps/l4/pt-thread-halt.c
deleted file mode 100644
index aa2bf43..0000000
--- a/libpthread/sysdeps/l4/pt-thread-halt.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Deallocate the kernel thread resources. L4version.
- Copyright (C) 2000, 2002, 2004 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <assert.h>
-#include <errno.h>
-
-#include <pt-internal.h>
-
-/* Deallocate the kernel thread resources associated with THREAD. */
-void
-__pthread_thread_halt (struct __pthread *thread, int need_dealloc)
-{
- l4_thread_id_t tid = thread->threadid;
-
- if (need_dealloc)
- __pthread_dealloc (thread);
-
- /* There is potential race here: once if TID is the current thread,
- then once we add TID to the pool, someone can reallocate it
- before we call stop. However, to start the thread, the caller
- atomically starts and sets the sp and ip, thus, if the stop has
- not yet executed at that point, it won't. */
-
- if (tid != l4_myself ())
- l4_stop (tid);
- pthread_pool_add_np (tid);
- if (tid == l4_myself ())
- l4_stop (tid);
-}
diff --git a/libpthread/sysdeps/l4/pt-thread-start.c b/libpthread/sysdeps/l4/pt-thread-start.c
deleted file mode 100644
index 144c58b..0000000
--- a/libpthread/sysdeps/l4/pt-thread-start.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Start thread. L4 version.
- Copyright (C) 2003, 2004, 2007 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include <pt-internal.h>
-
-/* Start THREAD. Get the kernel thread scheduled and running. */
-int
-__pthread_thread_start (struct __pthread *thread)
-{
- if (__pthread_num_threads == 1)
- /* The main thread is already running of course. */
- {
- assert (__pthread_total == 1);
- assert (l4_is_thread_equal (l4_myself (), thread->threadid));
- }
- else
- l4_start_sp_ip (thread->threadid, (l4_word_t) thread->mcontext.sp,
- (l4_word_t) thread->mcontext.pc);
- return 0;
-}
diff --git a/libpthread/sysdeps/l4/pt-wakeup.c b/libpthread/sysdeps/l4/pt-wakeup.c
deleted file mode 100644
index de37846..0000000
--- a/libpthread/sysdeps/l4/pt-wakeup.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Wakeup a thread. L4 version.
- Copyright (C) 2002 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <l4.h>
-
-#include <pt-internal.h>
-
-#include <hurd/stddef.h>
-
-/* Wakeup THREAD. */
-void
-__pthread_wakeup (struct __pthread *thread)
-{
- debug (5, "%x.%x/%x waking %x.%x/%x",
- l4_thread_no (l4_myself ()), l4_version (l4_myself ()), l4_myself (),
- l4_thread_no (thread->threadid), l4_version (thread->threadid),
- thread->threadid);
-
- /* Signal the waiter. */
- l4_msg_t msg;
- l4_msg_clear (msg);
- l4_msg_set_untyped_words (msg, 0);
- l4_msg_load (msg);
-
- l4_msg_tag_t tag = l4_send (thread->threadid);
- if (l4_ipc_failed (tag))
- {
- int err = l4_error_code ();
- debug (1, "%x.%x failed to wake %x.%x: %s (%d)",
- l4_thread_no (l4_myself ()), l4_version (l4_myself ()),
- l4_thread_no (thread->threadid), l4_version (thread->threadid),
- l4_strerror (err), err);
- }
- else
- debug (5, "%x.%x woke %x.%x",
- l4_thread_no (l4_myself ()), l4_version (l4_myself ()),
- l4_thread_no (thread->threadid), l4_version (thread->threadid));
-}