62a5d867478df2683671df8db01af1402e03b02b
[gnulib.git] / lib / se-selinux.in.h
1 /* Replacement <selinux/selinux.h> for platforms that lack it.
2    Copyright (C) 2008-2013 Free Software Foundation, Inc.
3
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.
8
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.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef _@GUARD_PREFIX@_SELINUX_SELINUX_H
18 # define _@GUARD_PREFIX@_SELINUX_SELINUX_H
19
20 # if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 # endif
23 @PRAGMA_COLUMNS@
24
25 # if HAVE_SELINUX_SELINUX_H
26
27 #@INCLUDE_NEXT@ @NEXT_SELINUX_SELINUX_H@
28
29 # else
30
31 #  include <sys/types.h>
32 #  include <errno.h>
33
34 #ifndef _GL_INLINE_HEADER_BEGIN
35  #error "Please include config.h first."
36 #endif
37 _GL_INLINE_HEADER_BEGIN
38 #  ifndef SE_SELINUX_INLINE
39 #   define SE_SELINUX_INLINE _GL_INLINE
40 #  endif
41
42 /* The definition of _GL_UNUSED_PARAMETER is copied here.  */
43
44 #  if !GNULIB_defined_security_types
45
46 typedef unsigned short security_class_t;
47 #   define security_context_t char*
48 #   define is_selinux_enabled() 0
49
50 SE_SELINUX_INLINE int
51 getcon (security_context_t *con _GL_UNUSED_PARAMETER)
52   { errno = ENOTSUP; return -1; }
53 SE_SELINUX_INLINE void
54 freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
55
56 SE_SELINUX_INLINE int
57 getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
58   { errno = ENOTSUP; return -1; }
59 SE_SELINUX_INLINE int
60 setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
61   { errno = ENOTSUP; return -1; }
62 SE_SELINUX_INLINE int
63 matchpathcon (char const *file _GL_UNUSED_PARAMETER,
64               mode_t m _GL_UNUSED_PARAMETER,
65   security_context_t *con _GL_UNUSED_PARAMETER)
66   { errno = ENOTSUP; return -1; }
67 SE_SELINUX_INLINE int
68 getfilecon (char const *file _GL_UNUSED_PARAMETER,
69             security_context_t *con _GL_UNUSED_PARAMETER)
70   { errno = ENOTSUP; return -1; }
71 SE_SELINUX_INLINE int
72 lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
73              security_context_t *con _GL_UNUSED_PARAMETER)
74   { errno = ENOTSUP; return -1; }
75 SE_SELINUX_INLINE int
76 fgetfilecon (int fd, security_context_t *con _GL_UNUSED_PARAMETER)
77   { errno = ENOTSUP; return -1; }
78 SE_SELINUX_INLINE int
79 setfilecon (char const *file _GL_UNUSED_PARAMETER,
80             security_context_t con _GL_UNUSED_PARAMETER)
81   { errno = ENOTSUP; return -1; }
82 SE_SELINUX_INLINE int
83 lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
84              security_context_t con _GL_UNUSED_PARAMETER)
85   { errno = ENOTSUP; return -1; }
86 SE_SELINUX_INLINE int
87 fsetfilecon (int fd _GL_UNUSED_PARAMETER,
88              security_context_t con _GL_UNUSED_PARAMETER)
89   { errno = ENOTSUP; return -1; }
90
91 SE_SELINUX_INLINE int
92 security_check_context (security_context_t con _GL_UNUSED_PARAMETER)
93   { errno = ENOTSUP; return -1; }
94 SE_SELINUX_INLINE int
95 security_check_context_raw (security_context_t con _GL_UNUSED_PARAMETER)
96   { errno = ENOTSUP; return -1; }
97 SE_SELINUX_INLINE int
98 setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
99   { errno = ENOTSUP; return -1; }
100 SE_SELINUX_INLINE int
101 security_compute_create (security_context_t scon _GL_UNUSED_PARAMETER,
102                          security_context_t tcon _GL_UNUSED_PARAMETER,
103                          security_class_t tclass _GL_UNUSED_PARAMETER,
104                          security_context_t *newcon _GL_UNUSED_PARAMETER)
105   { errno = ENOTSUP; return -1; }
106 SE_SELINUX_INLINE int
107 matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
108                           char const *prefix _GL_UNUSED_PARAMETER)
109   { errno = ENOTSUP; return -1; }
110
111 #   define GNULIB_defined_security_types 1
112 #  endif
113
114 #ifndef _GL_INLINE_HEADER_BEGIN
115  #error "Please include config.h first."
116 #endif
117 _GL_INLINE_HEADER_BEGIN
118
119 # endif
120 #endif /* _@GUARD_PREFIX@_SELINUX_SELINUX_H */