diff options
Diffstat (limited to 'libtrivfs')
-rw-r--r-- | libtrivfs/cntl-create.c | 2 | ||||
-rw-r--r-- | libtrivfs/dyn-classes.c | 15 | ||||
-rw-r--r-- | libtrivfs/io-reauthenticate.c | 4 | ||||
-rw-r--r-- | libtrivfs/io-restrict-auth.c | 4 | ||||
-rw-r--r-- | libtrivfs/protid-clean.c | 8 | ||||
-rw-r--r-- | libtrivfs/protid-dup.c | 4 | ||||
-rw-r--r-- | libtrivfs/trivfs.h | 4 |
7 files changed, 21 insertions, 20 deletions
diff --git a/libtrivfs/cntl-create.c b/libtrivfs/cntl-create.c index f103ed48..910daf3b 100644 --- a/libtrivfs/cntl-create.c +++ b/libtrivfs/cntl-create.c @@ -85,7 +85,7 @@ trivfs_create_control (mach_port_t underlying, } (*control)->hook = 0; - mutex_init (&(*control)->lock); + pthread_mutex_init (&(*control)->lock, NULL); } out: diff --git a/libtrivfs/dyn-classes.c b/libtrivfs/dyn-classes.c index 5f73f8f3..a6bb7de1 100644 --- a/libtrivfs/dyn-classes.c +++ b/libtrivfs/dyn-classes.c @@ -48,7 +48,8 @@ static struct aux *dynamic_port_buckets_aux = 0; static size_t dynamic_port_buckets_sz = 0; /* Lock used to control access to all the above vectors. */ -static struct mutex dyn_lock = MUTEX_INITIALIZER; +static pthread_mutex_t dyn_lock = PTHREAD_MUTEX_INITIALIZER; + /* Add EL to the vector pointed to by VEC_V, which should point to a vector of pointers of some type, and has a length stored in *SZ; If there's @@ -74,7 +75,7 @@ add_el (void *el, void (*free_el)(), if (! el) return ENOMEM; - mutex_lock (&dyn_lock); + pthread_mutex_lock (&dyn_lock); vec = vec_v; @@ -85,13 +86,13 @@ add_el (void *el, void (*free_el)(), (*aux_vec)[i].free_el = free_el; (*aux_vec)[i].refs = 1; (*num)++; - mutex_unlock (&dyn_lock); + pthread_mutex_unlock (&dyn_lock); return 0; } else if ((*vec)[i] == el) { (*aux_vec)[i].refs++; - mutex_unlock (&dyn_lock); + pthread_mutex_unlock (&dyn_lock); return 0; } @@ -119,7 +120,7 @@ add_el (void *el, void (*free_el)(), *aux_vec = new_aux_vec; *sz = new_sz; - mutex_unlock (&dyn_lock); + pthread_mutex_unlock (&dyn_lock); return 0; } @@ -138,7 +139,7 @@ drop_el (void *el, void *vec_v, struct aux *aux_vec, if (! el) return; - mutex_lock (&dyn_lock); + pthread_mutex_lock (&dyn_lock); vec = vec_v; @@ -157,7 +158,7 @@ drop_el (void *el, void *vec_v, struct aux *aux_vec, break; } - mutex_unlock (&dyn_lock); + pthread_mutex_unlock (&dyn_lock); } /* Add the port class *CLASS to the list of control port classes recognized diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c index 80ef31c1..6623d947 100644 --- a/libtrivfs/io-reauthenticate.c +++ b/libtrivfs/io-reauthenticate.c @@ -62,10 +62,10 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred, newcred->hook = cred->hook; - mutex_lock (&cred->po->cntl->lock); + pthread_mutex_lock (&cred->po->cntl->lock); newcred->po = cred->po; newcred->po->refcnt++; - mutex_unlock (&cred->po->cntl->lock); + pthread_mutex_unlock (&cred->po->cntl->lock); do err = io_restrict_auth (newcred->po->cntl->underlying, &newcred->realnode, diff --git a/libtrivfs/io-restrict-auth.c b/libtrivfs/io-restrict-auth.c index 98a80a13..61c07725 100644 --- a/libtrivfs/io-restrict-auth.c +++ b/libtrivfs/io-restrict-auth.c @@ -109,10 +109,10 @@ trivfs_S_io_restrict_auth (struct trivfs_protid *cred, } newcred->isroot = 0; - mutex_lock (&cred->po->cntl->lock); + pthread_mutex_lock (&cred->po->cntl->lock); newcred->po = cred->po; newcred->po->refcnt++; - mutex_unlock (&cred->po->cntl->lock); + pthread_mutex_unlock (&cred->po->cntl->lock); if (cred->isroot && idvec_contains (user->uids, 0)) newcred->isroot = 1; newcred->user = user; diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c index b76b202e..856d7af5 100644 --- a/libtrivfs/protid-clean.c +++ b/libtrivfs/protid-clean.c @@ -30,19 +30,19 @@ trivfs_clean_protid (void *arg) (*trivfs_protid_destroy_hook) (cred); /* If we hold the only reference to the peropen, try to get rid of it. */ - mutex_lock (&cred->po->cntl->lock); + pthread_mutex_lock (&cred->po->cntl->lock); if (cred->po->refcnt == 1 && trivfs_peropen_destroy_hook) { - mutex_unlock (&cred->po->cntl->lock); + pthread_mutex_unlock (&cred->po->cntl->lock); (*trivfs_peropen_destroy_hook) (cred->po); - mutex_lock (&cred->po->cntl->lock); + pthread_mutex_lock (&cred->po->cntl->lock); } if (--cred->po->refcnt == 0) { ports_port_deref (cred->po->cntl); free (cred->po); } - mutex_unlock (&cred->po->cntl->lock); + pthread_mutex_unlock (&cred->po->cntl->lock); iohelp_free_iouser (cred->user); diff --git a/libtrivfs/protid-dup.c b/libtrivfs/protid-dup.c index 855cd062..61696032 100644 --- a/libtrivfs/protid-dup.c +++ b/libtrivfs/protid-dup.c @@ -35,10 +35,10 @@ trivfs_protid_dup (struct trivfs_protid *cred, struct trivfs_protid **dup) if (! err) { - mutex_lock (&cred->po->cntl->lock); + pthread_mutex_lock (&cred->po->cntl->lock); new->po = cred->po; new->po->refcnt++; - mutex_unlock (&cred->po->cntl->lock); + pthread_mutex_unlock (&cred->po->cntl->lock); new->isroot = cred->isroot; diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h index 798e0b38..33b04363 100644 --- a/libtrivfs/trivfs.h +++ b/libtrivfs/trivfs.h @@ -19,7 +19,7 @@ #define __TRIVFS_H__ #include <errno.h> -#include <cthreads.h> /* for mutexes &c */ +#include <pthread.h> /* for mutexes &c */ #include <sys/types.h> /* for uid_t &c */ #include <mach/mach.h> #include <hurd/ports.h> @@ -53,7 +53,7 @@ struct trivfs_peropen struct trivfs_control { struct port_info pi; - struct mutex lock; + pthread_mutex_t lock; struct port_class *protid_class; struct port_bucket *protid_bucket; mach_port_t filesys_id; |