bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libthread update


From: Marcus Brinkmann
Subject: libthread update
Date: Mon, 29 Jul 2002 20:39:50 +0200
User-agent: Mutt/1.4i

Hi Roland,

I think the libthread update messed up some things.  One bug I fixed
already, but I am afraid there are a couple more of them.  I might slowly
get to each of them, but maybe you spot some, too.

I am including a diff below that contains all the significant changes to
libthreads you did, I think (well, I started from a full diff and deleted
obvious formatting changes, simple casts, etc).  You might want to do your
own diff, though.

Some things like the introduction of a cthread_wire, or removing a define
which is marked with MIB XXX are at least suspicious.

One thing I noticed when proof reading is that private_data doesn't seem to
be initialized, and is now free'd in cthread_exit.  It's things like that
which could use a second glance.

The fix I checked in makes the Hurd boot a bit further (actually, it seems
to break serverboot, but ignoring that), and then proc dies.  If I boot a
neighbourhurd, behaviour is different, there it goes up to term, which
crashes, and then init gets confused:

Hurd server bootstrap: ext2fs.static[hd0s7] exec init proc 
auth/libexec/console-run: /dev/console: No such file or directory
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: Cannot start console terminal
/hurd/init: /libexec/runsystem exited with status 2
/libexec/console-run: /dev/console: No such file or directory
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: Cannot start console terminal
/hurd/init: /bin/sh exited with status 2
/libexec/console-run: /dev/console: No such file or directory
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: /hurd/term: Translator died
/libexec/console-run: Cannot start console terminal
/hurd/init: /bin/shd exited with status 2
init: notifying ext2fs.static hd0s7 of shutdown.../hurd/init: Getting procinfo 
for pid 2: (os/kern) invalid argument
/hurd/init: Getting procinfo for pid 3: (os/kern) invalid argument
/hurd/init: Getting procinfo for pid 4: (os/kern) invalid argument

... all the way up to ...

/hurd/init: Getting procinfo for pid 45: (os/kern) invalid argument

Well, that's where I am right now.  Some improvement, but still enough
brokeness all over the place.

I think for easiness, I will start to go back a bit in time, ignoring first
your term changes, and if that is not enough, your libthread changes, to see
if I can narrow things down.

Thanks,
Marcus

diff -rup ../hurd-old/hurd-20020523/libthreads/cthread_data.c 
libthreads/cthread_data.c
--- ../hurd-old/hurd-20020523/libthreads/cthread_data.c 2001-04-01 
01:10:55.000000000 +0200
+++ libthreads/cthread_data.c   2002-05-27 14:07:54.000000000 +0200
@@ -175,6 +179,7 @@ any_t               x;
                return(cthread_setspecific(CTHREAD_KEY_RESERVED, x));
        else {
                ASSERT(t == self);
+               return(-1);
        }
 }
 
@@ -199,6 +203,7 @@ cthread_t   t;
        }
        else {
                ASSERT(t == self);
+               return(NULL);
        }
 }
