jcs's openbsd hax
openbsd
1.\" $OpenBSD: fuse_session_loop.3,v 1.1 2026/02/01 20:02:58 helg Exp $
2.\"
3.\" Copyright (c) 2026 Helg Bredow <helg@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: February 1 2026 $
18.Dt FUSE_SESSION_LOOP 3
19.Os
20.Sh NAME
21.Nm fuse_session_loop ,
22.Nm fuse_session_process ,
23.Nm fuse_session_add_chan ,
24.Nm fuse_session_remove_chan ,
25.Nm fuse_session_exit ,
26.Nm fuse_session_exited ,
27.Nm fuse_session_reset
28.Nd manage lifecycle and event handling for a FUSE session
29.Sh SYNOPSIS
30.Lb fuse
31.In fuse_lowlevel.h
32.Ft int
33.Fn fuse_session_loop "struct fuse_session *se"
34.Ft void
35.Fo fuse_session_process
36.Fa "struct fuse_session *se"
37.Fa "struct fuse_chan *ch"
38.Fa "const struct fuse_buf *buf"
39.Fa "struct fuse_buf *outbuf"
40.Fc
41.Ft void
42.Fo fuse_session_add_chan
43.Fa "struct fuse_session *se"
44.Fa "struct fuse_chan *ch"
45.Fc
46.Ft void
47.Fn fuse_session_remove_chan "struct fuse_chan *ch"
48.Ft void
49.Fn fuse_session_exit "struct fuse_session *se"
50.Ft int
51.Fn fuse_session_exited "struct fuse_session *se"
52.Ft void
53.Fn fuse_session_reset "struct fuse_session *se"
54.Sh DESCRIPTION
55These functions are part of the FUSE low-level API and are used to manage the
56lifecycle, communication channel, and event processing of a FUSE session.
57.Pp
58A fuse_session is created with
59.Xr fuse_lowlevel_new 3 .
60.Bl -tag -width Ds
61.It Fn fuse_session_loop "se"
62Run the main event loop for the session
63.Fa se .
64This function blocks and processes incoming requests until
65.Fn fuse_session_exit
66is called.
67.It Fn fuse_session_process "se" "buf" "bufsize" "ch"
68Process a single buffer
69.Fa buf
70received from channel
71.Fa ch
72in the session
73.Fa se .
74If ch is
75.Dv NULL
76then the channel added to the session is used instead.
77Used for manual request handling outside of the main loop.
78.It Fn fuse_session_add_chan "se" "ch"
79Add the communication channel
80.Fa ch
81to the session
82.Fa se .
83Channels are used to receive requests from the kernel.
84A session may be associated with only one channel at a time, and a channel
85may be associated with only one session at a time.
86.It Fn fuse_session_remove_chan "ch"
87Remove the channel
88.Fa ch
89from its associated session.
90.It Fn fuse_session_exit "se"
91Signal the session
92.Fa se
93to exit its event loop.
94This does not destroy the session or unmount the filesystem.
95.It Fn fuse_session_reset "se"
96Reset the session
97.Fa se
98to a non-exited state, allowing the loop to be restarted.
99.El
100.Sh RETURN VALUES
101.Fn fuse_session_loop
102returns 0 on success or -1 on failure.
103.Pp
104.Fn fuse_session_exited
105Returns non-zero if
106.Fn fuse_session_exit
107has been called and the session
108.Fa se
109is marked for termination.
110.Sh SEE ALSO
111.Xr fuse_chan_fd 3 ,
112.Xr fuse_lowlevel_new 3 ,
113.Xr fuse_mount 3
114.Sh STANDARDS
115These library functions conform to FUSE 2.6.
116.Sh HISTORY
117These functions have been available since
118.Ox 7.9 .
119.Sh AUTHORS
120.An Helg Bredow Aq Mt helg@openbsd.org