#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-util.h"
+#include "cgroup-util.h"
#include "clean-ipc.h"
#include "conf-parser.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "label.h"
Session *i;
bool first;
- fputs("SESSIONS=", f);
+ fputs_unlocked("SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nSEATS=", f);
+ fputs_unlocked("\nSEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputs("\nACTIVE_SESSIONS=", f);
+ fputs_unlocked("\nACTIVE_SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!session_is_active(i))
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nONLINE_SESSIONS=", f);
+ fputs_unlocked("\nONLINE_SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (session_get_state(i) == SESSION_CLOSING)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nACTIVE_SEATS=", f);
+ fputs_unlocked("\nACTIVE_SEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!session_is_active(i) || !i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputs("\nONLINE_SEATS=", f);
+ fputs_unlocked("\nONLINE_SEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (session_get_state(i) == SESSION_CLOSING || !i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputc('\n', f);
+ fputc_unlocked('\n', f);
}
r = fflush_and_check(f);
if (r < 0)
return log_error_errno(r, "Failed to create /run/user: %m");
- if (path_is_mount_point(u->runtime_path, 0) <= 0) {
+ if (path_is_mount_point(u->runtime_path, NULL, 0) <= 0) {
_cleanup_free_ char *t = NULL;
(void) mkdir_label(u->runtime_path, 0700);
r = mount("tmpfs", u->runtime_path, "tmpfs", MS_NODEV|MS_NOSUID, t);
if (r < 0) {
- if (errno != EPERM) {
+ if (!IN_SET(errno, EPERM, EACCES)) {
r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %m", u->runtime_path);
goto fail;
}
- /* Lacking permissions, maybe
- * CAP_SYS_ADMIN-less container? In this case,
- * just use a normal directory. */
+ log_debug_errno(errno, "Failed to mount per-user tmpfs directory %s, assuming containerized execution, ignoring: %m", u->runtime_path);
r = chmod_and_chown(u->runtime_path, 0700, u->uid, u->gid);
if (r < 0) {
assert(rvalue);
assert(data);
- /* First, try to parse as percentage */
+ if (isempty(rvalue)) {
+ *m = system_tasks_max_scale(DEFAULT_USER_TASKS_MAX_PERCENTAGE, 100U);
+ return 0;
+ }
+
+ if (streq(rvalue, "infinity")) {
+ *m = CGROUP_LIMIT_MAX;
+ return 0;
+ }
+
+ /* Try to parse as percentage */
r = parse_percent(rvalue);
if (r >= 0)
k = system_tasks_max_scale(r, 100U);