diff options
author | Zheng Da <zhengda1936@gmail.com> | 2010-02-05 15:04:14 +0100 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2010-02-05 15:04:14 +0100 |
commit | 9b35bbf6dfccface4eb2878f0a45d158eadae511 (patch) | |
tree | 2bd59630243fb2aa1bfca30ef1ff42a3cb92fa02 /libmachdev/ds_routines.c | |
parent | db1709c923475daedc00424824bb5e6094bc09f7 (diff) |
create a thread for only handling device requests.
Diffstat (limited to 'libmachdev/ds_routines.c')
-rw-r--r-- | libmachdev/ds_routines.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c index 1cd06359..9152c72e 100644 --- a/libmachdev/ds_routines.c +++ b/libmachdev/ds_routines.c @@ -68,8 +68,8 @@ #include "util.h" #include "queue.h" -struct port_bucket *port_bucket; -struct port_class *dev_class; +static struct port_bucket *port_bucket; +static struct port_class *dev_class; extern struct device_emulation_ops linux_net_emulation_ops; @@ -783,6 +783,12 @@ static any_t io_done_thread(any_t unused) return 0; } +int create_device_port (int size, void *result) +{ + return ports_create_port (dev_class, port_bucket, + size, result); +} + void mach_device_init() { int i; @@ -800,3 +806,22 @@ void mach_device_init() cthread_detach (cthread_fork (io_done_thread, 0)); } + +static int +demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp) +{ + int ret; + extern int device_server (mach_msg_header_t *, mach_msg_header_t *); + extern int notify_server (mach_msg_header_t *, mach_msg_header_t *); + ret = device_server (inp, outp) || notify_server (inp, outp); + return ret; +} + +void ds_server() +{ + /* Launch. */ + do + { + ports_manage_port_operations_one_thread (port_bucket, demuxer, 0); + } while (1); +} |