diff options
Diffstat (limited to 'libcons')
-rw-r--r-- | libcons/Makefile | 3 | ||||
-rw-r--r-- | libcons/cons-switch.c | 9 | ||||
-rw-r--r-- | libcons/cons.h | 4 | ||||
-rw-r--r-- | libcons/dir-changed.c | 8 | ||||
-rw-r--r-- | libcons/file-changed.c | 5 | ||||
-rw-r--r-- | libcons/init-init.c | 3 | ||||
-rw-r--r-- | libcons/vcons-close.c | 6 | ||||
-rw-r--r-- | libcons/vcons-input.c | 5 | ||||
-rw-r--r-- | libcons/vcons-move-mouse.c | 5 | ||||
-rw-r--r-- | libcons/vcons-open.c | 5 | ||||
-rw-r--r-- | libcons/vcons-scrollback.c | 6 |
11 files changed, 33 insertions, 26 deletions
diff --git a/libcons/Makefile b/libcons/Makefile index e0bf62c4..a0df9f63 100644 --- a/libcons/Makefile +++ b/libcons/Makefile @@ -30,7 +30,8 @@ fs_notify-MIGSFLAGS = -imacros $(srcdir)/mutations.h MIGSTUBS = fs_notifyServer.o OBJS = $(sort $(SRCS:.c=.o) $(MIGSTUBS)) -HURDLIBS = threads ports +HURDLIBS = ports +LDLIBS += -lpthread MIGCOMSFLAGS = -prefix cons_ diff --git a/libcons/cons-switch.c b/libcons/cons-switch.c index 752af97e..d8af50af 100644 --- a/libcons/cons-switch.c +++ b/libcons/cons-switch.c @@ -20,6 +20,7 @@ #include <errno.h> #include <assert.h> +#include <pthread.h> #include "cons.h" @@ -36,7 +37,7 @@ cons_switch (vcons_t vcons, int id, int delta, vcons_t *r_vcons) if (!id && !delta) return 0; - mutex_lock (&cons->lock); + pthread_mutex_lock (&cons->lock); if (id) { vcons_entry = cons->vcons_list; @@ -67,14 +68,14 @@ cons_switch (vcons_t vcons, int id, int delta, vcons_t *r_vcons) if (!vcons_entry) { - mutex_unlock (&cons->lock); + pthread_mutex_unlock (&cons->lock); return ESRCH; } if (vcons_entry->vcons) { *r_vcons = vcons_entry->vcons; - mutex_lock (&vcons_entry->vcons->lock); + pthread_mutex_lock (&vcons_entry->vcons->lock); } else { @@ -83,6 +84,6 @@ cons_switch (vcons_t vcons, int id, int delta, vcons_t *r_vcons) vcons_entry->vcons = *r_vcons; } - mutex_unlock (&cons->lock); + pthread_mutex_unlock (&cons->lock); return err; } diff --git a/libcons/cons.h b/libcons/cons.h index e9d01a8c..78675228 100644 --- a/libcons/cons.h +++ b/libcons/cons.h @@ -65,7 +65,7 @@ struct vcons int id; /* The lock that protects all other members. */ - struct mutex lock; + pthread_mutex_t lock; /* The FD of the input node. */ int input; @@ -112,7 +112,7 @@ struct cons { /* Protects the cons structure and the linked list in VCONS_LIST. */ - struct mutex lock; + pthread_mutex_t lock; vcons_list_t vcons_list; vcons_list_t vcons_last; diff --git a/libcons/dir-changed.c b/libcons/dir-changed.c index e1997d0f..8498649c 100644 --- a/libcons/dir-changed.c +++ b/libcons/dir-changed.c @@ -22,7 +22,7 @@ #include <dirent.h> #include <assert.h> #include <mach.h> -#include <cthreads.h> +#include <pthread.h> #include "cons.h" #include "fs_notify_S.h" @@ -69,7 +69,7 @@ cons_S_dir_changed (cons_notify_t notify, natural_t tickno, return EOPNOTSUPP; cons = notify->cons; - mutex_lock (&cons->lock); + pthread_mutex_lock (&cons->lock); switch (change) { @@ -121,9 +121,9 @@ cons_S_dir_changed (cons_notify_t notify, natural_t tickno, case DIR_CHANGED_RENUMBER: default: assert ("Unexpected dir-changed type."); - mutex_unlock (&cons->lock); + pthread_mutex_unlock (&cons->lock); return EINVAL; } - mutex_unlock (&cons->lock); + pthread_mutex_unlock (&cons->lock); return 0; } diff --git a/libcons/file-changed.c b/libcons/file-changed.c index b12a6f10..fa5cebd7 100644 --- a/libcons/file-changed.c +++ b/libcons/file-changed.c @@ -20,6 +20,7 @@ #include <errno.h> #include <assert.h> +#include <pthread.h> #include <mach.h> @@ -37,7 +38,7 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno, if (!notify || notify->cons) return EOPNOTSUPP; - mutex_lock (&vcons->lock); + pthread_mutex_lock (&vcons->lock); switch (change) { case FILE_CHANGED_NULL: @@ -361,6 +362,6 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno, err = EINVAL; }; - mutex_unlock (&vcons->lock); + pthread_mutex_unlock (&vcons->lock); return err; } diff --git a/libcons/init-init.c b/libcons/init-init.c index eda292f5..ea3b37f7 100644 --- a/libcons/init-init.c +++ b/libcons/init-init.c @@ -20,6 +20,7 @@ #include <errno.h> #include <malloc.h> +#include <pthread.h> #include <hurd.h> #include <hurd/ports.h> @@ -53,7 +54,7 @@ cons_init (void) cons = malloc (sizeof (*cons)); if (!cons) return errno; - mutex_init (&cons->lock); + pthread_mutex_init (&cons->lock, NULL); cons->vcons_list = NULL; cons->vcons_last = NULL; cons->dir = opendir (cons_file); diff --git a/libcons/vcons-close.c b/libcons/vcons-close.c index 33a38982..554bfa80 100644 --- a/libcons/vcons-close.c +++ b/libcons/vcons-close.c @@ -22,7 +22,7 @@ #include <hurd.h> #include <hurd/ports.h> -#include <cthreads.h> +#include <pthread.h> #include "cons.h" @@ -33,11 +33,11 @@ cons_vcons_close (vcons_t vcons) cons_t cons = vcons->cons; vcons_list_t vcons_entry = vcons->vcons_entry; - mutex_lock (&cons->lock); + pthread_mutex_lock (&cons->lock); /* The same virtual console should never be opened twice. */ assert (vcons_entry->vcons == vcons); vcons_entry->vcons = NULL; - mutex_unlock (&cons->lock); + pthread_mutex_unlock (&cons->lock); /* Destroy the port. */ ports_port_deref (vcons); diff --git a/libcons/vcons-input.c b/libcons/vcons-input.c index e008b9c9..ccc7532b 100644 --- a/libcons/vcons-input.c +++ b/libcons/vcons-input.c @@ -20,6 +20,7 @@ #include <errno.h> #include <unistd.h> +#include <pthread.h> #include "cons.h" #include "priv.h" @@ -50,7 +51,7 @@ _cons_vcons_input (vcons_t vcons, char *buf, size_t size) error_t cons_vcons_input (vcons_t vcons, char *buf, size_t size) { - mutex_lock (&vcons->lock); + pthread_mutex_lock (&vcons->lock); _cons_vcons_console_event (vcons, CONS_EVT_KEYPRESS); @@ -59,6 +60,6 @@ cons_vcons_input (vcons_t vcons, char *buf, size_t size) _cons_vcons_input (vcons, buf, size); - mutex_unlock (&vcons->lock); + pthread_mutex_unlock (&vcons->lock); return 0; } diff --git a/libcons/vcons-move-mouse.c b/libcons/vcons-move-mouse.c index 1e5f7b9f..6c74d9fc 100644 --- a/libcons/vcons-move-mouse.c +++ b/libcons/vcons-move-mouse.c @@ -20,6 +20,7 @@ #include <errno.h> #include <unistd.h> +#include <pthread.h> #include "cons.h" #include "priv.h" @@ -33,7 +34,7 @@ cons_vcons_move_mouse (vcons_t vcons, mouse_event_t ev) char event[CONS_MOUSE_EVENT_LENGTH]; uint32_t report_events; - mutex_lock (&vcons->lock); + pthread_mutex_lock (&vcons->lock); report_events = vcons->display->flags & CONS_FLAGS_TRACK_MOUSE; switch (ev->mouse_movement) @@ -98,6 +99,6 @@ cons_vcons_move_mouse (vcons_t vcons, mouse_event_t ev) } } - mutex_unlock (&vcons->lock); + pthread_mutex_unlock (&vcons->lock); return 0; } diff --git a/libcons/vcons-open.c b/libcons/vcons-open.c index 8c34fc5e..22d64303 100644 --- a/libcons/vcons-open.c +++ b/libcons/vcons-open.c @@ -23,6 +23,7 @@ #include <stdio.h> #include <sys/mman.h> #include <sys/fcntl.h> +#include <pthread.h> #include <hurd.h> #include <mach.h> @@ -55,7 +56,7 @@ cons_vcons_open (cons_t cons, vcons_list_t vcons_entry, vcons_t *r_vcons) vcons->cons = cons; vcons->vcons_entry = vcons_entry; vcons->id = vcons_entry->id; - mutex_init (&vcons->lock); + pthread_mutex_init (&vcons->lock, NULL); vcons->input = -1; vcons->display = MAP_FAILED; vcons->scrolling = 0; @@ -138,7 +139,7 @@ cons_vcons_open (cons_t cons, vcons_list_t vcons_entry, vcons_t *r_vcons) /* When this succeeds, we will immediately receive notification messages for this virtual console. */ - mutex_lock (&vcons->lock); + pthread_mutex_lock (&vcons->lock); err = file_notice_changes (file, notify, MACH_MSG_TYPE_MAKE_SEND); if (!err) { diff --git a/libcons/vcons-scrollback.c b/libcons/vcons-scrollback.c index 77c8c211..625fc4b5 100644 --- a/libcons/vcons-scrollback.c +++ b/libcons/vcons-scrollback.c @@ -20,7 +20,7 @@ #include <stdint.h> -#include <cthreads.h> +#include <pthread.h> #include "cons.h" #include "priv.h" @@ -154,11 +154,11 @@ cons_vcons_scrollback (vcons_t vcons, cons_scroll_t type, float value) { int ret; - mutex_lock (&vcons->lock); + pthread_mutex_lock (&vcons->lock); ret = _cons_vcons_scrollback (vcons, type, value); _cons_vcons_console_event (vcons, CONS_EVT_OUTPUT); cons_vcons_update (vcons); - mutex_unlock (&vcons->lock); + pthread_mutex_unlock (&vcons->lock); return ret; } |