-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
hashmap_remove_value(u->manager->users, UID_TO_PTR(u->uid), u);
-/// elogind neither supports slice nor service jobs.
-#if 0
+#if 0 /// elogind neither supports slice nor service jobs.
u->slice_job = mfree(u->slice_job);
u->service_job = mfree(u->service_job);
#endif // 0
if (u->runtime_path)
fprintf(f, "RUNTIME=%s\n", u->runtime_path);
-/// elogind neither supports service nor slice jobs
-#if 0
+#if 0 /// elogind neither supports service nor slice jobs
if (u->service_job)
fprintf(f, "SERVICE_JOB=%s\n", u->service_job);
assert(u);
r = parse_env_file(u->state_file, NEWLINE,
-/// elogind neither supports service nor slice jobs
-#if 0
+#if 0 /// elogind neither supports service nor slice jobs
"SERVICE_JOB", &u->service_job,
"SLICE_JOB", &u->slice_job,
#endif // 0
if (s && s->display && display_is_local(s->display))
u->display = s;
- if (realtime) {
- unsigned long long l;
- if (sscanf(realtime, "%llu", &l) > 0)
- u->timestamp.realtime = l;
- }
-
- if (monotonic) {
- unsigned long long l;
- if (sscanf(monotonic, "%llu", &l) > 0)
- u->timestamp.monotonic = l;
- }
+ if (realtime)
+ timestamp_deserialize(realtime, &u->timestamp.realtime);
+ if (monotonic)
+ timestamp_deserialize(monotonic, &u->timestamp.monotonic);
return r;
}
}
static int user_start_slice(User *u) {
-/// elogind can not ask systemd via dbus to start user services
-#if 0
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+#if 0 /// elogind can not ask systemd via dbus to start user services
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
const char *description;
char *job;
int r;
u->manager->user_tasks_max,
&error,
&job);
- if (r < 0) {
+ if (r >= 0)
+ u->slice_job = job;
+ else if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS))
/* we don't fail due to this, let's try to continue */
- if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS))
- log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)", u->slice, bus_error_message(&error, r), error.name);
- } else {
- u->slice_job = job;
- }
+ log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)",
+ u->slice, bus_error_message(&error, r), error.name);
#else
assert(u);
}
static int user_start_service(User *u) {
-/// elogind can not ask systemd via dbus to start user services
-#if 0
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+#if 0 /// elogind can not ask systemd via dbus to start user services
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char *job;
int r;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static int user_stop_slice(User *u) {
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char *job;
int r;
}
static int user_stop_service(User *u) {
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char *job;
int r;
}
/* Kill systemd */
-/// elogind does not support service or slice jobs
-#if 0
+#if 0 /// elogind does not support service or slice jobs
k = user_stop_service(u);
if (k < 0)
r = k;
if (user_check_linger_file(u) > 0)
return true;
-/// elogind neither supports service nor slice jobs
-#if 0
+#if 0 /// elogind neither supports service nor slice jobs
if (u->slice_job && manager_job_is_active(u->manager, u->slice_job))
return true;
if (u->stopping)
return USER_CLOSING;
-/// elogind neither supports service nor slice jobs.
-#if 0
+#if 0 /// elogind neither supports service nor slice jobs.
if (!u->started || u->slice_job || u->service_job)
#else
if (!u->started)
}
int user_kill(User *u, int signo) {
-/// Without systemd unit support, elogind has to rely on its session system
-#if 0
+#if 0 /// Without systemd unit support, elogind has to rely on its session system
assert(u);
return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL);
errno = 0;
ul = strtoul(rvalue, &f, 10);
- if (errno != 0 || f != e) {
+ if (errno > 0 || f != e) {
log_syntax(unit, LOG_ERR, filename, line, errno, "Failed to parse percentage value, ignoring: %s", rvalue);
return 0;
}