| 1 | /* Replacement <selinux/selinux.h> for platforms that lack it. | 
|---|
| 2 | Copyright (C) 2008-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 | #if __GNUC__ >= 3 | 
|---|
| 18 | @PRAGMA_SYSTEM_HEADER@ | 
|---|
| 19 | #endif | 
|---|
| 20 | @PRAGMA_COLUMNS@ | 
|---|
| 21 |  | 
|---|
| 22 | #if HAVE_SELINUX_SELINUX_H | 
|---|
| 23 |  | 
|---|
| 24 | #@INCLUDE_NEXT@ @NEXT_SELINUX_SELINUX_H@ | 
|---|
| 25 |  | 
|---|
| 26 | #else | 
|---|
| 27 | # if !defined _@GUARD_PREFIX@_SELINUX_SELINUX_H | 
|---|
| 28 | #  define _@GUARD_PREFIX@_SELINUX_SELINUX_H | 
|---|
| 29 |  | 
|---|
| 30 | #  include <sys/types.h> | 
|---|
| 31 | #  include <errno.h> | 
|---|
| 32 |  | 
|---|
| 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 | 
|---|
| 40 |  | 
|---|
| 41 | /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if | 
|---|
| 42 | the entity is not used.  The compiler should not warn if the entity is not | 
|---|
| 43 | used.  */ | 
|---|
| 44 | #  ifndef _GL_ATTRIBUTE_MAYBE_UNUSED | 
|---|
| 45 | #   if 0 /* no GCC or clang version supports this yet */ | 
|---|
| 46 | #    define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] | 
|---|
| 47 | #   elif defined __GNUC__ || defined __clang__ | 
|---|
| 48 | #    define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) | 
|---|
| 49 | #   else | 
|---|
| 50 | #    define _GL_ATTRIBUTE_MAYBE_UNUSED | 
|---|
| 51 | #   endif | 
|---|
| 52 | #  endif | 
|---|
| 53 |  | 
|---|
| 54 | #  if !GNULIB_defined_security_types | 
|---|
| 55 |  | 
|---|
| 56 | typedef unsigned short security_class_t; | 
|---|
| 57 | struct selinux_opt; | 
|---|
| 58 | #   define is_selinux_enabled() 0 | 
|---|
| 59 |  | 
|---|
| 60 | SE_SELINUX_INLINE int | 
|---|
| 61 | getcon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 62 | { errno = ENOTSUP; return -1; } | 
|---|
| 63 | SE_SELINUX_INLINE void | 
|---|
| 64 | freecon (_GL_ATTRIBUTE_MAYBE_UNUSED char *con) {} | 
|---|
| 65 |  | 
|---|
| 66 | SE_SELINUX_INLINE int | 
|---|
| 67 | getfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 68 | { errno = ENOTSUP; return -1; } | 
|---|
| 69 | SE_SELINUX_INLINE int | 
|---|
| 70 | setfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 71 | { errno = ENOTSUP; return -1; } | 
|---|
| 72 | SE_SELINUX_INLINE int | 
|---|
| 73 | matchpathcon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file, | 
|---|
| 74 | _GL_ATTRIBUTE_MAYBE_UNUSED mode_t m, | 
|---|
| 75 | _GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 76 | { errno = ENOTSUP; return -1; } | 
|---|
| 77 | SE_SELINUX_INLINE int | 
|---|
| 78 | getfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file, | 
|---|
| 79 | _GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 80 | { errno = ENOTSUP; return -1; } | 
|---|
| 81 | SE_SELINUX_INLINE int | 
|---|
| 82 | lgetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file, | 
|---|
| 83 | _GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 84 | { errno = ENOTSUP; return -1; } | 
|---|
| 85 | SE_SELINUX_INLINE int | 
|---|
| 86 | fgetfilecon (int fd,_GL_ATTRIBUTE_MAYBE_UNUSED char **con) | 
|---|
| 87 | { errno = ENOTSUP; return -1; } | 
|---|
| 88 | SE_SELINUX_INLINE int | 
|---|
| 89 | setfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file, | 
|---|
| 90 | _GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 91 | { errno = ENOTSUP; return -1; } | 
|---|
| 92 | SE_SELINUX_INLINE int | 
|---|
| 93 | lsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file, | 
|---|
| 94 | _GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 95 | { errno = ENOTSUP; return -1; } | 
|---|
| 96 | SE_SELINUX_INLINE int | 
|---|
| 97 | fsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED int fd, | 
|---|
| 98 | _GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 99 | { errno = ENOTSUP; return -1; } | 
|---|
| 100 |  | 
|---|
| 101 | SE_SELINUX_INLINE int | 
|---|
| 102 | security_check_context (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 103 | { errno = ENOTSUP; return -1; } | 
|---|
| 104 | SE_SELINUX_INLINE int | 
|---|
| 105 | security_check_context_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 106 | { errno = ENOTSUP; return -1; } | 
|---|
| 107 | SE_SELINUX_INLINE int | 
|---|
| 108 | setexeccon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) | 
|---|
| 109 | { errno = ENOTSUP; return -1; } | 
|---|
| 110 | SE_SELINUX_INLINE int | 
|---|
| 111 | security_compute_create (_GL_ATTRIBUTE_MAYBE_UNUSED char const *scon, | 
|---|
| 112 | _GL_ATTRIBUTE_MAYBE_UNUSED char const *tcon, | 
|---|
| 113 | _GL_ATTRIBUTE_MAYBE_UNUSED security_class_t tclass, | 
|---|
| 114 | _GL_ATTRIBUTE_MAYBE_UNUSED char **newcon) | 
|---|
| 115 | { errno = ENOTSUP; return -1; } | 
|---|
| 116 | SE_SELINUX_INLINE security_class_t | 
|---|
| 117 | string_to_security_class (char const *name) | 
|---|
| 118 | { errno = ENOTSUP; return 0; } | 
|---|
| 119 | SE_SELINUX_INLINE int | 
|---|
| 120 | matchpathcon_init_prefix (_GL_ATTRIBUTE_MAYBE_UNUSED char const *path, | 
|---|
| 121 | _GL_ATTRIBUTE_MAYBE_UNUSED char const *prefix) | 
|---|
| 122 | { errno = ENOTSUP; return -1; } | 
|---|
| 123 |  | 
|---|
| 124 | #   define GNULIB_defined_security_types 1 | 
|---|
| 125 | #  endif | 
|---|
| 126 |  | 
|---|
| 127 | _GL_INLINE_HEADER_END | 
|---|
| 128 |  | 
|---|
| 129 | # endif | 
|---|
| 130 | #endif | 
|---|