cuse.3 (58a8f6e9ecabba975f2cda8416bcc36c2073a7a8) cuse.3 (280f34c37cc8947527da23e2612d436f1873fce5)
1.\" $FreeBSD$
2.\"
1.\" $FreeBSD$
2.\"
3.\" Copyright (c) 2010-2013 Hans Petter Selasky
3.\" Copyright (c) 2010-2022 Hans Petter Selasky
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd April 17, 2019
28.Dd July 18, 2022
29.Dt CUSE 3
30.Os
31.Sh NAME
32.Nm libcuse
33.Nd "Userland character device library"
34.Sh LIBRARY
35.Lb libcuse
36.Sh SYNOPSIS

--- 82 unchanged lines hidden (view full) ---

119.Ar size
120bytes of memory.
121Only memory allocated by this function can be memory
122mapped by
123.Xr mmap 2 .
124This function returns a valid data pointer on success or
125.Dv NULL
126on failure.
29.Dt CUSE 3
30.Os
31.Sh NAME
32.Nm libcuse
33.Nd "Userland character device library"
34.Sh LIBRARY
35.Lb libcuse
36.Sh SYNOPSIS

--- 82 unchanged lines hidden (view full) ---

119.Ar size
120bytes of memory.
121Only memory allocated by this function can be memory
122mapped by
123.Xr mmap 2 .
124This function returns a valid data pointer on success or
125.Dv NULL
126on failure.
127The returned pointer is always aligned to the system page size.
128The number and size of allocations is limited by the
129.Xr mmap 2
130offset having to fit into a 32-bit variable typically for 32-bit
131applications.
127.Pp
128.Ft "int"
129.Fn "cuse_is_vmalloc_addr" "void *"
130This function returns non-zero if the passed pointer points to a valid
131and non-freed allocation, as returned by
132.Fn cuse_vmalloc .
133Else this function returns zero.
134.Pp
135.Ft "void"
136.Fn "cuse_vmfree" "void *"
137This function frees memory allocated by
138.Fn cuse_vmalloc .
139This function is NULL safe.
132.Pp
133.Ft "int"
134.Fn "cuse_is_vmalloc_addr" "void *"
135This function returns non-zero if the passed pointer points to a valid
136and non-freed allocation, as returned by
137.Fn cuse_vmalloc .
138Else this function returns zero.
139.Pp
140.Ft "void"
141.Fn "cuse_vmfree" "void *"
142This function frees memory allocated by
143.Fn cuse_vmalloc .
144This function is NULL safe.
140Note that the
141cuse library will internally not free the memory until the
142.Fn cuse_uninit
143function is called and that the number of unique
144allocations is limited.
145.Pp
146.Ft "unsigned long"
147.Fn "cuse_vmoffset" "void *"
145.Pp
146.Ft "unsigned long"
147.Fn "cuse_vmoffset" "void *"
148This function returns the mmap offset that the client must use to
148This function returns the mmap offset the client must use to
149access the allocated memory.
149access the allocated memory.
150The passed pointer must be aligned to the system page size.
150.Pp
151.Ft "struct cuse_dev *"
152.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..."
153This function creates a new character device according to the given
154parameters.
155This function returns a valid cuse_dev structure pointer
156on success or
157.Dv NULL

--- 234 unchanged lines hidden ---
151.Pp
152.Ft "struct cuse_dev *"
153.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..."
154This function creates a new character device according to the given
155parameters.
156This function returns a valid cuse_dev structure pointer
157on success or
158.Dv NULL

--- 234 unchanged lines hidden ---