-#endif  /* CTHREAD_DATA */
+#endif /* defined(CTHREAD_DATA_XX) */
diff -rup ../hurd-old/hurd-20020523/libthreads/cthreads.c libthreads/cthreads.c
--- ../hurd-old/hurd-20020523/libthreads/cthreads.c     2002-05-11 
00:21:27.000000000 +0200
+++ libthreads/cthreads.c       2002-06-01 02:13:01.000000000 +0200
@@ -302,8 +271,7 @@ cthread_body(self)
                         */
                        mutex_unlock(&cthread_lock);
                        cthread_assoc(self, t);         /* assume thread's 
identity */
-                       if (_setjmp(t->catch) == 0) {   /* catch for 
cthread_exit() */
-                               cthread_wire ();
+                       if (_setjmp(t->catch_exit) == 0) {      /* catch for 
cthread_exit() */
                                /*
                                 * Execute the fork request.
                                 */
@@ -390,21 +355,24 @@ cthread_join(t)
 }
 
 void
-cthread_exit(result)
-       any_t result;
+cthread_exit(void *result)
 {
        register cthread_t t = cthread_self();
 
        TRACE(printf("[%s] exit()\n", cthread_name(t)));
        t->result = result;
+       if (t->private_data != 0) {
+               free((char *)t->private_data);
+               t->private_data = 0;
+       }
        if (t->state & T_MAIN) {
                mutex_lock(&cthread_lock);
                while (cthread_cthreads > 1)
                        condition_wait(&cthread_idle, &cthread_lock);
                mutex_unlock(&cthread_lock);
-               exit((int)(long)result);
+               exit((int) (integer_t) result);
        } else {
-               _longjmp(t->catch, TRUE);
+               _longjmp(t->catch_exit, TRUE);
        }
 }
 
diff -rup ../hurd-old/hurd-20020523/libthreads/cthreads.h libthreads/cthreads.h
--- ../hurd-old/hurd-20020523/libthreads/cthreads.h     2002-05-11 
00:21:27.000000000 +0200
+++ libthreads/cthreads.h       2002-06-08 03:21:15.000000000 +0200
@@ -231,62 +243,44 @@
 #ifndef        _CTHREADS_
 #define        _CTHREADS_ 1
 
-/* MIB XXX */
-#define CTHREAD_DATA
-
 #if 0
 /* This is CMU's machine-dependent file.  In GNU all of the machine
    dependencies are dealt with in libc.  */
 #include <machine/cthreads.h>
+#include <mach.h>
+#include <sys/macro_help.h>
+#include <mach/machine/vm_param.h>
+
+#ifdef __STDC__
+extern void *malloc();
 #else
-#include <machine-sp.h>
-#define cthread_sp()   ((vm_address_t) __thread_stack_pointer ())
+extern char *malloc();
 #endif
 
-#if    c_plusplus || __STDC__
-
-#ifndef        C_ARG_DECLS
-#define        C_ARG_DECLS(arglist)    arglist
-#endif /* not C_ARG_DECLS */
-
-typedef void *any_t;
-
-#else  /* not (c_plusplus || __STDC__) */
-
-#ifndef        C_ARG_DECLS
-#define        C_ARG_DECLS(arglist)    ()
-#endif /* not C_ARG_DECLS */
-
-typedef char *any_t;
+#else  /* GNU */
+# include <stdlib.h>
+# include <mach.h>
+# include <mach/machine/vm_param.h>
+# include <machine-sp.h>
+# define cthread_sp()  ((vm_address_t) __thread_stack_pointer ())
+# define MACRO_BEGIN   __extension__ ({
+# define MACRO_END     0; })
+#endif
 
-#endif /* not (c_plusplus || __STDC__) */
+typedef void *any_t;       /* XXX - obsolete, should be deleted. */
 
-#include <mach/mach.h>
-#include <mach/machine/vm_param.h>
-
-#ifndef        TRUE
+#if    defined(TRUE)
+#else  /* not defined(TRUE) */
 #define        TRUE    1
 #define        FALSE   0
-#endif /* TRUE */
-
-
-#undef MACRO_BEGIN
-#undef MACRO_END
-#define        MACRO_BEGIN     __extension__ ({
-#define        MACRO_END       0; })
-
+#endif
 
 /*
  * C Threads package initialization.
  */
 
-extern int cthread_init C_ARG_DECLS((void));
-#if 0
-/* This prototype is broken for GNU.  */
-extern any_t calloc C_ARG_DECLS((unsigned n, unsigned size));
-#else
-#include <stdlib.h>
-#endif
+extern vm_offset_t cthread_init(void);
+
 
 /*
  * Queues.
@@ -355,20 +349,24 @@ typedef struct cthread_queue_item {
 /*
  * Spin locks.
  */
-extern void
-spin_lock_solid C_ARG_DECLS((spin_lock_t *p));
+extern void            spin_lock_solid(spin_lock_t *_lock);
 
-#ifndef        spin_unlock
-extern void
-spin_unlock C_ARG_DECLS((spin_lock_t *p));
+#if    defined(spin_unlock)
+#else  /* not defined(spin_unlock) */
+extern void            spin_unlock(spin_lock_t *_lock);
 #endif
 
-#ifndef        spin_try_lock
-extern int
-spin_try_lock C_ARG_DECLS((spin_lock_t *p));
+#if    defined(spin_try_lock)
+#else  /* not defined(spin_try_lock) */
+extern boolean_t       spin_try_lock(spin_lock_t *_lock);
 #endif
 
-#define spin_lock(p) ({if (!spin_try_lock(p)) spin_lock_solid(p);})
+#define spin_lock(p) \
+       MACRO_BEGIN \
+       if (!spin_try_lock(p)) { \
+               spin_lock_solid(p); \
+       } \
+       MACRO_END
 
 #endif /* End unused CMU code.  */
 
@@ -395,37 +396,52 @@ typedef struct mutex {
        spin_lock_init(&(m)->lock); \
        cthread_queue_init(&(m)->queue); \
        spin_lock_init(&(m)->held); \
+       (m)->holder = 0; \
        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((any_t) (m))
-
-extern void __mutex_lock_solid (void *mutex); /* blocking -- roland@gnu */
-extern void __mutex_unlock_solid (void *mutex); /* roland@gnu */
+#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, void *) != 0) { \
+           cthread_queue_head(&(m)->queue, vm_offset_t) != 0) { \
                __mutex_unlock_solid(m); \
        } \
+       (m)->holder = 0; \
        MACRO_END
-
+#else /* defined(WAIT_DEBUG */
+#define mutex_lock(m) \
+       MACRO_BEGIN \
+       if (!spin_try_lock(&(m)->held)) { \
+               __mutex_lock_solid(m); \
+       } \
+       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); \
+       } \
+       MACRO_END
+#endif /* defined(WAIT_DEBUG) */
 /*
  * Condition variables.
  */
 typedef struct condition {
        spin_lock_t lock;
        struct cthread_queue queue;
-       char *name;
+       const char *name;
        struct cond_imp *implications;
 } *condition_t;
 
