summaryrefslogtreecommitdiff
path: root/libthreads
diff options
context:
space:
mode:
Diffstat (limited to 'libthreads')
-rw-r--r--libthreads/ChangeLog501
-rw-r--r--libthreads/Makefile7
-rw-r--r--libthreads/cthread_internals.h18
-rw-r--r--libthreads/cthreads.h46
-rw-r--r--libthreads/i386/cthreads.h11
-rw-r--r--libthreads/mig_support.c2
6 files changed, 59 insertions, 526 deletions
diff --git a/libthreads/ChangeLog b/libthreads/ChangeLog
deleted file mode 100644
index 0155c06e..00000000
--- a/libthreads/ChangeLog
+++ /dev/null
@@ -1,501 +0,0 @@
-2007-06-13 Samuel Thibault <samuel.thibault@ens-lyon.org>
-
- TLS support for libthreads.
-
- * libthreads/cprocs.c (cproc_create): Call into glibc to allocate
- static TLS block.
- * libthreads/cthread_internals.h (tcbhead_t): New structure; as in
- glibc.
- (cproc_setup): Take TCB parameter.
- (_dl_allocate_tls): Declare; from glibc.
- * libthreads/alpha/thread.c (cproc_setup): Compile-time warning for
- missing TLS support.
- * libthreads/i386/thread.c (cproc_setup): Imlement TLS support.
-
-2002-08-26 Roland McGrath <roland@frob.com>
-
- * cthreads.c (cthread_body) [HAVE_USELOCALE]: Call uselocale to
- initialize the thread to the global locale.
-
-2002-07-29 Marcus Brinkmann <marcus@gnu.org>
-
- * stack.c (stack_init): Put back in setting of the
- __hurd_threadvar_stack_mask and __hurd_threadvar_stack_offset
- variables (which got lost in the merge).
-
- * cthreads.c (cthread_init): Move cthread_alloc call before
- cproc_init call (lost in merge).
-
-2002-05-28 Roland McGrath <roland@frob.com>
-
- * cthreads.h: Do not define WAIT_DEBUG to affect inlines.
- * options.h: Not here either.
-
- * cprocs.c (cproc_block): Can't be static, called from cancel-cond.c.
-
- * cthreads.h (hurd_condition_wait, condition_implies,
- condition_unimplies): Restore decls lost in merge.
- (mutex_clear): Define as mutex_init instead of bogon (lost in merge).
-
- * cthreads.c (cthread_fork_prepare, cthread_fork_parent,
- cthread_fork_child): Don't call malloc_fork_* (lost in merge).
-
- * lockfile.c: Use __attribute__ magic instead of #pragma magic
- for alias definitions. Don't bother to make them weak.
-
-2002-05-26 Roland McGrath <roland@frob.com>
-
- Changes merged from CMU MK83a version:
- * cthreads.h, options.h: Various cleanups.
- * call.c, cthread_data.c, sync.c, mig_support.c, stack.c: Likewise.
- * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise.
- * cthread_internals.h: Add decls for internal functions.
- (struct cproc): Use vm_offset_t for stack_base and stack_size members.
- Use natural_t for context member.
- * cprocs.c: Use prototypes for all defns.
- * cthreads.c: Likewise.
- (cthread_exit): Cast any_t to integer_t before int.
-
- * alpha/thread.c: #if 0 out the silly bzero decl.
-
- * alpha/cthreads.h, alpha/thread.c, alpha/csw.S, alpha/lock.S:
- New files, verbatim from CMU release MK83a user/threads/alpha.
-
-2002-05-08 Roland McGrath <roland@frob.com>
-
- * cthreads.c (cthread_exit): Cast any_t to long before int.
-
- * cthread_internals.h: int -> void * for `busy' member.
- * cprocs.c (cthread_mach_msg): Don't cast to int when setting it.
- * cprocs.c (cthread_mag_active): Likewise.
-
-2002-05-07 Roland McGrath <roland@frob.com>
-
- * cprocs.c (cproc_list_lock): Declare type as spin_lock_t.
-
- * cthreads.h (cthread_sp): Cast to vm_address_t instead of int.
- (mutex_unlock): Cast to void * instead of int.
-
-2002-03-24 Roland McGrath <roland@frob.com>
-
- * libthreads.map: Use GLIBC_2.2.6 set instead of GLIBC_2.2.
-
-2001-12-22 Roland McGrath <roland@frob.com>
-
- * i386/thread.c (cthread_sp): Use __thread_stack_pointer.
-
-2001-08-23 Roland McGrath <roland@frob.com>
-
- * lockfile.c: Rewritten to use macros now defined by libc.
-
-2001-03-31 Roland McGrath <roland@frob.com>
-
- * cthreads.h: Fix obsolescent #endif syntax.
- * cthread_internals.h: Likewise.
- * cancel-cond.c: Likewise.
- * stack.c: Likewise.
- * cthreads.c: Likewise.
- * cprocs.c: Likewise.
- * call.c: Likewise.
- * i386/thread.c: Likewise.
- * cthread_data.c: Likewise.
-
-2001-02-25 Roland McGrath <roland@frob.com>
-
- * i386/thread.c: Remove superfluous bzero decl,
- just include <strings.h> instead.
-
-2000-05-25 Mark Kettenis <kettenis@gnu.org>
-
- * libthreads.map: Update comment to reflect Roland's 2000-03-30
- change, and my change to the toplevel configure.in that disables
- versioning for the old stdio-using libc.
-
-2000-03-30 Roland McGrath <roland@baalperazim.frob.com>
-
- * libthreads.map: Define HURD_CTHREADS_0.3 version set,
- putting all symbols there except the lockfile symbols.
- * lockfile.c: Nit fixes.
-
-2000-03-27 Roland McGrath <roland@baalperazim.frob.com>
-
- Locking support for stdio streams with glibc-2.2 libio. EXPERIMENTAL!
- * lockfile.c: New file.
- * libthreads.map: New file.
- * Makefile (SRCS): Add lockfile.c.
- [$(VERSIONING) = yes] ($(libname).so.$(hurd-version)): Depend
- on $(srcdir)/$(libname).map to get version script into the link.
-
-2000-02-28 Roland McGrath <roland@baalperazim.frob.com>
-
- * i386/csw.S: #undef __ELF__ before defining it, since
- it is usually predefined.
-
-2000-01-10 Mark Kettenis <kettenis@gnu.org>
-
- * cprocs.c: Include <assert.h>
-
-2000-01-09 Roland McGrath <roland@baalperazim.frob.com>
-
- * cprocs.c (cproc_alloc): Initialize P->wired and P->msg here (code
- from cthread_wire).
- (cthread_wire): Reduce to just an assert, cthreads always wired.
- (chtread_unwire): Abort if called.
-
-1999-06-13 Roland McGrath <roland@baalperazim.frob.com>
-
- * cthreads.h (MACRO_BEGIN, MACRO_END): #undef before unconditionally
- redefining. Use GCC extension for statement expression with value 0.
-
-1999-05-29 Roland McGrath <roland@baalperazim.frob.com>
-
- * cthreads.h (mutex_clear): Change again, to call mutex_init.
-
- * cthreads.h (mutex_clear): Change from syntax error to no-op (with
- warning avoidance).
-
-1998-11-12 Mark Kettenis <kettenis@phys.uva.nl>
-
- * cthreads.c (cthread_init): Move cthread_alloc call before
- cproc_init call, since cthread_alloc uses malloc, and malloc won't
- work between initializing the new stack and switching over to it.
-
-1998-07-20 Roland McGrath <roland@baalperazim.frob.com>
-
- * i386/csw.S (cproc_prepare): Take address of cthread_body as third
- arg, so we don't have to deal with PIC magic to find its address
- without producing a text reloc.
- * cprocs.c (cproc_create): Pass &cthread_body to cproc_prepare.
-
-Tue Jun 9 13:50:09 1998 Thomas Bushnell, n/BSG <tb@mit.edu>
-
- * cthreads.c (cthread_fork_prepare): Don't call
- malloc_fork_prepare since we are no longer providing our own
- malloc in this library.
- (cthread_fork_parent): Likewise, for malloc_fork_parent.
- (cthread_fork_child): Likewise, for malloc_fork_child.
-
-Wed Aug 20 15:39:44 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * cthreads.c (cthread_body): Wire self before calling user work
- function. This way all cthreads will be wired, which the ports
- library (and hurd_thread_cancel, etc.) depend on.
-
-Fri Aug 8 13:21:17 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * Makefile (SRCS): Delete malloc.c; libc now has a thread safe
- malloc.
- (malloc.c): Delete file.
-
-Mon Jun 9 21:18:46 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * cthreads.c (cthread_fork): Delete debugging oddity that crept
- into source.
-
-Thu Apr 3 20:29:27 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * i386/csw.S: Define __ELF__ too.
-
-Wed Feb 19 23:29:55 1997 Miles Bader <miles@gnu.ai.mit.edu>
-
- * stack.c (__hurd_threadvar_stack_mask,
- __hurd_threadvar_stack_offset, __hurd_threadvar_max): Make extern.
-
-Tue Feb 18 16:28:36 1997 Miles Bader <miles@gnu.ai.mit.edu>
-
- * i386/thread.c (cproc_setup): Correctly leave space at top of
- stack for GNU per-thread variables.
-
-Mon Nov 18 16:36:56 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * cprocs.c (cproc_create): Cast CHILD in assignment.
-
-Mon Oct 21 22:05:48 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * i386/csw.S (CALL_MCOUNT): New macro.
- (cproc_swtich, cproc_start_wait, cproc_prepare): Use CALL_MCOUNT.
-
- * rwlock.h: Change extern inline protection to use new canonical
- method.
- * rwlock.c: Rewritten.
-
-Wed Sep 4 09:06:09 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * Makefile (VPATH): Look in $(asm_syntax) instead of old
- $(machine); Hurd configure now folds equivalent CPU types into
- asm_syntax.
-
-Thu Aug 29 12:50:37 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
-
- * i386/csw.S: Include <mach/i386/asm.h> instead of <i386/asm.h>.
- Define ELF before inclusion.
-
-Sat Jul 20 15:47:24 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * Makefile (lndist-i386-files): Look for I386SRCS and I386HDRS in
- $(srcdir).
-
-Thu Jun 6 07:29:31 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * malloc.c (more_memory): Use assert_perror instead of MACH_CALL.
- "cthread_internals.h": Include removed.
-
-Thu May 9 11:13:42 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * Makefile (installhdrs, installhdrsubdir): Install headers using
- the generic technique, now that installhdrsubdir is available.
-
- * rwlock.h: If _RWLOCK_DEFINE_FUNCTIONS is defined, then clear
- _EXTERN_INLINE, but *after* header files have been included.
- * rwlock.c (_RWLOCK_DEFINE_FUNCTIONS): New macro; use in place of
- clearing _EXTERN_INLINE, which conflicts with machine-sp.h.
-
-Sat May 4 05:33:57 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- * cthreads.h [lint] (NEVER): Spurious global variable removed.
- [!lint] (NEVER): Useless macro removed.
-
- * Makefile (SRCS): Add rwlock.c.
- (LCLHDRS): Add rwlock.h.
- (install): Depend on $(includedir)/rwlock.h.
- ($(includedir)/%.h: %.h): New rule.
- ($(includedir)/cthreads.h): Target removed, obviated by that rule.
- * rwlock.h: Moved to libthreads from libshouldbeinlibc.
- (_EXTERN_INLINE): New macro.
- Use it for all the inline defns.
- * rwlock.c: New file.
-
-Thu Apr 11 17:55:24 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * Makefile (CFLAGS): Turn off -Wall.
-
- * Makefile (VPATH): Fix up for new configure reality.
-
-Thu Mar 7 15:52:38 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * malloc.c (realloc): Use LOG2_MIN_SIZE.
- (LOG2_MIN_SIZE): New macro.
-
- * malloc.c (realloc): Don't bother allocating a new block if the
- new size request fits in the old one and doesn't waste any space.
- Only free the old block if we successfully got a new one.
-
-Wed Mar 6 18:05:57 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * malloc.c [MCHECK] (struct header): New type.
- (union header): Only define if !MCHECK.
- (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
- [MCHECK] (MIN_SIZE): Add correct definition for this case.
- (more_memory, malloc, free, realloc): Use above macros, and add
- appropiate checks & frobs in MCHECK case.
-
-Wed Jan 31 20:05:57 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * cancel-cond.c: Add assert to check for signal bug.
-
-Wed Jan 24 13:38:11 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * cthreads.h: Use prototypes for functions of zero args.
-
-Sun Dec 10 08:41:36 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * stack.c (addr_range_check, probe_stack): Functions #if 0'd out.
- (stack_init): Don't call probe_stack or frob old stack at all.
- Default cthread_stack_size to 16 pages if it is zero.
-
-Wed Dec 6 14:48:37 1995 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * cprocs.c (condition_unimplies): Take address of (*impp)->next in
- assignment to IMPP on loop step instruction.
-
-Wed Oct 4 16:22:27 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * i386/csw.S (JUMPTARGET): New macro, versions for [PIC] and not.
- Use it in place of EXT.
- * Makefile (csw_pic.o): Bogus braindead target from hell removed.
- Bushnell will be shot.
-
-Fri Sep 22 13:51:22 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * cprocs.c: Include hurd/threadvar.h.
-
-Sat Sep 16 13:42:02 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * Makefile (CPPFLAGS): Variable removed.
- (lndist-i386-files): Use $(top_srcdir) in place of $(srcdir).
-
-Wed Sep 13 15:49:17 1995 Michael I. Bushnell, p/BSG <mib@duality.gnu.ai.mit.edu>
-
- * cthreads.h (CONDITION_INITIALIZER): Provide initial zero for
- IMPLICATIONS member.
- (condition_init): Bother initializing NAME and IMPLICATIONS members.
-
-Wed Aug 30 11:10:27 1995 Michael I. Bushnell, p/BSG <mib@duality.gnu.ai.mit.edu>
-
- * cthreads.h (condition_implies, condition_unimplies): New
- functions.
- (struct condition): New member `implications'.
- (cond_imp): New structure.
- (cond_signal): Return int now.
- (condition_broadcast): Always call cond_broadcast if this
- condition has implications.
- (condition_signal): Always call cond_signal if this condition has
- implications.
- * cprocs.c (cond_signal): If this condition has implications,
- see if one of them needs to be signalled when we have no waiters.
- (cond_broadcast): Signal the implications list too.
- (condition_implies, condition_unimplies): New functions.
-
- * cthreads.h (hurd_condition_wait): Provide declaration.
-
-Tue Aug 29 10:48:59 1995 Michael I. Bushnell, p/BSG <mib@duality.gnu.ai.mit.edu>
-
- * cthread_internals.h (cproc_block): Provide decl.
-
-Sat Aug 26 14:08:15 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * cancel-cond.c (hurd_condition_wait_cancel): Name changed to
- `hurd_condition_wait'.
-
-Tue Aug 22 19:26:38 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * Makefile (SRCS): Add a backslash.
-
-Mon Aug 21 12:52:38 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * Makefile (SRCS): Add cancel-cond.c.
- * cancel-cond.c: New file.
-
-Thu Jul 6 13:39:25 1995 Michael I Bushnell <mib@duality.gnu.ai.mit.edu>
-
- * Makefile (install): Don't *always* install cthreads.h; do it
- only if it's new.
-
- * Makefile: Removed dependencies that are now automatically
- generated.
-
- * Makefile (csw_pic.o): Provide slightly cheating rule.
-
-Fri May 12 14:25:35 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * i386/csw.S: Use EXT macro instead of explicit underscores.
- * i386/asm.h: File removed; it is installed by libc.
- * Makefile (I386HDRS): Variable removed.
- ($(OBJS)): Don't depend on i386/asm.h.
-
- * Makefile (CPPFLAGS): Use $(srcdir) instead of $(hurdsource).
-
-Wed Apr 12 14:33:06 1995 Michael I Bushnell <mib@duality.gnu.ai.mit.edu>
-
- * Makefile (lndist, lndist-i386-files): Change $(hurdsource) to
- $(srcdir).
- ($(hurdsource)/hurd-snap/$(dir)/i386): Likewise.
-
-Tue Apr 4 17:04:45 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * Makefile (CPPFLAGS): Define.
- ($(OBJS) rule): Fix typo in target.
- (install-cthreads.h): Use $(INSTALL_DATA).
-
- * cthreads.h (mutex_lock, mutex_unlock): Use __ names for *_solid.
- * cprocs.c (mutex_lock_solid, mutex_unlock_solid): Renamed to __*.
- (_cthread_mutex_lock_routine, _cthread_mutex_unlock_routine): Variables
- removed.
-
-Fri Jul 22 10:47:51 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * Makefile: Rewritten in accord with new scheme.
-
-Tue Jul 19 12:22:01 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * Makefile (generic-sources): Restored malloc.c.
- (malloc-sources, malloc-objects): Deleted variables.
- (DIST_FILES): Deleted $(malloc-sources)
- (all): Deleted libmalloc.a.
- (libmalloc.a): Delted target.
- ($(hurdinst)/lib/libmalloc.a): Deleted target.
- (install): Deleted $(hurdinst)/lib/libmalloc.a.
- (clean): Deleted libmalloc.a.
-
-Tue Jul 5 14:17:28 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * Makefile (SRCS, TAGSHDRS): New variables.
- (TAGS): Deleted local definition; now it's in Makeconf.
-
-Thu May 19 00:54:54 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * cprocs.c (_cthread_mutex_lock_routine,
- _cthread_mutex_unlock_routine): New variables.
-
-Thu May 5 19:33:49 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu)
-
- * Makefile: (generic-sources): Removed malloc.c.
- (malloc-sources, malloc-objects): new variables.
- (DIST_FILES): added $(malloc-sources).
- (libmalloc.a, $(hurdinst)/lib/libmalloc.a): New targets.
- ($(hurdinst)/lib/malloc.o): Deleted target.
- (all): added libmalloc.a.
- (install): Changed $(hurdinst)/lib/malloc.o to
- $(hurdinst)/lib/libmalloc.a
- (clean): Added libmaloc.a.
-
-Thu May 5 04:30:34 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * cthreads.c (cthread_init): Pass STACK instead of P to mig_init.
-
- * cprocs.c (cproc_create): Pass normal offset value to
- cproc_stack_base. Explicitly store CHILD ptr at base of its stack.
-
- * stack.c (stack_init): Set __hurd_threadvar_stack_mask to find
- the lowest address of the stack segment.
- [STACK_GROWTH_UP]: Set __hurd_threadvar_stack_offset to
- sizeof(ur_cthread_t*).
- [! STACK_GROWTH_UP]: Set __hurd_threadvar_stack_offset to the size
- of the stack minus space for the cproc_self ptr and thread variables.
-
- * malloc.c (malloc, free, realloc): Change declarations to
- standard types, so as not to conflict with the declarations in
- <stdlib.h>.
-
- * cthread_internals.h: #if 0 out declaration of malloc.
- (struct cproc): #if 0 out `reply_port' member; libc implements that.
- * cprocs.c (cproc_alloc): #if 0 out initialization of P->reply_port.
-
- * Makefile (generic-sources): Omit sync.c. libc implements that.
-
- * cprocs.c (cproc_block): Add __hurd_threadvar_max * sizeof (long
- int) to 2nd arg to cproc_stack_base.
-
- * stack.c: Include <hurd/threadvar.h>.
- (__hurd_threadvar_stack_mask, __hurd_threadvar_stack_offset,
- __hurd_threadvar_max): Define variables (uninitialized).
- (stack_init): Set __hurd_threadvar_stack_mask to cthread_stack_mask.
- Set __hurd_threadvar_stack_offset to point past the cproc_self ptr.
- Add __hurd_threadvar_max * sizeof (long int) to 2nd arg to
- cproc_stack_base.
-
- * cthreads.h: #if 0 include of <machine/cthreads.h>.
- Instead, include <machine-sp.h>.
- (cthread_sp): Define using __thread_stack_pointer.
- #if 0 out spin_lock definitions. Just include <spin-lock.h> instead.
- (struct mutex): Move `held' member to be first in the structure.
-
-Wed May 4 14:55:15 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * i386/thread.c: Changed inclusions because we aren't using
- -I flags the way CMU's makefiles do.
-
- * i386/csw.S: Convert comment character to /* */ pairs.
-
- * Renamed csw.s to csw.S so that GCC knows to run cpp on it.
- * Makefile (machine-sources): Change csw.s to csw.S.
-
-Wed May 4 07:11:46 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * Makefile (GEN_SRCS): Renamed generic-sources.
- (I386_SRCS): Replaced with machine-sources, omitting directory.
- (SRCS): Renamed sources. Include $(machine-sources) and prepend
- $(machine)/ directory name.
- (headers): Define variable.
- (OBJS): Renamed objects.
- (VPATH): Define to $(machine).
diff --git a/libthreads/Makefile b/libthreads/Makefile
index ee862366..e9fa571b 100644
--- a/libthreads/Makefile
+++ b/libthreads/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 1994,95,96,97,2000 Free Software Foundation, Inc.
+# Copyright (C) 1994,95,96,97,2000,2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -57,4 +57,9 @@ ifeq ($(VERSIONING),yes)
# where ld will read it as a linker script.
$(libname).so.$(hurd-version): $(srcdir)/$(libname).map
+lndist: lndist-map-file
+
+lndist-map-file: $(top_srcdir)/hurd-snap/$(dir)
+ ln $(addprefix $(srcdir)/,$(libname).map) $<
+
endif
diff --git a/libthreads/cthread_internals.h b/libthreads/cthread_internals.h
index 84264004..81e3b91c 100644
--- a/libthreads/cthread_internals.h
+++ b/libthreads/cthread_internals.h
@@ -28,7 +28,21 @@
* 26-Oct-94 Johannes Helander (jvh) Helsinki University of Technology
* Defined WAIT_DEBUG and initialized wait_enum
*
- * $Log: cthread_internals.h,v $
+ * $Log: cthread_internals.h,v $
+ * Revision 1.6 2002/05/27 02:50:10 roland
+ * 2002-05-26 Roland McGrath <roland@frob.com>
+ *
+ * Changes merged from CMU MK83a version:
+ * * cthreads.h, options.h: Various cleanups.
+ * * call.c, cthread_data.c, sync.c, mig_support.c: Likewise.
+ * * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise.
+ * * cthread_internals.h: Add decls for internal functions.
+ * (struct cproc): Use vm_offset_t for stack_base and stack_size members.
+ * Use natural_t for context member.
+ * * cprocs.c: Use prototypes for all defns.
+ * * cthreads.c: Likewise.
+ * (cthread_exit): Cast any_t to integer_t before int.
+ *
* Revision 2.17 93/05/10 21:33:36 rvb
* Context is a natural_t. Assumming, that is, that on
* some future architecture one word might be enough.
@@ -268,6 +282,8 @@ extern vm_offset_t cproc_init(void);
extern void cproc_waiting(cproc_t _waiter);
+extern void cproc_block(void);
+
extern cproc_t cproc_create(void);
extern void cproc_fork_prepare(void);
diff --git a/libthreads/cthreads.h b/libthreads/cthreads.h
index d3b6c290..d937dcca 100644
--- a/libthreads/cthreads.h
+++ b/libthreads/cthreads.h
@@ -269,6 +269,11 @@ typedef void *any_t; /* XXX - obsolete, should be deleted. */
#define FALSE 0
#endif
+/* Enable mutex holder debugging */
+/* #define WAIT_DEBUG */
+/* Record function name instead of thread pointer */
+/* #define WAIT_FUNC_DEBUG */
+
/*
* C Threads package initialization.
*/
@@ -377,9 +382,26 @@ typedef struct mutex {
const char *name;
struct cthread_queue queue;
/* holder is for WAIT_DEBUG. Not ifdeffed to keep size constant. */
+#ifdef WAIT_FUNC_DEBUG
+ const char *fname;
+#else /* WAIT_FUNC_DEBUG */
struct cthread *holder;
+#endif /* WAIT_FUNC_DEBUG */
} *mutex_t;
+#ifdef WAIT_DEBUG
+#ifdef WAIT_FUNC_DEBUG
+#define WAIT_CLEAR_DEBUG(m) (m)->fname = 0
+#define WAIT_SET_DEBUG(m) (m)->fname = __FUNCTION__
+#else /* WAIT_FUNC_DEBUG */
+#define WAIT_CLEAR_DEBUG(m) (m)->holder = 0
+#define WAIT_SET_DEBUG(m) (m)->holder = cthread_self()
+#endif /* WAIT_FUNC_DEBUG */
+#else /* WAIT_DEBUG */
+#define WAIT_CLEAR_DEBUG(m) (void) 0
+#define WAIT_SET_DEBUG(m) (void) 0
+#endif /* WAIT_DEBUG */
+
/* Rearranged accordingly for GNU: */
#define MUTEX_INITIALIZER { SPIN_LOCK_INITIALIZER, SPIN_LOCK_INITIALIZER, 0, QUEUE_INITIALIZER, }
#define MUTEX_NAMED_INITIALIZER(Name) { SPIN_LOCK_INITIALIZER, SPIN_LOCK_INITIALIZER, Name, QUEUE_INITIALIZER, }
@@ -390,36 +412,20 @@ typedef struct mutex {
spin_lock_init(&(m)->lock); \
cthread_queue_init(&(m)->queue); \
spin_lock_init(&(m)->held); \
- (m)->holder = 0; \
+ WAIT_CLEAR_DEBUG(m); \
MACRO_END
#define mutex_set_name(m, x) ((m)->name = (x))
#define mutex_name(m) ((m)->name != 0 ? (m)->name : "?")
#define mutex_clear(m) mutex_init(m)
#define mutex_free(m) free((m))
-#define mutex_try_lock(m) spin_try_lock(&(m)->held)
-#if defined(WAIT_DEBUG)
-#define mutex_lock(m) \
- MACRO_BEGIN \
- if (!spin_try_lock(&(m)->held)) { \
- __mutex_lock_solid(m); \
- } \
- (m)->holder = cthread_self(); \
- MACRO_END
-#define mutex_unlock(m) \
- MACRO_BEGIN \
- if (spin_unlock(&(m)->held), \
- cthread_queue_head(&(m)->queue, vm_offset_t) != 0) { \
- __mutex_unlock_solid(m); \
- } \
- (m)->holder = 0; \
- MACRO_END
-#else /* defined(WAIT_DEBUG */
+#define mutex_try_lock(m) (spin_try_lock(&(m)->held) ? WAIT_SET_DEBUG(m), 1 : 0)
#define mutex_lock(m) \
MACRO_BEGIN \
if (!spin_try_lock(&(m)->held)) { \
__mutex_lock_solid(m); \
} \
+ WAIT_SET_DEBUG(m); \
MACRO_END
#define mutex_unlock(m) \
MACRO_BEGIN \
@@ -427,8 +433,8 @@ typedef struct mutex {
cthread_queue_head(&(m)->queue, vm_offset_t) != 0) { \
__mutex_unlock_solid(m); \
} \
+ WAIT_CLEAR_DEBUG(m); \
MACRO_END
-#endif /* defined(WAIT_DEBUG) */
/*
* Condition variables.
*/
diff --git a/libthreads/i386/cthreads.h b/libthreads/i386/cthreads.h
index d7202df6..694387b6 100644
--- a/libthreads/i386/cthreads.h
+++ b/libthreads/i386/cthreads.h
@@ -26,6 +26,13 @@
/*
* HISTORY
* $Log: cthreads.h,v $
+ * Revision 1.3 2007/03/03 23:57:37 sthibaul
+ * 2006-03-04 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ *
+ * * libpthread/sysdeps/i386/machine-sp.h (thread_stack_pointer):
+ * Optimize esp read.
+ * * libpthread/i386/cthreads.h (cthread_sp): Likewise.
+ *
* Revision 1.2 2002/05/27 02:50:10 roland
* 2002-05-26 Roland McGrath <roland@frob.com>
*
@@ -91,14 +98,14 @@ typedef volatile int spin_lock_t;
({ register int _u__ ; \
__asm__ volatile("xorl %0, %0; \n\
xchgl %0, %1" \
- : "=&r" (_u__), "=m" (*(p)) ); \
+ : "=&r" (_u__), "=m" (*(p)) :: "memory" ); \
0; })
#define spin_try_lock(p)\
(!({ boolean_t _r__; \
__asm__ volatile("movl $1, %0; \n\
xchgl %0, %1" \
- : "=&r" (_r__), "=m" (*(p)) ); \
+ : "=&r" (_r__), "=m" (*(p)) :: "memory" ); \
_r__; }))
#define cthread_sp() \
diff --git a/libthreads/mig_support.c b/libthreads/mig_support.c
index 01e5deb0..cd0d4124 100644
--- a/libthreads/mig_support.c
+++ b/libthreads/mig_support.c
@@ -53,7 +53,7 @@
* Revision 2.3 90/08/07 14:27:48 rpd
* When we recycle the global reply port by giving it to the first
* cthread, clear the global reply port. This will take care of
- * someone accidently calling this twice.
+ * someone accidentally calling this twice.
* [90/08/07 rwd]
*
* Revision 2.2 90/06/02 15:14:04 rpd