xref: /netbsd/lib/librefuse/refuse/session.h (revision fc35b32c)
1*fc35b32cSpho /* $NetBSD: session.h,v 1.1 2022/01/22 07:53:06 pho Exp $ */
2*fc35b32cSpho 
3*fc35b32cSpho /*
4*fc35b32cSpho  * Copyright (c) 2021 The NetBSD Foundation, Inc.
5*fc35b32cSpho  * All rights reserved.
6*fc35b32cSpho  *
7*fc35b32cSpho  * Redistribution and use in source and binary forms, with or without
8*fc35b32cSpho  * modification, are permitted provided that the following conditions
9*fc35b32cSpho  * are met:
10*fc35b32cSpho  * 1. Redistributions of source code must retain the above copyright
11*fc35b32cSpho  *    notice, this list of conditions and the following disclaimer.
12*fc35b32cSpho  * 2. Redistributions in binary form must reproduce the above copyright
13*fc35b32cSpho  *    notice, this list of conditions and the following disclaimer in the
14*fc35b32cSpho  *    documentation and/or other materials provided with the distribution.
15*fc35b32cSpho  * 3. The name of the author may not be used to endorse or promote
16*fc35b32cSpho  *    products derived from this software without specific prior written
17*fc35b32cSpho  *    permission.
18*fc35b32cSpho  *
19*fc35b32cSpho  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20*fc35b32cSpho  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21*fc35b32cSpho  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*fc35b32cSpho  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23*fc35b32cSpho  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*fc35b32cSpho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25*fc35b32cSpho  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*fc35b32cSpho  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*fc35b32cSpho  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28*fc35b32cSpho  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29*fc35b32cSpho  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*fc35b32cSpho  */
31*fc35b32cSpho #if !defined(_FUSE_SESSION_H_)
32*fc35b32cSpho #define _FUSE_SESSION_H_
33*fc35b32cSpho 
34*fc35b32cSpho /* FUSE session API
35*fc35b32cSpho  */
36*fc35b32cSpho 
37*fc35b32cSpho #if !defined(FUSE_H_)
38*fc35b32cSpho #  error Do not include this header directly. Include <fuse.h> instead.
39*fc35b32cSpho #endif
40*fc35b32cSpho 
41*fc35b32cSpho #ifdef __cplusplus
42*fc35b32cSpho extern "C" {
43*fc35b32cSpho #endif
44*fc35b32cSpho 
45*fc35b32cSpho /* Forward declarations */
46*fc35b32cSpho struct fuse;
47*fc35b32cSpho 
48*fc35b32cSpho /* A private structure appeared on FUSE 2.4. */
49*fc35b32cSpho struct fuse_session;
50*fc35b32cSpho 
51*fc35b32cSpho /* Get a session from a fuse object. Appeared on FUSE 2.6. */
52*fc35b32cSpho struct fuse_session *fuse_get_session(struct fuse *f);
53*fc35b32cSpho 
54*fc35b32cSpho /* Get the file descriptor for communicaiton with kernel. Appeared on
55*fc35b32cSpho  * FUSE 3.0. */
56*fc35b32cSpho int fuse_session_fd(struct fuse_session *se);
57*fc35b32cSpho 
58*fc35b32cSpho /* Exit a session on SIGHUP, SIGTERM, and SIGINT and ignore
59*fc35b32cSpho  * SIGPIPE. Appeared on FUSE 2.5. */
60*fc35b32cSpho int fuse_set_signal_handlers(struct fuse_session *se);
61*fc35b32cSpho 
62*fc35b32cSpho /* Restore default signal handlers. Appeared on FUSE 2.5. */
63*fc35b32cSpho void fuse_remove_signal_handlers(struct fuse_session *se);
64*fc35b32cSpho 
65*fc35b32cSpho #ifdef __cplusplus
66*fc35b32cSpho }
67*fc35b32cSpho #endif
68*fc35b32cSpho 
69*fc35b32cSpho #endif
70