chiark / gitweb /
72948205f6bcf2caf92eb52fb907934461cdc2c8
[elogind.git] / src / shared / label.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2010 Lennart Poettering
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 <sys/types.h>
25 #include <stdbool.h>
26 #include <sys/socket.h>
27
28 int label_init(const char *prefix);
29 void label_finish(void);
30
31 int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
32
33 int label_socket_set(const char *label);
34 void label_socket_clear(void);
35
36 int label_context_set(const char *path, mode_t mode);
37 void label_context_clear(void);
38
39 void label_free(const char *label);
40
41 int label_get_create_label_from_exe(const char *exe, char **label);
42
43 int label_mkdir(const char *path, mode_t mode);
44
45 int label_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
46
47 int label_apply(const char *path, const char *label);
48
49 int label_write_one_line_file_atomic(const char *fn, const char *line);
50 int label_write_env_file(const char *fname, char **l);
51 int label_fopen_temporary(const char *path, FILE **_f, char **_temp_path);