1 /* SELinux-related headers.
2 Copyright (C) 2007-2022 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>. */
16
17 /* Written by Jim Meyering, 2007. */
18
19 #ifndef SELINUX_CONTEXT_H
20 # define SELINUX_CONTEXT_H
21
22 # include <errno.h>
23
24 #ifndef _GL_INLINE_HEADER_BEGIN
25 #error "Please include config.h first."
26 #endif
27 _GL_INLINE_HEADER_BEGIN
28 #ifndef SE_CONTEXT_INLINE
29 # define SE_CONTEXT_INLINE _GL_INLINE
30 #endif
31
32 /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
33 the entity is not used. The compiler should not warn if the entity is not
34 used. */
35 #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
36 # if 0 /* no GCC or clang version supports this yet */
37 # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
38 # elif defined __GNUC__ || defined __clang__
39 # define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
40 # else
41 # define _GL_ATTRIBUTE_MAYBE_UNUSED
42 # endif
43 #endif
44
45 typedef int context_t;
46 SE_CONTEXT_INLINE context_t
47 context_new (_GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
48 { errno = ENOTSUP; return 0; }
49 SE_CONTEXT_INLINE char *
50 context_str (_GL_ATTRIBUTE_MAYBE_UNUSED context_t con)
51 { errno = ENOTSUP; return (void *) 0; }
52 SE_CONTEXT_INLINE void context_free (_GL_ATTRIBUTE_MAYBE_UNUSED context_t c) {}
53
54 SE_CONTEXT_INLINE int
55 context_user_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
56 _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
57 { errno = ENOTSUP; return -1; }
58 SE_CONTEXT_INLINE int
59 context_role_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
60 _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
61 { errno = ENOTSUP; return -1; }
62 SE_CONTEXT_INLINE int
63 context_range_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
64 _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
65 { errno = ENOTSUP; return -1; }
66 SE_CONTEXT_INLINE int
67 context_type_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
68 _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
69 { errno = ENOTSUP; return -1; }
70 SE_CONTEXT_INLINE char *
71 context_type_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
72 { errno = ENOTSUP; return (void *) 0; }
73 SE_CONTEXT_INLINE char *
74 context_range_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
75 { errno = ENOTSUP; return (void *) 0; }
76 SE_CONTEXT_INLINE char *
77 context_role_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
78 { errno = ENOTSUP; return (void *) 0; }
79 SE_CONTEXT_INLINE char *
80 context_user_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
81 { errno = ENOTSUP; return (void *) 0; }
82
83 _GL_INLINE_HEADER_END
84
85 #endif