capability: add a way to get a uint64_t with all caps set

This commit is contained in:
Lennart Poettering 2019-03-06 11:37:04 +01:00
parent 9a2c59119c
commit c8a79aa812
1 changed files with 5 additions and 3 deletions

View File

@ -33,10 +33,12 @@ static inline void cap_free_charpp(char **p) {
}
#define _cleanup_cap_free_charp_ _cleanup_(cap_free_charpp)
static inline uint64_t all_capabilities(void) {
return UINT64_MAX >> (63 - cap_last_cap());
}
static inline bool cap_test_all(uint64_t caps) {
uint64_t m;
m = (UINT64_C(1) << (cap_last_cap() + 1)) - 1;
return FLAGS_SET(caps, m);
return FLAGS_SET(caps, all_capabilities());
}
bool ambient_capabilities_supported(void);