Applied, thanks!
Samuel
Damien Zammit, le mar. 02 mars 2021 22:41:35 +1100, a ecrit:
> ---
> libmachdev/trivfs_server.c | 31 ++++++++++++++++++++++++-------
> 1 file changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
> index 3ab15049..06756f82 100644
> --- a/libmachdev/trivfs_server.c
> +++ b/libmachdev/trivfs_server.c
> @@ -398,7 +398,8 @@ machdev_trivfs_init(mach_port_t bootstrap_resume_task,
> const char *name, const c
> if (path)
> devnode = strdup(path);
> resume_bootstrap_server(bootstrap_resume_task, name);
> - *bootstrap = MACH_PORT_NULL;
> + *bootstrap = ports_get_send_right (&control->pi);
> +
> /* We need to install as a translator later */
> bootstrapped = TRUE;
> }
> @@ -479,13 +480,29 @@ 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 (bootstrap != MACH_PORT_NULL)
> + if (bootstrapped == FALSE)
> {
> /* This path is executed when a parent exists */
> err = trivfs_startup (bootstrap, 0,
> @@ -500,9 +517,9 @@ machdev_trivfs_server(mach_port_t bootstrap)
> fsys = control;
> }
>
> - /* Launch. */
> - do
> - {
> - ports_manage_port_operations_one_thread (port_bucket, demuxer, 0);
> - } while (trivfs_goaway (fsys, 0));
> + err = pthread_create (&t, NULL, machdev_trivfs_loop, (void *)fsys);
> + if (err)
> + error (1, err, "Creating machdev server thread");
> + pthread_detach (t);
> }
> +
> --
> 2.30.0
>
>
--
Samuel
quit When the quit statement is read, the bc processor
is terminated, regardless of where the quit state-
ment is found. For example, "if (0 == 1) quit"
will cause bc to terminate.
(Seen in the manpage for "bc". Note the "if" statement's logic)