From: Nikolaus Rath Date: Sun, 9 Oct 2016 03:04:36 +0000 (-0700) Subject: Add background and multithreading support to hello_ll and fuse_lo-plus X-Git-Tag: fuse-3.0.0rc1~79 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=56690972af25a1fbc60c18c58f757636c0ef0312;p=qemu-gpiodev%2Flibfuse.git Add background and multithreading support to hello_ll and fuse_lo-plus --- diff --git a/example/fuse_lo-plus.c b/example/fuse_lo-plus.c index 1aa97b0..60c2daf 100644 --- a/example/fuse_lo-plus.c +++ b/example/fuse_lo-plus.c @@ -456,13 +456,6 @@ int main(int argc, char *argv[]) ret = 1; goto err_out1; } - if (!opts.foreground) - fprintf(stderr, "Warning: background operation " - "is not supported\n"); - if (!opts.singlethread) - fprintf(stderr, "Warning: multithreading is not " - "supported\n"); - lo.debug = opts.debug; lo.root.next = lo.root.prev = &lo.root; lo.root.fd = open("/", O_PATH); @@ -480,7 +473,13 @@ int main(int argc, char *argv[]) if (fuse_session_mount(se, opts.mountpoint) != 0) goto err_out3; - ret = fuse_session_loop(se); + fuse_daemonize(opts.foreground); + + /* Block until ctrl+c or fusermount -u */ + if (opts.singlethread) + ret = fuse_session_loop(se); + else + ret = fuse_session_loop_mt(se); fuse_session_unmount(se); err_out3: diff --git a/example/hello_ll.c b/example/hello_ll.c index b7e77cd..014b8ca 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -196,12 +196,6 @@ int main(int argc, char *argv[]) ret = 1; goto err_out1; } - if (!opts.foreground) - fprintf(stderr, "Warning: background operation " - "is not supported\n"); - if (!opts.singlethread) - fprintf(stderr, "Warning: multithreading is not " - "supported\n"); se = fuse_session_new(&args, &hello_ll_oper, sizeof(hello_ll_oper), NULL); @@ -214,8 +208,13 @@ int main(int argc, char *argv[]) if (fuse_session_mount(se, opts.mountpoint) != 0) goto err_out3; + fuse_daemonize(opts.foreground); + /* Block until ctrl+c or fusermount -u */ - ret = fuse_session_loop(se); + if (opts.singlethread) + ret = fuse_session_loop(se); + else + ret = fuse_session_loop_mt(se); fuse_session_unmount(se); err_out3: