summaryrefslogtreecommitdiff
path: root/libiohelp
diff options
context:
space:
mode:
Diffstat (limited to 'libiohelp')
-rw-r--r--libiohelp/Makefile3
-rw-r--r--libiohelp/get_conch.c10
-rw-r--r--libiohelp/handle_io_release_conch.c6
-rw-r--r--libiohelp/initialize_conch.c4
-rw-r--r--libiohelp/iohelp.h8
-rw-r--r--libiohelp/verify_user_conch.c6
6 files changed, 19 insertions, 18 deletions
diff --git a/libiohelp/Makefile b/libiohelp/Makefile
index 56815c49..f0dd48f0 100644
--- a/libiohelp/Makefile
+++ b/libiohelp/Makefile
@@ -23,7 +23,8 @@ SRCS = get_conch.c handle_io_get_conch.c handle_io_release_conch.c \
iouser-dup.c iouser-reauth.c iouser-free.c iouser-restrict.c \
shared.c return-buffer.c
OBJS = $(SRCS:.c=.o)
-HURDLIBS = threads shouldbeinlibc
+HURDLIBS = shouldbeinlibc
+LDLIBS += -lpthread
libname = libiohelp
installhdrs = iohelp.h
diff --git a/libiohelp/get_conch.c b/libiohelp/get_conch.c
index 64d347ab..e3af6939 100644
--- a/libiohelp/get_conch.c
+++ b/libiohelp/get_conch.c
@@ -29,26 +29,26 @@ iohelp_get_conch (struct conch *c)
if (user_sh)
{
- spin_lock (&user_sh->lock);
+ pthread_spin_lock (&user_sh->lock);
switch (user_sh->conch_status)
{
case USER_HAS_CONCH:
user_sh->conch_status = USER_RELEASE_CONCH;
/* fall through ... */
case USER_RELEASE_CONCH:
- spin_unlock (&user_sh->lock);
- condition_wait (&c->wait, c->lock);
+ pthread_spin_unlock (&user_sh->lock);
+ pthread_cond_wait (&c->wait, c->lock);
/* Anything can have happened */
goto again;
case USER_COULD_HAVE_CONCH:
user_sh->conch_status = USER_HAS_NOT_CONCH;
- spin_unlock (&user_sh->lock);
+ pthread_spin_unlock (&user_sh->lock);
iohelp_fetch_shared_data (c->holder);
break;
case USER_HAS_NOT_CONCH:
- spin_unlock (&user_sh->lock);
+ pthread_spin_unlock (&user_sh->lock);
break;
}
}
diff --git a/libiohelp/handle_io_release_conch.c b/libiohelp/handle_io_release_conch.c
index 8a6bd32d..5be30a66 100644
--- a/libiohelp/handle_io_release_conch.c
+++ b/libiohelp/handle_io_release_conch.c
@@ -25,13 +25,13 @@ iohelp_handle_io_release_conch (struct conch *c, void *user)
{
struct shared_io *user_sh = c->holder_shared_page;
- spin_lock (&user_sh->lock);
+ pthread_spin_lock (&user_sh->lock);
if (c->holder_shared_page->conch_status != USER_HAS_NOT_CONCH)
{
c->holder_shared_page->conch_status = USER_HAS_NOT_CONCH;
iohelp_fetch_shared_data (c->holder);
}
- spin_unlock (&user_sh->lock);
+ pthread_spin_unlock (&user_sh->lock);
if (c->holder == user)
{
@@ -39,6 +39,6 @@ iohelp_handle_io_release_conch (struct conch *c, void *user)
c->holder_shared_page = 0;
}
- condition_broadcast (&c->wait);
+ pthread_cond_broadcast (&c->wait);
}
diff --git a/libiohelp/initialize_conch.c b/libiohelp/initialize_conch.c
index a5d5b76e..2ded2418 100644
--- a/libiohelp/initialize_conch.c
+++ b/libiohelp/initialize_conch.c
@@ -20,10 +20,10 @@
/* Called by an I/O server to initialize a conch structure C;
M will be used to lock conch data structures. */
void
-iohelp_initialize_conch (struct conch *c, struct mutex *m)
+iohelp_initialize_conch (struct conch *c, pthread_mutex_t *m)
{
c->lock = m;
- condition_init (&c->wait);
+ pthread_cond_init (&c->wait, NULL);
c->holder = 0;
c->holder_shared_page = 0;
}
diff --git a/libiohelp/iohelp.h b/libiohelp/iohelp.h
index a52d5985..0597d6c7 100644
--- a/libiohelp/iohelp.h
+++ b/libiohelp/iohelp.h
@@ -20,20 +20,20 @@
#include <mach.h>
#include <hurd/hurd_types.h>
-#include <cthreads.h>
+#include <pthread.h>
#include <hurd/shared.h>
/* Conch manipulation. */
struct conch
{
- struct mutex *lock;
- struct condition wait;
+ pthread_mutex_t *lock;
+ pthread_cond_t wait;
void *holder;
struct shared_io *holder_shared_page;
};
/* Initialize a conch box */
-void iohelp_initialize_conch (struct conch *, struct mutex *);
+void iohelp_initialize_conch (struct conch *, pthread_mutex_t *);
/* These routines are not reentrant. The server is responsible
for ensuring that all calls to these routines are serialized
diff --git a/libiohelp/verify_user_conch.c b/libiohelp/verify_user_conch.c
index c7e3e62e..e975cc88 100644
--- a/libiohelp/verify_user_conch.c
+++ b/libiohelp/verify_user_conch.c
@@ -28,13 +28,13 @@ iohelp_verify_user_conch (struct conch *c, void *user)
if (user != c->holder)
return EPERM;
user_sh = c->holder_shared_page;
- spin_lock (&user_sh->lock);
+ pthread_spin_lock (&user_sh->lock);
if (user_sh->conch_status != USER_HAS_CONCH
&& user_sh->conch_status != USER_RELEASE_CONCH)
{
- spin_unlock (&user_sh->lock);
+ pthread_spin_unlock (&user_sh->lock);
return EPERM;
}
- spin_unlock (&user_sh->lock);
+ pthread_spin_unlock (&user_sh->lock);
return 0;
}