openat: work around AIX 7.1 fstatat bug
[gnulib.git] / lib / se-selinux.in.h
1 /* Replacement <selinux/selinux.h> for platforms that lack it.
2    Copyright (C) 2008-2011 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 /* The definition of _GL_UNUSED_PARAMETER is copied here.  */
35
36 #  if !GNULIB_defined_security_types
37
38 typedef unsigned short security_class_t;
39 #   define security_context_t char*
40 #   define is_selinux_enabled() 0
41
42 static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER)
43   { errno = ENOTSUP; return -1; }
44 static inline void freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
45
46
47 static inline int getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
48   { errno = ENOTSUP; return -1; }
49 static inline int setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
50   { errno = ENOTSUP; return -1; }
51 static inline int matchpathcon (char const *file _GL_UNUSED_PARAMETER,
52                                 mode_t m _GL_UNUSED_PARAMETER,
53                                 security_context_t *con _GL_UNUSED_PARAMETER)
54   { errno = ENOTSUP; return -1; }
55 static inline int getfilecon (char const *file _GL_UNUSED_PARAMETER,
56                               security_context_t *con _GL_UNUSED_PARAMETER)
57   { errno = ENOTSUP; return -1; }
58 static inline int lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
59                                security_context_t *con _GL_UNUSED_PARAMETER)
60   { errno = ENOTSUP; return -1; }
61 static inline int fgetfilecon (int fd,
62                                security_context_t *con _GL_UNUSED_PARAMETER)
63   { errno = ENOTSUP; return -1; }
64 static inline int setfilecon (char const *file _GL_UNUSED_PARAMETER,
65                               security_context_t con _GL_UNUSED_PARAMETER)
66   { errno = ENOTSUP; return -1; }
67 static inline int lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
68                                security_context_t con _GL_UNUSED_PARAMETER)
69   { errno = ENOTSUP; return -1; }
70 static inline int fsetfilecon (int fd _GL_UNUSED_PARAMETER,
71                                security_context_t con _GL_UNUSED_PARAMETER)
72   { errno = ENOTSUP; return -1; }
73
74 static inline int security_check_context
75     (security_context_t con _GL_UNUSED_PARAMETER)
76   { errno = ENOTSUP; return -1; }
77 static inline int security_check_context_raw
78     (security_context_t con _GL_UNUSED_PARAMETER)
79   { errno = ENOTSUP; return -1; }
80 static inline int setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
81   { errno = ENOTSUP; return -1; }
82 static inline int security_compute_create
83     (security_context_t scon _GL_UNUSED_PARAMETER,
84      security_context_t tcon _GL_UNUSED_PARAMETER,
85      security_class_t tclass _GL_UNUSED_PARAMETER,
86      security_context_t *newcon _GL_UNUSED_PARAMETER)
87   { errno = ENOTSUP; return -1; }
88 static inline int matchpathcon_init_prefix
89     (char const *path _GL_UNUSED_PARAMETER,
90      char const *prefix _GL_UNUSED_PARAMETER)
91   { errno = ENOTSUP; return -1; }
92
93 #   define GNULIB_defined_security_types 1
94 #  endif
95
96 # endif
97 #endif /* _@GUARD_PREFIX@_SELINUX_SELINUX_H */