| 1 |
/* Replacement <selinux/label.h> for platforms that lack it. |
| 2 |
Copyright 2020-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 Paul Eggert. */ |
| 18 |
|
| 19 |
#ifndef SELINUX_LABEL_H |
| 20 |
|
| 21 |
#define SELINUX_LABEL_H |
| 22 |
|
| 23 |
#include <selinux/selinux.h> |
| 24 |
#include <errno.h> |
| 25 |
|
| 26 |
#ifndef _GL_INLINE_HEADER_BEGIN |
| 27 |
#error "Please include config.h first." |
| 28 |
#endif |
| 29 |
_GL_INLINE_HEADER_BEGIN |
| 30 |
#ifndef SE_LABEL_INLINE |
| 31 |
# define SE_LABEL_INLINE _GL_INLINE |
| 32 |
#endif |
| 33 |
|
| 34 |
/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if |
| 35 |
the entity is not used. The compiler should not warn if the entity is not |
| 36 |
used. */ |
| 37 |
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED |
| 38 |
# if 0 /* no GCC or clang version supports this yet */ |
| 39 |
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] |
| 40 |
# elif defined __GNUC__ || defined __clang__ |
| 41 |
# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) |
| 42 |
# else |
| 43 |
# define _GL_ATTRIBUTE_MAYBE_UNUSED |
| 44 |
# endif |
| 45 |
#endif |
| 46 |
|
| 47 |
#define SELABEL_CTX_FILE 0 |
| 48 |
|
| 49 |
struct selabel_handle; |
| 50 |
|
| 51 |
SE_LABEL_INLINE int |
| 52 |
selabel_lookup (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd, |
| 53 |
_GL_ATTRIBUTE_MAYBE_UNUSED char **context, |
| 54 |
_GL_ATTRIBUTE_MAYBE_UNUSED char const *key, |
| 55 |
_GL_ATTRIBUTE_MAYBE_UNUSED int type) |
| 56 |
{ errno = ENOTSUP; return -1; } |
| 57 |
|
| 58 |
SE_LABEL_INLINE struct selabel_handle * |
| 59 |
selabel_open (_GL_ATTRIBUTE_MAYBE_UNUSED int backend, |
| 60 |
_GL_ATTRIBUTE_MAYBE_UNUSED struct selinux_opt *options, |
| 61 |
_GL_ATTRIBUTE_MAYBE_UNUSED unsigned nopt) |
| 62 |
{ errno = ENOTSUP; return 0; } |
| 63 |
|
| 64 |
SE_LABEL_INLINE void |
| 65 |
selabel_close (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd) |
| 66 |
{ errno = ENOTSUP; } |
| 67 |
|
| 68 |
_GL_INLINE_HEADER_END |
| 69 |
|
| 70 |
#endif |