diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-04-15 19:51:59 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-04-15 19:51:59 +0200 |
commit | d3d6e1d447891889459a691b5cd50fa73fca92d1 (patch) | |
tree | 39b2d49543748ecb30a8f79d0f24864d52ea4c08 | |
parent | 7bcceb243cdb6cb9175a51344b9028370c202845 (diff) | |
download | hurd-d3d6e1d447891889459a691b5cd50fa73fca92d1.tar.gz hurd-d3d6e1d447891889459a691b5cd50fa73fca92d1.tar.bz2 hurd-d3d6e1d447891889459a691b5cd50fa73fca92d1.zip |
libmachdev: Restore making machdev_trivfs_server blocking
netdde actually needs to control which thread runs the trivfs server,
for managing per-thread state etc.
Only pci-arbiter needs to run machdev_trivfs_server non-blockingly, it
can create a thread by itself.
* libmachdev/trivfs_server.c (machdev_trivfs_loop): Move back muxer loop
to...
(machdev_trivfs_server): ... here.
* pci-arbiter/main.c (main): Run machdev_trivfs_server in its own
thread.
* rumpdisk/main.c (main): Do not call pthread_exit().
-rw-r--r-- | libmachdev/trivfs_server.c | 27 | ||||
-rw-r--r-- | pci-arbiter/main.c | 13 | ||||
-rw-r--r-- | rumpdisk/main.c | 2 |
3 files changed, 18 insertions, 24 deletions
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c index e0b51529..bbd73555 100644 --- a/libmachdev/trivfs_server.c +++ b/libmachdev/trivfs_server.c @@ -557,27 +557,11 @@ trivfs_modify_stat (struct trivfs_protid *cred, io_statbuf_t *stat) { } -static void * -machdev_trivfs_loop(void *arg) -{ - struct trivfs_control *fsys = (struct trivfs_control *)arg; - - /* Launch. */ - do - { - ports_manage_port_operations_one_thread (port_bucket, demuxer, 0); - } while (trivfs_goaway (fsys, 0)); - - /* Never reached */ - return 0; -} - void machdev_trivfs_server(mach_port_t bootstrap) { struct trivfs_control *fsys = NULL; int err; - pthread_t t; if (bootstrapping == FALSE) { @@ -594,8 +578,11 @@ machdev_trivfs_server(mach_port_t bootstrap) fsys = control; } - err = pthread_create (&t, NULL, machdev_trivfs_loop, (void *)fsys); - if (err) - error (1, err, "Creating machdev server thread"); - pthread_detach (t); + /* Launch. */ + do + { + ports_manage_port_operations_one_thread (port_bucket, demuxer, 0); + } while (trivfs_goaway (fsys, 0)); + + /* Never reached */ } diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c index 4f4f13da..b2c37f79 100644 --- a/pci-arbiter/main.c +++ b/pci-arbiter/main.c @@ -243,8 +243,17 @@ main (int argc, char **argv) error (1, err, "Starting the PCI system"); if (disk_server_task != MACH_PORT_NULL) - machdev_trivfs_server(bootstrap); - /* Timer started, quickly do all these next, before we call rump_init */ + { + void *run_server(void *arg) { + machdev_trivfs_server(bootstrap); + return NULL; + } + + pthread_t t; + pthread_create(&t, NULL, run_server, NULL); + pthread_detach(t); + /* Timer started, quickly do all these next, before we call rump_init */ + } if (disk_server_task == MACH_PORT_NULL) underlying_node = netfs_startup (bootstrap, O_READ); diff --git a/rumpdisk/main.c b/rumpdisk/main.c index 7f503b51..c5f44fb7 100644 --- a/rumpdisk/main.c +++ b/rumpdisk/main.c @@ -119,7 +119,5 @@ main (int argc, char **argv) return err; pthread_detach (t); machdev_trivfs_server (bootstrap); - /* Let the other threads do their job */ - pthread_exit (NULL); return 0; } |