jcs's openbsd hax
openbsd
1.\" $OpenBSD: fuse_setup.3,v 1.5 2025/09/23 09:28:28 schwarze Exp $
2.\"
3.\" Copyright (c) 2018 Helg Bredow <helg.bredow@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: September 23 2025 $
18.Dt FUSE_SETUP 3
19.Os
20.Sh NAME
21.Nm fuse_setup
22.Nd FUSE helper function
23.Sh SYNOPSIS
24.Lb libfuse
25.In fuse.h
26.Ft struct fuse *
27.Fn fuse_setup "int argc" "char **argv" \
28 "const struct fuse_operations *ops" "size_t size" "char **mp" \
29 "int *mt" "void *data"
30.Sh DESCRIPTION
31.Fn fuse_setup
32is a helper function that mounts a FUSE file system, creates a new FUSE
33session and installs signal handlers that will try to unmount the file
34system on
35.Dv SIGINT ,
36.Dv SIGTERM ,
37or
38.Dv SIGHUP .
39.Pp
40.Fn fuse_setup
41parses the arguments specified by
42.Fa argv ,
43and if neither the
44.Fl f ,
45.Fl d ,
46or
47.Fl odebug
48options were specified, detaches from the controlling terminal
49and runs in the background.
50On success,
51.Fa mt
52is set to 1 if the file system operations will be invoked in
53parallel (multi-threaded) or to 0 if file system operations are serialized.
54File systems that do not support multi-threaded operation must include the
55.Fl s
56argument in
57.Fa argv .
58.Ox
59does not currently support multi-threaded operation.
60.Pp
61The file system will be mounted on
62.Fa mp ,
63which is the directory specified by the first
64argument that does not match one of the options recognised by
65.Xr fuse_parse_cmdline 3 .
66.Pp
67.Fa fuse_operations
68is a struct of size
69.Fa size
70that contains pointers to FUSE file system operations.
71See
72.Xr fuse_new 3 .
73.Sh RETURN VALUES
74.Fn fuse_setup
75returns
76.Dv NULL
77on failure.
78.Sh SEE ALSO
79.Xr fuse_main 3 ,
80.Xr fuse_mount 3 ,
81.Xr fuse_new 3 ,
82.Xr fuse_parse_cmdline 3 ,
83.Xr fuse_set_signal_handlers 3 ,
84.Xr fuse_teardown 3 ,
85.Xr fuse 4
86.Sh STANDARDS
87The
88.Fn fuse_setup
89function conforms to FUSE 2.6.
90.Sh HISTORY
91The
92.Fn fuse_setup
93function first appeared in
94.Ox 5.4 .
95.Sh AUTHORS
96.An Sylvestre Gallon Aq Mt ccna.syl@gmail.com
97.An Helg Bredow Aq Mt helg@openbsd.org