exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / se-label.in.h
blobce1ac335e17a7bf0f79822598019a66957f19584
1 /* Replacement <selinux/label.h> for platforms that lack it.
2 Copyright 2020-2024 Free Software Foundation, Inc.
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Paul Eggert. */
19 #ifndef SELINUX_LABEL_H
20 #define SELINUX_LABEL_H
22 /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
23 _GL_ATTRIBUTE_MAYBE_UNUSED. */
24 #if !_GL_CONFIG_H_INCLUDED
25 #error "Please include config.h first."
26 #endif
28 #include <selinux/selinux.h>
29 #include <errno.h>
31 _GL_INLINE_HEADER_BEGIN
32 #ifndef SE_LABEL_INLINE
33 # define SE_LABEL_INLINE _GL_INLINE
34 #endif
36 /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
37 the entity is not used. The compiler should not warn if the entity is not
38 used. */
39 #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
40 # if 0 /* no GCC or clang version supports this yet */
41 # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
42 # elif defined __GNUC__ || defined __clang__
43 # define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
44 # else
45 # define _GL_ATTRIBUTE_MAYBE_UNUSED
46 # endif
47 #endif
49 #define SELABEL_CTX_FILE 0
51 struct selabel_handle;
53 SE_LABEL_INLINE int
54 selabel_lookup (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd,
55 _GL_ATTRIBUTE_MAYBE_UNUSED char **context,
56 _GL_ATTRIBUTE_MAYBE_UNUSED char const *key,
57 _GL_ATTRIBUTE_MAYBE_UNUSED int type)
58 { errno = ENOTSUP; return -1; }
60 SE_LABEL_INLINE int
61 selabel_lookup_raw (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd,
62 _GL_ATTRIBUTE_MAYBE_UNUSED char **context,
63 _GL_ATTRIBUTE_MAYBE_UNUSED char const *key,
64 _GL_ATTRIBUTE_MAYBE_UNUSED int type)
65 { errno = ENOTSUP; return -1; }
67 SE_LABEL_INLINE struct selabel_handle *
68 selabel_open (_GL_ATTRIBUTE_MAYBE_UNUSED int backend,
69 _GL_ATTRIBUTE_MAYBE_UNUSED struct selinux_opt *options,
70 _GL_ATTRIBUTE_MAYBE_UNUSED unsigned nopt)
71 { errno = ENOTSUP; return 0; }
73 SE_LABEL_INLINE void
74 selabel_close (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd)
75 { errno = ENOTSUP; }
77 _GL_INLINE_HEADER_END
79 #endif