diff options
Diffstat (limited to 'exec')
-rw-r--r-- | exec/Makefile | 3 | ||||
-rw-r--r-- | exec/exec.c | 36 | ||||
-rw-r--r-- | exec/hashexec.c | 4 | ||||
-rw-r--r-- | exec/priv.h | 4 |
4 files changed, 24 insertions, 23 deletions
diff --git a/exec/Makefile b/exec/Makefile index 92b4d480..3fc82739 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -33,7 +33,8 @@ bzip2-objects = $(bzip2-sources:%.c=%.o) target = exec #targets = exec exec.static #OTHERLIBS = -lbfd -liberty -HURDLIBS = trivfs fshelp iohelp threads ports ihash shouldbeinlibc +HURDLIBS = trivfs fshelp iohelp ports ihash shouldbeinlibc +OTHERLIBS = -lpthread exec-MIGSFLAGS = -imacros $(srcdir)/execmutations.h diff --git a/exec/exec.c b/exec/exec.c index 4c2fcec1..a4f2f748 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -47,7 +47,7 @@ mach_port_t procserver; /* Our proc port. */ mach_port_t *std_ports; int *std_ints; size_t std_nports, std_nints; -struct rwlock std_lock = RWLOCK_INITIALIZER; +pthread_rwlock_t std_lock = PTHREAD_RWLOCK_INITIALIZER; #ifdef BFD @@ -762,19 +762,19 @@ prepare (file_t file, struct execdata *e) if (e->cntl) while (1) { - spin_lock (&e->cntl->lock); + pthread_spin_lock (&e->cntl->lock); switch (e->cntl->conch_status) { case USER_COULD_HAVE_CONCH: e->cntl->conch_status = USER_HAS_CONCH; case USER_HAS_CONCH: - spin_unlock (&e->cntl->lock); + pthread_spin_unlock (&e->cntl->lock); /* Break out of the loop. */ break; case USER_RELEASE_CONCH: case USER_HAS_NOT_CONCH: default: /* Oops. */ - spin_unlock (&e->cntl->lock); + pthread_spin_unlock (&e->cntl->lock); e->error = io_get_conch (e->file); if (e->error) return; @@ -974,16 +974,16 @@ finish_mapping (struct execdata *e) { if (e->cntl != NULL) { - spin_lock (&e->cntl->lock); + pthread_spin_lock (&e->cntl->lock); if (e->cntl->conch_status == USER_RELEASE_CONCH) { - spin_unlock (&e->cntl->lock); + pthread_spin_unlock (&e->cntl->lock); io_release_conch (e->file); } else { e->cntl->conch_status = USER_HAS_NOT_CONCH; - spin_unlock (&e->cntl->lock); + pthread_spin_unlock (&e->cntl->lock); } munmap (e->cntl, vm_page_size); e->cntl = NULL; @@ -1394,13 +1394,13 @@ do_exec (file_t file, if (e->error == ENOEXEC) { /* See if it is a compressed image. */ - static struct mutex lock = MUTEX_INITIALIZER; + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; /* The gzip code is really cheesy, not even close to thread-safe. So we serialize all uses of it. */ - mutex_lock (&lock); + pthread_mutex_lock (&lock); e->error = 0; check_gzip (e); - mutex_unlock (&lock); + pthread_mutex_unlock (&lock); if (e->error == 0) /* The file was uncompressed into memory, and now E describes the uncompressed image rather than the actual file. Check it again @@ -1412,13 +1412,13 @@ do_exec (file_t file, if (e->error == ENOEXEC) { /* See if it is a compressed image. */ - static struct mutex lock = MUTEX_INITIALIZER; + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; /* The bzip2 code is really cheesy, not even close to thread-safe. So we serialize all uses of it. */ - mutex_lock (&lock); + pthread_mutex_lock (&lock); e->error = 0; check_bzip2 (e); - mutex_unlock (&lock); + pthread_mutex_unlock (&lock); if (e->error == 0) /* The file was uncompressed into memory, and now E describes the uncompressed image rather than the actual file. Check it again @@ -1505,7 +1505,7 @@ do_exec (file_t file, newtask = oldtask; - rwlock_reader_lock (&std_lock); + pthread_rwlock_rdlock (&std_lock); { /* Store the data that we will give in response to the RPC on the new task's bootstrap port. */ @@ -1550,7 +1550,7 @@ do_exec (file_t file, if (boot == NULL) { stdout: - rwlock_reader_unlock (&std_lock); + pthread_rwlock_unlock (&std_lock); goto out; } bzero (&boot->pi + 1, (char *) &boot[1] - (char *) (&boot->pi + 1)); @@ -1675,7 +1675,7 @@ do_exec (file_t file, && boot->portarray[INIT_PORT_CWDIR] == MACH_PORT_NULL) use (INIT_PORT_CWDIR, std_ports[INIT_PORT_CWDIR], 1, 0); } - rwlock_reader_unlock (&std_lock); + pthread_rwlock_unlock (&std_lock); /* We have now concocted in BOOT the complete Hurd context (ports and @@ -2192,7 +2192,7 @@ S_exec_setexecdata (struct trivfs_protid *protid, return err; } - rwlock_writer_lock (&std_lock); + pthread_rwlock_wrlock (&std_lock); if (std_ports) { @@ -2211,7 +2211,7 @@ S_exec_setexecdata (struct trivfs_protid *protid, std_ints = ints; std_nints = nints; - rwlock_writer_unlock (&std_lock); + pthread_rwlock_unlock (&std_lock); return 0; } diff --git a/exec/hashexec.c b/exec/hashexec.c index 2aa3844b..e20a462e 100644 --- a/exec/hashexec.c +++ b/exec/hashexec.c @@ -205,7 +205,7 @@ check_hashbang (struct execdata *e, user_crdir = user_cwdir = MACH_PORT_NULL; - rwlock_reader_lock (&std_lock); + pthread_rwlock_rdlock (&std_lock); /* Open a port on the interpreter file. */ e->error = lookup (interp, O_EXEC, &interp_file); @@ -404,7 +404,7 @@ check_hashbang (struct execdata *e, &setup_args, &fault_handler); } - rwlock_reader_unlock (&std_lock); + pthread_rwlock_unlock (&std_lock); if (user_crdir != MACH_PORT_NULL) mach_port_deallocate (mach_task_self (), user_crdir); diff --git a/exec/priv.h b/exec/priv.h index 7cee15e4..dbecb7a9 100644 --- a/exec/priv.h +++ b/exec/priv.h @@ -26,7 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <hurd/trivfs.h> #include <hurd/ports.h> #include <hurd/lookup.h> -#include <rwlock.h> +#include <pthread.h> #ifdef BFD #include <bfd.h> @@ -186,7 +186,7 @@ void check_hashbang (struct execdata *e, extern mach_port_t *std_ports; extern int *std_ints; extern size_t std_nports, std_nints; -extern struct rwlock std_lock; +extern pthread_rwlock_t std_lock; #endif /* exec_priv_h */ |