chiark / gitweb /
core: do not fail in a container if we can't use setgroups
[elogind.git] / src / basic / smack-util.h
1 #pragma once
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2013 Intel Corporation
7
8   Author: Auke Kok <auke-jan.h.kok@intel.com>
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25 #include <sys/types.h>
26
27 #include "macro.h"
28
29 #define SMACK_FLOOR_LABEL "_"
30 #define SMACK_STAR_LABEL  "*"
31
32 #if 0 /// UNNEEDED by elogind
33 typedef enum SmackAttr {
34         SMACK_ATTR_ACCESS = 0,
35         SMACK_ATTR_EXEC = 1,
36         SMACK_ATTR_MMAP = 2,
37         SMACK_ATTR_TRANSMUTE = 3,
38         SMACK_ATTR_IPIN = 4,
39         SMACK_ATTR_IPOUT = 5,
40         _SMACK_ATTR_MAX,
41         _SMACK_ATTR_INVALID = -1,
42 } SmackAttr;
43 #endif // 0
44
45 bool mac_smack_use(void);
46
47 int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
48
49 #if 0 /// UNNEEDED by elogind
50 const char* smack_attr_to_string(SmackAttr i) _const_;
51 SmackAttr smack_attr_from_string(const char *s) _pure_;
52 int mac_smack_read(const char *path, SmackAttr attr, char **label);
53 int mac_smack_read_fd(int fd, SmackAttr attr, char **label);
54 int mac_smack_apply(const char *path, SmackAttr attr, const char *label);
55 int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label);
56 int mac_smack_apply_pid(pid_t pid, const char *label);
57 int mac_smack_copy(const char *dest, const char *src);
58 #endif // 0