]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/cap-list.h
ea80ca3d5c760750e5b54286cebb84fc0ed28a19
[thirdparty/systemd.git] / src / basic / cap-list.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "forward.h"
5
6 /* Space for capability_to_string() in case we write out a numeric capability because we don't know the name
7 * for it. "0x3e" is the largest string we might output, in both sensese of the word "largest": two chars for
8 * "0x", two bytes for the hex value, and one trailing NUL byte. */
9 #define CAPABILITY_TO_STRING_MAX (2 + 2 + 1)
10
11 const char* capability_to_name(int id);
12 const char* capability_to_string(int id, char buf[static CAPABILITY_TO_STRING_MAX]);
13 #define CAPABILITY_TO_STRING(id) capability_to_string(id, (char[CAPABILITY_TO_STRING_MAX]) {})
14
15 int capability_from_name(const char *name);
16 int capability_list_length(void);
17
18 int capability_set_to_string(uint64_t set, char **ret);
19 int capability_set_to_string_negative(uint64_t set, char **ret);
20 int capability_set_to_strv(uint64_t set, char ***ret);
21 int capability_set_from_string(const char *s, uint64_t *ret);