mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
basic: Move userns_supported() to namespace-util.h
This commit is contained in:
@@ -644,6 +644,10 @@ int userns_enter_and_pin(int userns_fd, pid_t *ret_pid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool userns_supported(void) {
|
||||
return access("/proc/self/uid_map", F_OK) >= 0;
|
||||
}
|
||||
|
||||
int userns_get_base_uid(int userns_fd, uid_t *ret_uid, gid_t *ret_gid) {
|
||||
_cleanup_(sigkill_waitp) pid_t pid = 0;
|
||||
int r;
|
||||
|
||||
@@ -91,6 +91,7 @@ int userns_acquire_empty(void);
|
||||
int userns_acquire(const char *uid_map, const char *gid_map, bool setgroups_deny);
|
||||
int userns_acquire_self_root(void);
|
||||
int userns_enter_and_pin(int userns_fd, pid_t *ret_pid);
|
||||
bool userns_supported(void);
|
||||
|
||||
int userns_get_base_uid(int userns_fd, uid_t *ret_uid, gid_t *ret_gid);
|
||||
|
||||
|
||||
@@ -106,10 +106,6 @@ int take_etc_passwd_lock(const char *root);
|
||||
#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
|
||||
#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
||||
static inline bool userns_supported(void) {
|
||||
return access("/proc/self/uid_map", F_OK) >= 0;
|
||||
}
|
||||
|
||||
typedef enum ValidUserFlags {
|
||||
VALID_USER_RELAX = 1 << 0,
|
||||
VALID_USER_WARN = 1 << 1,
|
||||
|
||||
Reference in New Issue
Block a user