#include <stdbool.h>
#include <sys/types.h>
+/* The container base should have the last 16 bit set to zero */
+assert_cc((CONTAINER_UID_BASE_MIN & 0xFFFFU) == 0);
+assert_cc((CONTAINER_UID_BASE_MAX & 0xFFFFU) == 0);
+
+/* Given we assign 64K UIDs to containers, the last container UID is 0xFFFF larger than the base */
+#define CONTAINER_UID_MIN (CONTAINER_UID_BASE_MIN)
+#define CONTAINER_UID_MAX (CONTAINER_UID_BASE_MAX + 0xFFFFU)
+
bool uid_is_system(uid_t uid);
bool gid_is_system(gid_t gid);
}
static inline bool uid_is_container(uid_t uid) {
- return CONTAINER_UID_BASE_MIN <= uid && uid <= CONTAINER_UID_BASE_MAX;
+ return CONTAINER_UID_MIN <= uid && uid <= CONTAINER_UID_MAX;
}
static inline bool gid_is_container(gid_t gid) {
#include "namespace-util.h"
#include "path-util.h"
#include "string-util.h"
+#include "uid-classification.h"
#include "user-util.h"
static const char *mount_options_for_fstype(const char *fstype) {
/* Also map the container range. People can use that to place containers owned by high UIDs in their
* home directories if they really want. We won't manage this UID range for them but pass it through
* 1:1, and it will lose its meaning once migrated between hosts. */
- r = append_identity_range(&text, CONTAINER_UID_BASE_MIN, CONTAINER_UID_BASE_MAX+1, stored_uid);
+ r = append_identity_range(&text, CONTAINER_UID_MIN, CONTAINER_UID_MAX+1, stored_uid);
if (r < 0)
return log_oom();
#include "socket-util.h"
#include "strv.h"
#include "terminal-util.h"
+#include "uid-classification.h"
#include "uid-range.h"
#include "user-record-show.h"
#include "user-util.h"
.disposition = USER_DYNAMIC,
},
{
- .first = CONTAINER_UID_BASE_MIN,
- .last = CONTAINER_UID_BASE_MAX,
+ .first = CONTAINER_UID_MIN,
+ .last = CONTAINER_UID_MAX,
.name = "container",
.disposition = USER_CONTAINER,
},