summaryrefslogtreecommitdiff
path: root/libmachdev
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-11-25 23:49:29 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-11-25 23:49:29 +0000
commit36318d1929e9437df0402a78ff63a70f78d6a89e (patch)
tree38588eaa8b400d7abf384a17e21dea75b104b177 /libmachdev
parenteaa21da4ea94937a1bc2157c042a233d524d17ce (diff)
parentd261675a592f6109826ccbdb07c7f485c4c88683 (diff)
Merge branch 'dde-upstream' into dde
Conflicts: dde_e100/Makefile dde_e1000/Makefile dde_ne2k_pci/Makefile dde_pcnet32/Makefile dde_rtl8139/Makefile
Diffstat (limited to 'libmachdev')
-rw-r--r--libmachdev/Makefile3
-rw-r--r--libmachdev/dev_hdr.h6
-rw-r--r--libmachdev/ds_routines.c5
-rw-r--r--libmachdev/if_hdr.h6
-rw-r--r--libmachdev/io_req.h10
-rw-r--r--libmachdev/machdev.h2
-rw-r--r--libmachdev/net.c4
-rw-r--r--libmachdev/queue.h14
8 files changed, 26 insertions, 24 deletions
diff --git a/libmachdev/Makefile b/libmachdev/Makefile
index ad090cae..728fe82e 100644
--- a/libmachdev/Makefile
+++ b/libmachdev/Makefile
@@ -25,7 +25,8 @@ LCLHDRS = dev_hdr.h device_emul.h ds_routines.h vm_param.h \
util.h queue.h io_req.h if_ether.h machdev.h linux-errno.h \
errno-base.h
installhdrs = machdev.h
-HURDLIBS = ports threads trivfs ddekit bpf
+HURDLIBS = ports trivfs ddekit bpf
+OTHERLIBS = -lpthread
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
include ../Makeconf
diff --git a/libmachdev/dev_hdr.h b/libmachdev/dev_hdr.h
index f6394256..79edc43a 100644
--- a/libmachdev/dev_hdr.h
+++ b/libmachdev/dev_hdr.h
@@ -59,7 +59,7 @@
#include <mach.h>
#include <hurd.h>
#include <hurd/ports.h>
-#include <cthreads.h>
+#include <pthread.h>
#include "device_emul.h"
@@ -127,7 +127,7 @@ boolean_t dev_map(boolean_t (*)(), mach_port_t);
/*
* To lock and unlock state and open-count
*/
-#define device_lock(device) mutex_lock(&(device)->lock)
-#define device_unlock(device) mutex_unlock(&(device)->lock)
+#define device_lock(device) pthread_mutex_lock(&(device)->lock)
+#define device_unlock(device) pthread_mutex_unlock(&(device)->lock)
#endif /* _DEVICE_DEV_HDR_H_ */
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 6b8d1d4d..63457553 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -59,7 +59,6 @@
#include <hurd.h>
#include <mach.h>
-#include <cthreads.h>
#include <ddekit/thread.h>
@@ -467,7 +466,7 @@ void reg_dev_emul (struct device_emulation_ops *ops)
emulation_list[num_emul++] = ops;
}
-void ds_server()
+void * ds_server(void *arg)
{
/* This thread calls Linux functions,
* so I need to make it known to the Linux environment. */
@@ -478,4 +477,6 @@ void ds_server()
{
ports_manage_port_operations_one_thread (port_bucket, demuxer, 0);
} while (1);
+
+ return NULL;
}
diff --git a/libmachdev/if_hdr.h b/libmachdev/if_hdr.h
index 32497206..b20f7e35 100644
--- a/libmachdev/if_hdr.h
+++ b/libmachdev/if_hdr.h
@@ -61,7 +61,7 @@
#define _IF_HDR_
#include <queue.h>
-#include <cthreads.h>
+#include <pthread.h>
#include <hurd/bpf_impl.h>
#if 0
@@ -94,8 +94,8 @@ struct ifnet {
char *if_address; /* pointer to hardware address */
// struct ifqueue if_snd; /* output queue */
if_filter_list_t port_list;
- struct mutex if_rcv_port_list_lock;/* lock for input filter list */
- struct mutex if_snd_port_list_lock;/* lock for output filter list */
+ pthread_mutex_t if_rcv_port_list_lock;/* lock for input filter list */
+ pthread_mutex_t if_snd_port_list_lock;/* lock for output filter list */
/* statistics */
int if_ipackets; /* packets received */
int if_ierrors; /* input errors */
diff --git a/libmachdev/io_req.h b/libmachdev/io_req.h
index df8d743c..9c810542 100644
--- a/libmachdev/io_req.h
+++ b/libmachdev/io_req.h
@@ -32,7 +32,7 @@
#define _IO_REQ_
#include <mach.h>
-#include <cthreads.h>
+#include <pthread.h>
#include "dev_hdr.h"
@@ -72,7 +72,7 @@ struct io_req {
struct io_req * io_rlink; /* reverse link (for driver header) */
// vm_map_copy_t io_copy; /* vm_map_copy obj. for this op. */
long io_total; /* total op size, for write */
- struct mutex io_req_lock;
+ pthread_mutex_t io_req_lock;
// decl_simple_lock_data(,io_req_lock)
/* Lock for this structure */
long io_physrec; /* mapping to the physical block
@@ -90,8 +90,8 @@ struct io_req {
* happen simultaneously on different processors.
*/
-#define ior_lock(ior) mutex_lock(&(ior)->io_req_lock)
-#define ior_unlock(ior) mutex_unlock(&(ior)->io_req_lock)
+#define ior_lock(ior) pthread_mutex_lock(&(ior)->io_req_lock)
+#define ior_unlock(ior) pthread_mutex_unlock(&(ior)->io_req_lock)
/*
* Flags and operations
@@ -123,7 +123,7 @@ void iodone(io_req_t);
#define io_req_alloc(ior,size) \
MACRO_BEGIN \
(ior) = (io_req_t)malloc(sizeof(struct io_req)); \
- mutex_init(&(ior)->io_req_lock); \
+ pthread_mutex_init(&(ior)->io_req_lock, NULL); \
MACRO_END
#define io_req_free(ior) \
diff --git a/libmachdev/machdev.h b/libmachdev/machdev.h
index cfa4b2d4..b9186fba 100644
--- a/libmachdev/machdev.h
+++ b/libmachdev/machdev.h
@@ -23,7 +23,7 @@
#ifndef __MACHDEV_H__
#define __MACHDEV_H__
-void ds_server(void);
+void * ds_server(void *);
void mach_device_init(void);
void register_net(void);
void register_block(void);
diff --git a/libmachdev/net.c b/libmachdev/net.c
index ed52f0e4..4b4cfe7c 100644
--- a/libmachdev/net.c
+++ b/libmachdev/net.c
@@ -288,8 +288,8 @@ void if_init_queues(ifp)
// IFQ_INIT(&ifp->if_snd);
queue_init(&ifp->port_list.if_rcv_port_list);
queue_init(&ifp->port_list.if_snd_port_list);
- mutex_init(&ifp->if_rcv_port_list_lock);
- mutex_init(&ifp->if_snd_port_list_lock);
+ pthread_mutex_init(&ifp->if_rcv_port_list_lock, NULL);
+ pthread_mutex_init(&ifp->if_snd_port_list_lock, NULL);
}
static io_return_t
diff --git a/libmachdev/queue.h b/libmachdev/queue.h
index 0637dede..86ef74dc 100644
--- a/libmachdev/queue.h
+++ b/libmachdev/queue.h
@@ -35,7 +35,7 @@
#ifndef _KERN_QUEUE_H_
#define _KERN_QUEUE_H_
-#include <cthreads.h>
+#include <pthread.h>
/*
* Queue of abstract objects. Queue is maintained
@@ -337,7 +337,7 @@ void insque(queue_entry_t, queue_entry_t);
*/
struct mpqueue_head {
struct queue_entry head; /* header for queue */
- struct mutex lock; /* lock for queue */
+ pthread_mutex_t lock; /* lock for queue */
};
typedef struct mpqueue_head mpqueue_head_t;
@@ -347,21 +347,21 @@ typedef struct mpqueue_head mpqueue_head_t;
#define mpqueue_init(q) \
{ \
queue_init(&(q)->head); \
- mutex_init(&(q)->lock); \
+ pthread_mutex_init(&(q)->lock, NULL); \
}
#define mpenqueue_tail(q, elt) \
- mutex_lock(&(q)->lock); \
+ pthread_mutex_lock(&(q)->lock); \
enqueue_tail(&(q)->head, elt); \
- mutex_unlock(&(q)->lock);
+ pthread_mutex_unlock(&(q)->lock);
#define mpdequeue_head(q, elt) \
- mutex_lock(&(q)->lock); \
+ pthread_mutex_lock(&(q)->lock); \
if (queue_empty(&(q)->head)) \
*(elt) = 0; \
else \
*(elt) = dequeue_head(&(q)->head); \
- mutex_unlock(&(q)->lock);
+ pthread_mutex_unlock(&(q)->lock);
/*
* Old queue stuff, will go away soon.