@@ -436,8 +452,10 @@ struct cond_imp
 };
 
 #define        CONDITION_INITIALIZER           { SPIN_LOCK_INITIALIZER, 
QUEUE_INITIALIZER, 0, 0 }
+#define        CONDITION_NAMED_INITIALIZER(Name)               { 
SPIN_LOCK_INITIALIZER, QUEUE_INITIALIZER, Name, 0 }
 
-#define        condition_alloc()               ((condition_t) calloc(1, 
sizeof(struct condition)))
+#define        condition_alloc() \
+       ((condition_t) calloc(1, sizeof(struct condition)))
 #define        condition_init(c) \
        MACRO_BEGIN \
        spin_lock_init(&(c)->lock); \
@@ -455,7 +473,7 @@ struct cond_imp
 #define        condition_free(c) \
        MACRO_BEGIN \
        condition_clear(c); \
-       free((any_t) (c)); \
+       free((c)); \
        MACRO_END
 
 #define        condition_signal(c) \
@@ -472,29 +490,23 @@ struct cond_imp
        } \
        MACRO_END
 
-extern int
-cond_signal C_ARG_DECLS((condition_t c));
-
-extern void
-cond_broadcast C_ARG_DECLS((condition_t c));
+extern int     cond_signal(condition_t _cond);
 
-extern void
-condition_wait C_ARG_DECLS((condition_t c, mutex_t m));
+extern void    cond_broadcast(condition_t _cond);
 
-extern int
-hurd_condition_wait C_ARG_DECLS((condition_t c, mutex_t m));
+extern void    condition_wait(condition_t _cond, mutex_t _mutex);
+extern int     hurd_condition_wait(condition_t _cond, mutex_t _mutex);
 
-extern void
-condition_implies C_ARG_DECLS((condition_t implicator, condition_t 
implicatand));
-
-extern void
-condition_unimplies C_ARG_DECLS((condition_t implicator, condition_t 
implicatand));
+extern void    condition_implies(condition_t _implicator,
+                                 condition_t _implicatand);
+extern void    condition_unimplies(condition_t _implicator,
+                                   condition_t _implicatand);
 
 /*
  * Threads.
  */
 
-typedef any_t (*cthread_fn_t) C_ARG_DECLS((any_t arg));
+typedef void * (*cthread_fn_t)(void *arg);
 
 #include <setjmp.h>
 
@@ -503,34 +515,28 @@ typedef struct cthread {
        struct mutex lock;
        struct condition done;
        int state;
-       jmp_buf catch;
+       jmp_buf catch_exit;
        cthread_fn_t func;
-       any_t arg;
-       any_t result;
-       char *name;
-#ifdef CTHREAD_DATA
-       any_t data;
-#endif  /* CTHREAD_DATA */
-       any_t private_data;
+       void *arg;
+       void *result;
+       const char *name;
+       void *data;
+       void *ldata;
+       void *private_data;
        struct ur_cthread *ur;
 } *cthread_t;
 
 #define        NO_CTHREAD      ((cthread_t) 0)
 
-extern cthread_t
-cthread_fork C_ARG_DECLS((cthread_fn_t func, any_t arg));
+extern cthread_t       cthread_fork(cthread_fn_t _func, void *_arg);
 
-extern void
-cthread_detach C_ARG_DECLS((cthread_t t));
+extern void            cthread_detach(cthread_t _thread);
 
-extern any_t
-cthread_join C_ARG_DECLS((cthread_t t));
+extern any_t           cthread_join(cthread_t _thread);
 
-extern void
-cthread_yield C_ARG_DECLS((void));
+extern void            cthread_yield(void);
 
-extern void
-cthread_exit C_ARG_DECLS((any_t result));
+extern void            cthread_exit(void *_result);
 
 /*
  * This structure must agree with struct cproc in cthread_internals.h
@@ -541,20 +547,20 @@ typedef struct ur_cthread {
 } *ur_cthread_t;
 
 #ifndef        cthread_sp
-extern int
-cthread_sp C_ARG_DECLS((void));
+extern vm_offset_t
+cthread_sp(void);
 #endif
 
-extern int cthread_stack_mask;
+extern vm_offset_t cthread_stack_mask;
 
-#ifdef STACK_GROWTH_UP
+#if    defined(STACK_GROWTH_UP)
 #define        ur_cthread_ptr(sp) \
        (* (ur_cthread_t *) ((sp) & cthread_stack_mask))
-#else   /* STACK_GROWTH_UP */
+#else  /* not defined(STACK_GROWTH_UP) */
 #define        ur_cthread_ptr(sp) \
        (* (ur_cthread_t *) ( ((sp) | cthread_stack_mask) + 1 \
                              - sizeof(ur_cthread_t *)) )
