-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
free(s->scope);
}
-/// elogind does not support systemd scope_jobs
-#if 0
+#if 0 /// elogind does not support systemd scope_jobs
free(s->scope_job);
#endif // 0
if (s->scope)
fprintf(f, "SCOPE=%s\n", s->scope);
-/// elogind does not support systemd scope_jobs
-#if 0
+#if 0 /// elogind does not support systemd scope_jobs
if (s->scope_job)
fprintf(f, "SCOPE_JOB=%s\n", s->scope_job);
#endif // 0
r = parse_env_file(s->state_file, NEWLINE,
"REMOTE", &remote,
"SCOPE", &s->scope,
-/// elogind does not support systemd scope_jobs
-#if 0
+#if 0 /// elogind does not support systemd scope_jobs
"SCOPE_JOB", &s->scope_job,
#endif // 0
"FIFO", &s->fifo_path,
safe_close(fd);
}
- if (realtime) {
- unsigned long long l;
- if (sscanf(realtime, "%llu", &l) > 0)
- s->timestamp.realtime = l;
- }
-
- if (monotonic) {
- unsigned long long l;
- if (sscanf(monotonic, "%llu", &l) > 0)
- s->timestamp.monotonic = l;
- }
+ if (realtime)
+ timestamp_deserialize(realtime, &s->timestamp.realtime);
+ if (monotonic)
+ timestamp_deserialize(monotonic, &s->timestamp.monotonic);
if (controller) {
if (bus_name_has_owner(s->manager->bus, controller, NULL) > 0)
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static int session_start_scope(Session *s) {
int r;
assert(s->user);
if (!s->scope) {
- _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 *scope, *job = NULL;
const char *description;
if (!scope)
return log_oom();
- description = strjoina("Session ", s->id, " of user ", s->user->name, NULL);
+ description = strjoina("Session ", s->id, " of user ", s->user->name);
r = manager_start_scope(
s->manager,
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static int session_stop_scope(Session *s, bool force) {
- _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 = NULL;
int r;
#endif // 0
static int session_stop_cgroup(Session *s, bool force) {
- _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;
int r;
assert(s);
session_remove_fifo(s);
/* Kill cgroup */
-/// elogind does not start scopes, but sessions
-#if 0
+#if 0 /// elogind does not start scopes, but sessions
r = session_stop_scope(s, force);
#else
r = session_stop_cgroup(s, force);
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) {
Session *s = userdata;
/* Graphical sessions should really implement a real
* idle hint logic */
- if (s->display)
+ if (SESSION_TYPE_IS_GRAPHICAL(s->type))
goto dont_know;
/* For sessions with an explicitly configured tty, let's check
return true;
}
-/// elogind supports neither scopes nor jobs
-#if 0
+#if 0 /// elogind supports neither scopes nor jobs
if (s->scope_job && manager_job_is_active(s->manager, s->scope_job))
return true;
if (s->stopping || s->timer_event_source)
return SESSION_CLOSING;
-/// elogind does not support systemd scope_jobs
-#if 0
+#if 0 /// elogind does not support systemd scope_jobs
if (s->scope_job || s->fifo_fd < 0)
#else
if (s->fifo_fd < 0)
int session_kill(Session *s, KillWho who, int signo) {
assert(s);
-/// Without direct cgroup support, elogind can not kill sessions
-#if 0
+#if 0 /// Without direct cgroup support, elogind can not kill sessions
if (!s->scope)
return -ESRCH;