selinux-at, selinux-h: use const correct declarations
[gnulib.git] / lib / se-selinux.in.h
blob67d034d0f8392422f6abf31b35c0c024cc037e86
1 /* Replacement <selinux/selinux.h> for platforms that lack it.
2 Copyright (C) 2008-2020 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program 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 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 #if __GNUC__ >= 3
18 @PRAGMA_SYSTEM_HEADER@
19 #endif
20 @PRAGMA_COLUMNS@
22 #if HAVE_SELINUX_SELINUX_H
24 #@INCLUDE_NEXT@ @NEXT_SELINUX_SELINUX_H@
26 #else
27 # if !defined _@GUARD_PREFIX@_SELINUX_SELINUX_H
28 # define _@GUARD_PREFIX@_SELINUX_SELINUX_H
30 # include <sys/types.h>
31 # include <errno.h>
33 # ifndef _GL_INLINE_HEADER_BEGIN
34 #error "Please include config.h first."
35 # endif
36 _GL_INLINE_HEADER_BEGIN
37 # ifndef SE_SELINUX_INLINE
38 # define SE_SELINUX_INLINE _GL_INLINE
39 # endif
41 /* The definition of _GL_UNUSED_PARAMETER is copied here. */
43 # if !GNULIB_defined_security_types
45 typedef unsigned short security_class_t;
46 struct selinux_opt;
47 # define is_selinux_enabled() 0
49 SE_SELINUX_INLINE int
50 getcon (char **con _GL_UNUSED_PARAMETER)
51 { errno = ENOTSUP; return -1; }
52 SE_SELINUX_INLINE void
53 freecon (char *con _GL_UNUSED_PARAMETER) {}
55 SE_SELINUX_INLINE int
56 getfscreatecon (char **con _GL_UNUSED_PARAMETER)
57 { errno = ENOTSUP; return -1; }
58 SE_SELINUX_INLINE int
59 setfscreatecon (char const *con _GL_UNUSED_PARAMETER)
60 { errno = ENOTSUP; return -1; }
61 SE_SELINUX_INLINE int
62 matchpathcon (char const *file _GL_UNUSED_PARAMETER,
63 mode_t m _GL_UNUSED_PARAMETER,
64 char **con _GL_UNUSED_PARAMETER)
65 { errno = ENOTSUP; return -1; }
66 SE_SELINUX_INLINE int
67 getfilecon (char const *file _GL_UNUSED_PARAMETER,
68 char **con _GL_UNUSED_PARAMETER)
69 { errno = ENOTSUP; return -1; }
70 SE_SELINUX_INLINE int
71 lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
72 char **con _GL_UNUSED_PARAMETER)
73 { errno = ENOTSUP; return -1; }
74 SE_SELINUX_INLINE int
75 fgetfilecon (int fd, char **con _GL_UNUSED_PARAMETER)
76 { errno = ENOTSUP; return -1; }
77 SE_SELINUX_INLINE int
78 setfilecon (char const *file _GL_UNUSED_PARAMETER,
79 char const *con _GL_UNUSED_PARAMETER)
80 { errno = ENOTSUP; return -1; }
81 SE_SELINUX_INLINE int
82 lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
83 char const *con _GL_UNUSED_PARAMETER)
84 { errno = ENOTSUP; return -1; }
85 SE_SELINUX_INLINE int
86 fsetfilecon (int fd _GL_UNUSED_PARAMETER,
87 char const *con _GL_UNUSED_PARAMETER)
88 { errno = ENOTSUP; return -1; }
90 SE_SELINUX_INLINE int
91 security_check_context (char const *con _GL_UNUSED_PARAMETER)
92 { errno = ENOTSUP; return -1; }
93 SE_SELINUX_INLINE int
94 security_check_context_raw (char const *con _GL_UNUSED_PARAMETER)
95 { errno = ENOTSUP; return -1; }
96 SE_SELINUX_INLINE int
97 setexeccon (char const *con _GL_UNUSED_PARAMETER)
98 { errno = ENOTSUP; return -1; }
99 SE_SELINUX_INLINE int
100 security_compute_create (char const *scon _GL_UNUSED_PARAMETER,
101 char const *tcon _GL_UNUSED_PARAMETER,
102 security_class_t tclass _GL_UNUSED_PARAMETER,
103 char **newcon _GL_UNUSED_PARAMETER)
104 { errno = ENOTSUP; return -1; }
105 SE_SELINUX_INLINE security_class_t
106 string_to_security_class (char const *name)
107 { errno = ENOTSUP; return 0; }
108 SE_SELINUX_INLINE int
109 matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
110 char const *prefix _GL_UNUSED_PARAMETER)
111 { errno = ENOTSUP; return -1; }
113 # define GNULIB_defined_security_types 1
114 # endif
116 _GL_INLINE_HEADER_END
118 # endif
119 #endif