-#endif  /* STACK_GROWTH_UP */
+#endif /* defined(STACK_GROWTH_UP) */
 
 #define        ur_cthread_self()       (ur_cthread_ptr(cthread_sp()))
 
@@ -562,37 +568,80 @@ extern int cthread_stack_mask;
                                ((t) ? ((t)->ur = (ur_cthread_t)(id)) : 0))
 #define        cthread_self()          (ur_cthread_self()->incarnation)
 
-extern void
-cthread_set_name C_ARG_DECLS((cthread_t t, char *name));
+extern void            cthread_set_name(cthread_t _thread, const char *_name);
+
+extern const char *    cthread_name(cthread_t _thread);
+
+extern int             cthread_count(void);
+
+extern void            cthread_set_limit(int _limit);
 
-extern char *
-cthread_name C_ARG_DECLS((cthread_t t));
+extern int             cthread_limit(void);
 
-extern int
-cthread_count C_ARG_DECLS((void));
+extern void            cthread_set_kernel_limit(int _n);
 
-extern void
-cthread_set_limit C_ARG_DECLS((int n));
+extern int             cthread_kernel_limit(void);
 
-extern int
-cthread_limit C_ARG_DECLS((void));
+extern void            cthread_wire(void);
 
-extern void
-cthread_wire C_ARG_DECLS((void));
+extern void            cthread_unwire(void);
 
-#ifdef CTHREAD_DATA
+extern void            cthread_msg_busy(mach_port_t _port, int _min, int _max);
+
+extern void            cthread_msg_active(mach_port_t _prt, int _min, int 
_max);
+
+extern mach_msg_return_t cthread_mach_msg(mach_msg_header_t *_header,
+                                         mach_msg_option_t _option,
+                                         mach_msg_size_t _send_size,
+                                         mach_msg_size_t _rcv_size,
+                                         mach_port_t _rcv_name,
+                                         mach_msg_timeout_t _timeout,
+                                         mach_port_t _notify,
+                                         int _min, int _max);
+
+extern void            cthread_fork_prepare(void);
+
+extern void            cthread_fork_parent(void);
+
+extern void            cthread_fork_child(void);
+
+#if    defined(THREAD_CALLS)
+/*
+ * Routines to replace thread_*.
+ */
+extern kern_return_t   cthread_get_state(cthread_t _thread);
+
+extern kern_return_t   cthread_set_state(cthread_t _thread);
+
+extern kern_return_t   cthread_abort(cthread_t _thread);
+
+extern kern_return_t   cthread_resume(cthread_t _thread);
+
+extern kern_return_t   cthread_suspend(cthread_t _thread);
+
+extern kern_return_t   cthread_call_on(cthread_t _thread);
+#endif /* defined(THREAD_CALLS) */
+
+#if    defined(CTHREAD_DATA_XX)
 /*
  * Set or get thread specific "global" variable
  *
  * The thread given must be the calling thread (ie. thread_self).
  * XXX This is for compatibility with the old cthread_data. XXX
  */
-extern int
-cthread_set_data C_ARG_DECLS((cthread_t t, any_t x));
+extern int             cthread_set_data(cthread_t _thread, void *_val);
+
+extern void *          cthread_data(cthread_t _thread);
+#else  /* defined(CTHREAD_DATA_XX) */
+
+#define cthread_set_data(_thread, _val) ((_thread)->data) = (void *)(_val);
+#define cthread_data(_thread) ((_thread)->data)
+
+#define cthread_set_ldata(_thread, _val) ((_thread)->ldata) = (void *)(_val);
+#define cthread_ldata(_thread) ((_thread)->ldata)
+
+#endif /* defined(CTHREAD_DATA_XX) */
 
-extern any_t
-cthread_data C_ARG_DECLS((cthread_t t));
-#endif  /* CTHREAD_DATA */
 
 /*
  * Support for POSIX thread specific data
@@ -600,7 +649,7 @@ cthread_data C_ARG_DECLS((cthread_t t));
  * Multiplexes a thread specific "global" variable
  * into many thread specific "global" variables.
  */
-#define CTHREAD_DATA_VALUE_NULL                (any_t)0
+#define CTHREAD_DATA_VALUE_NULL                (void *)0
 #define        CTHREAD_KEY_INVALID             (cthread_key_t)-1
 
 typedef int    cthread_key_t;
@@ -610,27 +659,25 @@ typedef int       cthread_key_t;
  * Different threads may use same key, but the values bound to the key are
  * maintained on a thread specific basis.
  */
-extern int
-cthread_keycreate C_ARG_DECLS((cthread_key_t *key));
+extern int             cthread_keycreate(cthread_key_t *_key);
 
 /*
  * Get value currently bound to key for calling thread
  */
-extern int
-cthread_getspecific C_ARG_DECLS((cthread_key_t key, any_t *value));
+extern int             cthread_getspecific(cthread_key_t _key, void **_value);
 
 /*
  * Bind value to given key for calling thread
  */
