rpc_server: Fix a comment
[samba4-gss.git] / third_party / socket_wrapper / socket_wrapper.h
blob3ec5031f7d16d66b7f7fff23476ff55cec90d656
1 /*
2 * BSD 3-Clause License
4 * Copyright (c) 2005-2008, Jelmer Vernooij <jelmer@samba.org>
5 * Copyright (c) 2006-2021, Stefan Metzmacher <metze@samba.org>
6 * Copyright (c) 2013-2021, Andreas Schneider <asn@samba.org>
7 * Copyright (c) 2014-2017, Michael Adam <obnox@samba.org>
8 * Copyright (c) 2016-2018, Anoop C S <anoopcs@redhat.com>
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * 3. Neither the name of the author nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
39 #ifndef __SOCKET_WRAPPER_H__
40 #define __SOCKET_WRAPPER_H__ 1
42 #include <stdbool.h>
45 Socket wrapper advanced helpers.
47 Applications with the need to alter their behaviour when
48 socket wrapper is active, can link use these functions.
50 By default it's required for applications to use any of these
51 functions as libsocket_wrapper.so is injected at runtime via
52 LD_PRELOAD.
54 Applications using these functions should link against
55 libsocket_wrapper_noop.so by using -lsocket_wrapper_noop,
56 or implement their own noop stubs.
60 * This returns true when socket wrapper is actively in use.
62 bool socket_wrapper_enabled(void);
65 * This allows socket_wrapper aware applications to
66 * indicate that the given fd does not belong to
67 * an inet socket.
69 * socket_wrapper may not be able to intercept the __close_nocancel()
70 * syscall made from within libc.so. As result it's possible
71 * that the in memory meta date of socket_wrapper references
72 * stale file descriptors, which are already reused for unrelated
73 * kernel objects, e.g. files, directories, ...
75 * Socket wrapper already intercepts a lot of unrelated
76 * functions like eventfd(), timerfd_create(), ... in order
77 * to remove stale meta data for the returned fd, but
78 * it will never be able to handle all possible syscalls.
80 * socket_wrapper_indicate_no_inet_fd() gives applications a way
81 * to do the same, explicitly without waiting for new syscalls to
82 * be added to libsocket_wrapper.so.
84 * This is a no-op if socket_wrapper is not in use or
85 * if the there is no in memory meta data for the given fd.
87 void socket_wrapper_indicate_no_inet_fd(int fd);
89 #endif /* __SOCKET_WRAPPER_H__ */