diff options
Diffstat (limited to 'libfshelp')
-rw-r--r-- | libfshelp/Makefile | 3 | ||||
-rw-r--r-- | libfshelp/fetch-root.c | 12 | ||||
-rw-r--r-- | libfshelp/fshelp.h | 14 | ||||
-rw-r--r-- | libfshelp/get-identity.c | 10 | ||||
-rw-r--r-- | libfshelp/lock-acquire.c | 12 | ||||
-rw-r--r-- | libfshelp/lock-init.c | 2 | ||||
-rw-r--r-- | libfshelp/locks.h | 2 | ||||
-rw-r--r-- | libfshelp/set-active.c | 2 | ||||
-rw-r--r-- | libfshelp/trans.h | 4 | ||||
-rw-r--r-- | libfshelp/transbox-init.c | 6 |
10 files changed, 34 insertions, 33 deletions
diff --git a/libfshelp/Makefile b/libfshelp/Makefile index bbc079c7..4de38372 100644 --- a/libfshelp/Makefile +++ b/libfshelp/Makefile @@ -32,7 +32,8 @@ SRCS = lock-acquire.c lock-init.c \ touch.c installhdrs = fshelp.h -HURDLIBS = shouldbeinlibc threads iohelp ports +HURDLIBS = shouldbeinlibc iohelp ports +LDLIBS += -lpthread OBJS = $(subst .c,.o,$(SRCS)) include ../Makeconf diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c index eb569896..45c7dd09 100644 --- a/libfshelp/fetch-root.c +++ b/libfshelp/fetch-root.c @@ -95,13 +95,13 @@ fshelp_fetch_root (struct transbox *box, void *cookie, if (box->flags & TRANSBOX_STARTING) { box->flags |= TRANSBOX_WANTED; - cancel = hurd_condition_wait (&box->wakeup, box->lock); + cancel = pthread_hurd_cond_wait_np (&box->wakeup, box->lock); if (cancel) return EINTR; goto start_over; } box->flags |= TRANSBOX_STARTING; - mutex_unlock (box->lock); + pthread_mutex_unlock (box->lock); err = (*callback1) (box->cookie, cookie, &uid, &gid, &argz, &argz_len); if (err) @@ -147,7 +147,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie, if (i != INIT_PORT_CWDIR) mach_port_deallocate (mach_task_self (), ports[i]); - mutex_lock (box->lock); + pthread_mutex_lock (box->lock); free (argz); @@ -157,7 +157,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie, if (box->flags & TRANSBOX_WANTED) { box->flags &= ~TRANSBOX_WANTED; - condition_broadcast (&box->wakeup); + pthread_cond_broadcast (&box->wakeup); } if (err) @@ -173,7 +173,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie, control = box->active; mach_port_mod_refs (mach_task_self (), control, MACH_PORT_RIGHT_SEND, 1); - mutex_unlock (box->lock); + pthread_mutex_unlock (box->lock); /* Cancellation point XXX */ err = fsys_getroot (control, dotdot, MACH_MSG_TYPE_COPY_SEND, @@ -181,7 +181,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie, user->gids->ids, user->gids->num, flags, retry, retryname, root); - mutex_lock (box->lock); + pthread_mutex_lock (box->lock); if ((err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED) && control == box->active) diff --git a/libfshelp/fshelp.h b/libfshelp/fshelp.h index 9f4fa677..cf39fbc4 100644 --- a/libfshelp/fshelp.h +++ b/libfshelp/fshelp.h @@ -26,7 +26,7 @@ #include <errno.h> #include <mach.h> #include <hurd/hurd_types.h> -#include <cthreads.h> +#include <pthread.h> #include <hurd/iohelp.h> #include <sys/stat.h> #include <maptime.h> @@ -78,16 +78,16 @@ fshelp_start_translator (fshelp_open_fn_t underlying_open_fn, void *cookie, /* Active translator linkage */ /* These routines implement the linkage to active translators needed - by any filesystem which supports them. They require cthreads and + by any filesystem which supports them. They require pthreads and use the passive translator routines above, but they don't require the ports library at all. */ struct transbox { fsys_t active; - struct mutex *lock; + pthread_mutex_t *lock; int flags; - struct condition wakeup; + pthread_cond_t wakeup; void *cookie; }; #define TRANSBOX_STARTING 1 @@ -137,7 +137,7 @@ fshelp_fetch_root (struct transbox *transbox, void *cookie, void fshelp_transbox_init (struct transbox *transbox, - struct mutex *lock, + pthread_mutex_t *lock, void *cookie); /* Return true iff there is an active translator on this box */ @@ -163,7 +163,7 @@ void fshelp_drop_transbox (struct transbox *box); struct lock_box { int type; - struct condition wait; + pthread_cond_t wait; int waiting; int shcount; }; @@ -174,7 +174,7 @@ struct lock_box per file_lock. MUT is a mutex which will be held whenever this routine is called, to lock BOX->wait. */ error_t fshelp_acquire_lock (struct lock_box *box, int *user, - struct mutex *mut, int flags); + pthread_mutex_t *mut, int flags); /* Initialize lock_box BOX. (The user int passed to fshelp_acquire_lock diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c index 51c5fb29..946b7e8e 100644 --- a/libfshelp/get-identity.c +++ b/libfshelp/get-identity.c @@ -24,7 +24,7 @@ #include <assert.h> static struct port_class *idclass = 0; -static struct mutex idlock = MUTEX_INITIALIZER; +static pthread_mutex_t idlock = PTHREAD_MUTEX_INITIALIZER; struct idspec { @@ -59,7 +59,7 @@ fshelp_get_identity (struct port_bucket *bucket, return 0; } - mutex_lock (&idlock); + pthread_mutex_lock (&idlock); if (!idclass) id_initialize (); @@ -69,20 +69,20 @@ fshelp_get_identity (struct port_bucket *bucket, if (*pt != MACH_PORT_NULL) { - mutex_unlock (&idlock); + pthread_mutex_unlock (&idlock); return 0; } err = ports_create_port (idclass, bucket, sizeof (struct idspec), &i); if (err) { - mutex_unlock (&idlock); + pthread_mutex_unlock (&idlock); return err; } i->fileno = fileno; *pt = ports_get_right (i); ports_port_deref (i); - mutex_unlock (&idlock); + pthread_mutex_unlock (&idlock); return 0; } diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c index bad1114d..cdc6185c 100644 --- a/libfshelp/lock-acquire.c +++ b/libfshelp/lock-acquire.c @@ -24,7 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define EWOULDBLOCK EAGAIN /* XXX */ error_t -fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, +fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut, int flags) { if (!(flags & (LOCK_UN | LOCK_EX | LOCK_SH))) @@ -58,7 +58,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, if (box->type == LOCK_UN && box->waiting) { box->waiting = 0; - condition_broadcast (&box->wait); + pthread_cond_broadcast (&box->wait); } *user = LOCK_UN; } @@ -72,7 +72,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, if (box->waiting) { box->waiting = 0; - condition_broadcast (&box->wait); + pthread_cond_broadcast (&box->wait); } } @@ -82,7 +82,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, if (flags & LOCK_NB) return EWOULDBLOCK; box->waiting = 1; - if (hurd_condition_wait (&box->wait, mut)) + if (pthread_hurd_cond_wait_np (&box->wait, mut)) return EINTR; } @@ -96,7 +96,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, if (box->waiting) { box->waiting = 0; - condition_broadcast (&box->wait); + pthread_cond_broadcast (&box->wait); } } } @@ -119,7 +119,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, else { box->waiting = 1; - if (hurd_condition_wait (&box->wait, mut)) + if (pthread_hurd_cond_wait_np (&box->wait, mut)) return EINTR; } } diff --git a/libfshelp/lock-init.c b/libfshelp/lock-init.c index 4b1da97e..66046aaa 100644 --- a/libfshelp/lock-init.c +++ b/libfshelp/lock-init.c @@ -26,7 +26,7 @@ void fshelp_lock_init (struct lock_box *box) { box->type = LOCK_UN; - condition_init (&box->wait); + pthread_cond_init (&box->wait, NULL); box->waiting = 0; box->shcount = 0; } diff --git a/libfshelp/locks.h b/libfshelp/locks.h index dcecf5d9..a950f610 100644 --- a/libfshelp/locks.h +++ b/libfshelp/locks.h @@ -21,7 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <mach.h> #include <hurd.h> -#include <cthreads.h> +#include <pthread.h> #include <hurd/ports.h> #include "fshelp.h" #include <sys/file.h> diff --git a/libfshelp/set-active.c b/libfshelp/set-active.c index 4f25a50e..9776a529 100644 --- a/libfshelp/set-active.c +++ b/libfshelp/set-active.c @@ -49,7 +49,7 @@ fshelp_set_active (struct transbox *box, while (box->flags & TRANSBOX_STARTING) { box->flags |= TRANSBOX_WANTED; - cancel = hurd_condition_wait (&box->wakeup, box->lock); + cancel = pthread_hurd_cond_wait_np (&box->wakeup, box->lock); if (cancel) return EINTR; } diff --git a/libfshelp/trans.h b/libfshelp/trans.h index b2416453..a9ea6487 100644 --- a/libfshelp/trans.h +++ b/libfshelp/trans.h @@ -17,7 +17,7 @@ #include <mach.h> #include <hurd.h> -#include <cthreads.h> +#include <pthread.h> #include <hurd/ports.h> #include "fshelp.h" @@ -28,5 +28,5 @@ struct transboot struct trans_link *link; }; -spin_lock_t _fshelp_translistlock; +pthread_spinlock_t _fshelp_translistlock; struct trans_link *_fshelp_translist; diff --git a/libfshelp/transbox-init.c b/libfshelp/transbox-init.c index 1945a57d..42d953e8 100644 --- a/libfshelp/transbox-init.c +++ b/libfshelp/transbox-init.c @@ -19,17 +19,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "fshelp.h" -#include <cthreads.h> +#include <pthread.h> void fshelp_transbox_init (struct transbox *transbox, - struct mutex *lock, + pthread_mutex_t *lock, void *cookie) { transbox->active = MACH_PORT_NULL; transbox->flags = 0; transbox->lock = lock; - condition_init (&transbox->wakeup); + pthread_cond_init (&transbox->wakeup, NULL); transbox->cookie = cookie; } |