-extern int
-cthread_setspecific C_ARG_DECLS((cthread_key_t key, any_t value));
+extern int             cthread_setspecific(cthread_key_t _key, void *_value);
 
 /*
  * Debugging support.
  */
-#ifdef DEBUG
+#if    defined(DEBUG)
 
-#ifndef        ASSERT
+#if    defined(ASSERT)
+#else  /* not defined(ASSERT) */
 /*
  * Assertion macro, similar to <assert.h>
  */
@@ -645,18 +692,19 @@ cthread_setspecific C_ARG_DECLS((cthread
        } \
        MACRO_END
 
-#endif  /* ASSERT */
+#endif /* defined(ASSERT) */
 
 #define        SHOULDNT_HAPPEN 0
 
 extern int cthread_debug;
 
-#else   /* DEBUG */
+#else  /* not defined(DEBUG) */
 
-#ifndef        ASSERT
+#if    defined(ASSERT)
+#else  /* not defined(ASSERT) */
 #define        ASSERT(p)
-#endif  /* ASSERT */
+#endif /* defined(ASSERT) */
 
-#endif  /* DEBUG */
+#endif /* defined(DEBUG) */
 
-#endif  /* _CTHREADS_ */
+#endif /* not defined(_CTHREADS_) */
diff -rup ../hurd-old/hurd-20020523/libthreads/CVS/Entries 
libthreads/CVS/Entries
--- ../hurd-old/hurd-20020523/libthreads/CVS/Entries    2002-05-11 
00:21:27.000000000 +0200
+++ libthreads/CVS/Entries      2002-07-29 19:52:19.000000000 +0200
@@ -3,20 +3,21 @@
 /Makefile.CMU/1.1/Tue Oct  6 18:31:03 1992//
 /Makefile.GNU/1.1/Tue Oct  6 18:30:54 1992//
 /Makefile.GNU2/1.1/Wed Mar 17 19:33:50 1993//
-/call.c/1.2/Sat Mar 31 23:01:01 2001//
 /cancel-cond.c/1.4/Sat Mar 31 23:01:01 2001//
-/cthread_data.c/1.2/Sat Mar 31 23:10:55 2001//
-/lockfile.c/1.3/Fri Aug 24 03:35:30 2001//
-/mig_support.c/1.3/Thu Nov 18 20:57:46 1993//
-/options.h/1.1/Tue Oct  6 18:31:06 1992//
 /rwlock.c/1.3/Thu Oct 24 19:29:46 1996//
 /rwlock.h/1.6/Thu Oct 24 19:29:49 1996//
-/stack.c/1.7/Sat Mar 31 23:01:01 2001//
-/sync.c/1.1/Tue Oct  6 18:31:06 1992//
 D/i386////
 /libthreads.map/1.4/Fri May  3 14:48:09 2002//
-/ChangeLog/1.33/Fri May 10 22:21:27 2002//
-/cprocs.c/1.15/Fri May 10 22:21:27 2002//
-/cthread_internals.h/1.5/Fri May 10 22:21:27 2002//
-/cthreads.c/1.11/Fri May 10 22:21:27 2002//
-/cthreads.h/1.17/Fri May 10 22:21:27 2002//
+/call.c/1.3/Mon May 27 12:07:54 2002//
+/cthread_data.c/1.3/Mon May 27 12:07:54 2002//
+/cthread_internals.h/1.6/Mon May 27 12:07:54 2002//
+/mig_support.c/1.4/Mon May 27 12:07:55 2002//
+/sync.c/1.2/Mon May 27 12:07:56 2002//
+D/alpha////
+/cprocs.c/1.17/Sat Jun  1 00:13:01 2002//
+/cthreads.c/1.13/Sat Jun  1 00:13:01 2002//
+/lockfile.c/1.4/Sat Jun  1 00:13:01 2002//
+/cthreads.h/1.20/Sat Jun  8 01:21:15 2002//
+/options.h/1.3/Sat Jun  8 01:21:15 2002//
+/ChangeLog/1.39/Mon Jul 29 17:52:01 2002//
+/stack.c/1.9/Mon Jul 29 17:52:17 2002//
diff -rup ../hurd-old/hurd-20020523/libthreads/CVS/Repository 
libthreads/CVS/Repository
--- ../hurd-old/hurd-20020523/libthreads/CVS/Repository 2002-05-23 
15:36:43.000000000 +0200
+++ libthreads/CVS/Repository   2001-11-26 20:19:13.000000000 +0100
@@ -1 +1 @@
-/cvsroot/hurd/hurd/libthreads
+hurd/libthreads
diff -rup ../hurd-old/hurd-20020523/libthreads/CVS/Root libthreads/CVS/Root
--- ../hurd-old/hurd-20020523/libthreads/CVS/Root       2002-05-23 
15:36:43.000000000 +0200
+++ libthreads/CVS/Root 2001-11-26 20:19:13.000000000 +0100
@@ -1 +1 @@
-:pserver:anoncvs@subversions.gnu.org:/cvsroot/hurd
+marcus@subversions.gnu.org:/cvsroot/hurd
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/cthreads.h 
libthreads/i386/cthreads.h
--- ../hurd-old/hurd-20020523/libthreads/i386/cthreads.h        1992-10-06 
19:31:16.000000000 +0100
+++ libthreads/i386/cthreads.h  2002-05-27 14:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 /* 
  * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
+ * Copyright (c) 1993,1991,1990 Carnegie Mellon University
  * All Rights Reserved.
  * 
  * Permission to use, copy, modify and distribute this software and its
@@ -26,9 +26,29 @@
 /*
  * HISTORY
  * $Log: cthreads.h,v $
- * Revision 1.1  1992/10/06 18:31:16  mib
- * entered into RCS
+ * Revision 1.2  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.9  93/01/24  13:24:58  danner
+ *     Move ! in spin_try_lock to give the compiler
+ *     a fighting chance.
+ *     [92/11/19            rvb]
+ * 
+ * Revision 2.8  93/01/14  18:05:09  danner
+ *     asm -> __asm__
+ *     [93/01/10            danner]
+ * 
  * Revision 2.7  92/01/03  20:36:59  dbg
  *     Add volatile to spin_lock_t.  Change spin_unlock and
  *     spin_try_lock definitions back to memory operands, but rely on
@@ -69,21 +89,21 @@ typedef volatile int spin_lock_t;
 
 #define        spin_unlock(p) \
        ({  register int _u__ ; \
-           asm volatile("xorl %0, %0; \n\
+           __asm__ volatile("xorl %0, %0; \n\
                          xchgl %0, %1" \
                        : "=&r" (_u__), "=m" (*(p)) ); \
            0; })
 
 #define        spin_try_lock(p)\
-       ({  boolean_t _r__; \
-           asm volatile("movl $1, %0; \n\
+       (!({  boolean_t _r__; \
+           __asm__ volatile("movl $1, %0; \n\
                          xchgl %0, %1" \
                        : "=&r" (_r__), "=m" (*(p)) ); \
-           !_r__; })
+           _r__; }))
 
 #define        cthread_sp() \
        ({  int _sp__; \
-           asm("movl %%esp, %0" \
+           __asm__("movl %%esp, %0" \
              : "=g" (_sp__) ); \
            _sp__; })
 
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/CVS/Entries 
libthreads/i386/CVS/Entries
--- ../hurd-old/hurd-20020523/libthreads/i386/CVS/Entries       2001-12-23 
15:53:50.000000000 +0100
+++ libthreads/i386/CVS/Entries 2002-05-27 14:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 /csw.S/1.10/Fri Mar  3 21:58:21 2000//
 /cthread_inline.awk/1.1/Tue Oct  6 18:31:15 1992//
-/cthreads.h/1.1/Tue Oct  6 18:31:16 1992//
-/lock.s/1.1/Tue Oct  6 18:31:16 1992//
-/thread.c/1.6/Sun Dec 23 14:53:50 2001//
+/cthreads.h/1.2/Mon May 27 12:07:56 2002//
+/lock.s/1.2/Mon May 27 12:07:56 2002//
+/thread.c/1.7/Mon May 27 12:07:56 2002//
 D
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/CVS/Repository 
libthreads/i386/CVS/Repository
--- ../hurd-old/hurd-20020523/libthreads/i386/CVS/Repository    2002-05-23 
15:36:43.000000000 +0200
+++ libthreads/i386/CVS/Repository      2001-11-26 20:19:15.000000000 +0100
@@ -1 +1 @@
-/cvsroot/hurd/hurd/libthreads/i386
+hurd/libthreads/i386
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/CVS/Root 
libthreads/i386/CVS/Root
--- ../hurd-old/hurd-20020523/libthreads/i386/CVS/Root  2002-05-23 
15:36:43.000000000 +0200
+++ libthreads/i386/CVS/Root    2001-11-26 20:19:15.000000000 +0100
@@ -1 +1 @@
-:pserver:anoncvs@subversions.gnu.org:/cvsroot/hurd
+marcus@subversions.gnu.org:/cvsroot/hurd
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/lock.s 
libthreads/i386/lock.s
--- ../hurd-old/hurd-20020523/libthreads/i386/lock.s    1992-10-06 
19:31:16.000000000 +0100
+++ libthreads/i386/lock.s      2002-05-27 14:07:56.000000000 +0200
@@ -26,9 +26,24 @@
 /*
  * HISTORY
  * $Log: lock.s,v $
- * Revision 1.1  1992/10/06 18:31:16  mib
- * entered into RCS
+ * Revision 1.2  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.6  93/05/10  17:51:38  rvb
+ *     Use C Comment
+ *     [93/05/04  18:14:05  rvb]
+ * 
  * Revision 2.5  91/05/14  17:57:20  mrt
  *     Correcting copyright
  * 
@@ -52,22 +67,22 @@
  * boolean_t spin_try_lock(int *m)
  */
 ENTRY(spin_try_lock)
-       movl    4(%esp),%ecx            / point at mutex
-       movl    $1,%eax                 / set locked value in acc
-       xchg    %eax,(%ecx)             / swap with mutex
-                                       / xchg with memory is automatically
-                                       / locked
-       xorl    $1,%eax                 / 1 (locked) => FALSE
-                                       / 0 (locked) => TRUE
+       movl    4(%esp),%ecx            /* point at mutex */
+       movl    $1,%eax                 /* set locked value in acc */
+       xchg    %eax,(%ecx)             /* swap with mutex */
+                                       /* xchg with memory is automatically */
+                                       /* locked */
+       xorl    $1,%eax                 /* 1 (locked) => FALSE */
+                                       /* 0 (locked) => TRUE */
        ret
 
 /*
  * void spin_unlock(int *m)
  */
 ENTRY(spin_unlock)
-       movl    4(%esp),%ecx            / point at mutex
-       xorl    %eax,%eax               / set unlocked value in acc
-       xchg    %eax,(%ecx)             / swap with mutex
-                                       / xchg with memory is automatically
-                                       / locked
+       movl    4(%esp),%ecx            /* point at mutex */
+       xorl    %eax,%eax               /* set unlocked value in acc */
+       xchg    %eax,(%ecx)             /* swap with mutex */
+                                       /* xchg with memory is automatically */
+                                       /* locked */
        ret
diff -rup ../hurd-old/hurd-20020523/libthreads/i386/thread.c 
libthreads/i386/thread.c
--- ../hurd-old/hurd-20020523/libthreads/i386/thread.c  2001-12-23 
15:53:50.000000000 +0100
+++ libthreads/i386/thread.c    2002-05-27 14:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
+ * Copyright (c) 1992,1991,1990 Carnegie Mellon University
  * All Rights Reserved.
  *
  * Permission to use, copy, modify and distribute this software and its
@@ -26,48 +26,33 @@
 /*
  * HISTORY
  * $Log: thread.c,v $
- * Revision 1.6  2001/12/22 21:02:31  roland
- * 2001-12-22  Roland McGrath  <roland@frob.com>
+ * Revision 1.7  2002/05/27 02:50:10  roland
+ * 2002-05-26  Roland McGrath  <roland@frob.com>
  *
- *     * i386/thread.c (cthread_sp): Use __thread_stack_pointer.
- *
- * Revision 1.5  2001/03/31 23:03:03  roland
- * 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.
+ *     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.
- *     * cprocs.c: Likewise.
- *     * call.c: Likewise.
- *     * i386/thread.c: Likewise.
- *
- * Revision 1.4  2001/02/26 04:15:27  roland
- * 2001-02-25  Roland McGrath  <roland@frob.com>
- *
- *     * i386/thread.c: Remove superfluous bzero decl,
- *     just include <strings.h> instead.
- *
- * Revision 1.3  1997/02/18 22:53:31  miles
- * (cproc_setup):
- *   Correctly leave space at top of stack for account for GNU per-thread
- *     variables.
+ *     (cthread_exit): Cast any_t to integer_t before int.
  *
- * Revision 1.2  1994/05/04 19:05:26  mib
- * entered into RCS
+ * Revision 2.8  93/02/02  21:54:58  mrt
+ *     Changed include of mach/mach.h to mach.h.
+ *     [93/02/02            mrt]
+ *
+ * Revision 2.7  93/01/14  18:05:15  danner
+ *     Converted file to ANSI C.
+ *     Fixed argument types.
+ *     [92/12/18            pds]
  *
  * Revision 2.6  91/07/31  18:37:07  dbg
  *     Undefine cthread_sp macro around function definition.
  *     [91/07/30  17:36:23  dbg]
  *
- * Revision 2.5  91/05/14  17:57:27  mrt
- *     Correcting copyright
- *
- * Revision 2.4  91/02/14  14:20:21  mrt
- *     Changed to new Mach copyright
- *     [91/02/13  12:20:10  mrt]
- *
  * Revision 2.3  90/06/02  15:13:53  rpd
  *     Added definition of cthread_sp.
  *     [90/06/02            rpd]
@@ -83,15 +68,13 @@
  */
 
 #ifndef        lint
-static char rcs_id[] = "$Header: /cvsroot/hurd/hurd/libthreads/i386/thread.c,v 
1.6 2001/12/22 21:02:31 roland Exp $";
+char rcs_id[] = "$Header: /cvsroot/hurd/hurd/libthreads/i386/thread.c,v 1.7 
2002/05/27 02:50:10 roland Exp $";
 #endif /* not lint */
 
 
-#include "../cthreads.h"
-#include "../cthread_internals.h"
-#include <strings.h>
-#include <mach/mach.h>
-
+#include <cthreads.h>
+#include "cthread_internals.h"
+#include <mach.h>
 
 /*
  * Set up the initial state of a MACH thread
@@ -99,10 +82,7 @@ static char rcs_id[] = "$Header: /cvsroo
  * when it is resumed.
  */
 void
-cproc_setup(child, thread, routine)
-       register cproc_t child;
-       int thread;
-       int routine;
+cproc_setup(register cproc_t child, thread_t thread, void (*routine)(cproc_t))
 {
        extern unsigned int __hurd_threadvar_max; /* GNU */
        register int *top = (int *)
@@ -123,7 +103,7 @@ cproc_setup(child, thread, routine)
        count = i386_THREAD_STATE_COUNT;
        MACH_CALL(thread_get_state(thread,i386_THREAD_STATE,(thread_state_t) 
&state,&count),r);
 
-       ts->eip = routine;
+       ts->eip = (int) routine;
        *--top = (int) child;   /* argument to function */
        *--top = 0;             /* fake return address */
        ts->uesp = (int) top;   /* set stack pointer */
@@ -132,12 +112,12 @@ cproc_setup(child, thread, routine)
        MACH_CALL(thread_set_state(thread,i386_THREAD_STATE,(thread_state_t) 
&state,i386_THREAD_STATE_COUNT),r);
 }
 
-#ifdef cthread_sp
+#if    defined(cthread_sp)
 #undef cthread_sp
 #endif
 
 int
-cthread_sp()
+cthread_sp(void)
 {
        return (int) __thread_stack_pointer ();
 }
diff -rup ../hurd-old/hurd-20020523/libthreads/lockfile.c libthreads/lockfile.c
--- ../hurd-old/hurd-20020523/libthreads/lockfile.c     2001-08-24 
05:35:30.000000000 +0200
+++ libthreads/lockfile.c       2002-06-01 02:13:01.000000000 +0200
@@ -1,5 +1,5 @@
 /* lockfile - Handle locking and unlocking of streams.  Hurd cthreads version.
-   Copyright (C) 2000,01 Free Software Foundation, Inc.
+   Copyright (C) 2000,01,02 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
@@ -41,20 +41,25 @@ _cthreads_ftrylockfile (_IO_FILE *fp)
   return __libc_lock_trylock_recursive (*fp->_lock);
 }
 
-
 # undef        _IO_flockfile
 # undef        _IO_funlockfile
 # undef        _IO_ftrylockfile
-# pragma weak  _IO_flockfile   = _cthreads_flockfile
-# pragma weak  _IO_funlockfile = _cthreads_funlockfile
-# pragma weak  _IO_ftrylockfile= _cthreads_ftrylockfile
-
 # undef                flockfile
 # undef                funlockfile
 # undef                ftrylockfile
-# pragma weak  flockfile       = _cthreads_flockfile
-# pragma weak  funlockfile     = _cthreads_funlockfile
-# pragma weak  ftrylockfile    = _cthreads_ftrylockfile
 
+void _IO_flockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_flockfile")));
+void _IO_funlockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_funlockfile")));
+int _IO_ftrylockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_ftrylockfile")));
+
+void flockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_flockfile")));
+void funlockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_funlockfile")));
+int ftrylockfile (_IO_FILE *)
+     __attribute__ ((alias ("_cthreads_ftrylockfile")));
 
 #endif /* _STDIO_USES_IOSTREAM */
diff -rup ../hurd-old/hurd-20020523/libthreads/mig_support.c 
libthreads/mig_support.c
--- ../hurd-old/hurd-20020523/libthreads/mig_support.c  1993-11-18 
21:57:46.000000000 +0100
+++ libthreads/mig_support.c    2002-05-27 14:07:55.000000000 +0200
@@ -78,7 +103,9 @@
  */
 
 
-#include <mach/mach.h>
+#include <mach.h>
+#include <mach/mig_support.h>
+#include <mach/mach_traps.h>
 #include <cthreads.h>
 #include "cthread_internals.h"
 
diff -rup ../hurd-old/hurd-20020523/libthreads/options.h libthreads/options.h
--- ../hurd-old/hurd-20020523/libthreads/options.h      1992-10-06 
19:31:06.000000000 +0100
+++ libthreads/options.h        2002-06-08 03:21:15.000000000 +0200
@@ -90,4 +107,4 @@
 #define SPIN_RESCHED
 /*#define CHECK_STATUS*/
 /*#define RED_ZONE*/
-#define WAIT_DEBUG
+/*#define WAIT_DEBUG*/
diff -rup ../hurd-old/hurd-20020523/libthreads/stack.c libthreads/stack.c
--- ../hurd-old/hurd-20020523/libthreads/stack.c        2001-04-01 
01:01:01.000000000 +0200
+++ libthreads/stack.c  2002-07-29 19:52:17.000000000 +0200
@@ -317,11 +315,7 @@ stack_init(p)
                        start;
        vm_size_t       size;
        kern_return_t   r;
-#endif
-
-       void alloc_stack();
 
-#if 0
        /*
         * Probe for bottom and top of stack, as a power-of-2 size.
         */


-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]