#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "initrd-util.h"
#include "macro.h"
#include "manager-serialize.h"
#include "manager.h"
#include "varlink-internal.h"
int manager_open_serialization(Manager *m, FILE **ret_f) {
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
FILE *f;
assert(ret_f);
(void) serialize_item_format(f, "current-job-id", "%" PRIu32, m->current_job_id);
(void) serialize_item_format(f, "n-installed-jobs", "%u", m->n_installed_jobs);
(void) serialize_item_format(f, "n-failed-jobs", "%u", m->n_failed_jobs);
- (void) serialize_bool(f, "taint-usr", m->taint_usr);
(void) serialize_bool(f, "ready-sent", m->ready_sent);
(void) serialize_bool(f, "taint-logged", m->taint_logged);
(void) serialize_bool(f, "service-watchdogs", m->service_watchdogs);
(void) serialize_item_format(f, "user-lookup", "%i %i", copy0, copy1);
}
+ (void) serialize_item_format(f,
+ "dump-ratelimit",
+ USEC_FMT " " USEC_FMT " %u %u",
+ m->dump_ratelimit.begin,
+ m->dump_ratelimit.interval,
+ m->dump_ratelimit.num,
+ m->dump_ratelimit.burst);
+
bus_track_serialize(m->subscribed, f, "subscribed");
r = dynamic_user_serialize(m, f, fds);
manager_serialize_uid_refs(m, f);
manager_serialize_gid_refs(m, f);
- r = exec_runtime_serialize(m, f, fds);
+ r = exec_shared_runtime_serialize(m, f, fds);
if (r < 0)
return r;
r = parse_uid(value, &uid);
if (r < 0 || uid == 0) {
- log_debug("Unable to parse UID/GID reference serialization: " UID_FMT, uid);
+ log_debug("Unable to parse UID/GID reference serialization: %s", value);
return;
}
else
m->n_failed_jobs += n;
- } else if ((val = startswith(l, "taint-usr="))) {
- int b;
-
- b = parse_boolean(val);
- if (b < 0)
- log_notice("Failed to parse taint /usr flag '%s', ignoring.", val);
- else
- m->taint_usr = m->taint_usr || b;
-
} else if ((val = startswith(l, "ready-sent="))) {
int b;
} else if ((val = startswith(l, "notify-fd="))) {
int fd;
- if (safe_atoi(val, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
+ if ((fd = parse_fd(val)) < 0 || !fdset_contains(fds, fd))
log_notice("Failed to parse notify fd, ignoring: \"%s\"", val);
else {
m->notify_event_source = sd_event_source_disable_unref(m->notify_event_source);
} else if ((val = startswith(l, "cgroups-agent-fd="))) {
int fd;
- if (safe_atoi(val, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
+ if ((fd = parse_fd(val)) < 0 || !fdset_contains(fds, fd))
log_notice("Failed to parse cgroups agent fd, ignoring.: %s", val);
else {
m->cgroups_agent_event_source = sd_event_source_disable_unref(m->cgroups_agent_event_source);
else if ((val = startswith(l, "destroy-ipc-gid=")))
manager_deserialize_gid_refs_one(m, val);
else if ((val = startswith(l, "exec-runtime=")))
- (void) exec_runtime_deserialize_one(m, val, fds);
+ (void) exec_shared_runtime_deserialize_one(m, val, fds);
else if ((val = startswith(l, "subscribed="))) {
if (strv_extend(&m->deserialized_subscribed, val) < 0)
* remains set until all serialized contents are handled. */
if (deserialize_varlink_sockets)
(void) varlink_server_deserialize_one(m->varlink_server, val, fds);
+ } else if ((val = startswith(l, "dump-ratelimit="))) {
+ usec_t begin, interval;
+ unsigned num, burst;
+
+ if (sscanf(val, USEC_FMT " " USEC_FMT " %u %u", &begin, &interval, &num, &burst) != 4)
+ log_notice("Failed to parse dump ratelimit, ignoring: %s", val);
+ else {
+ /* If we changed the values across versions, flush the counter */
+ if (interval != m->dump_ratelimit.interval || burst != m->dump_ratelimit.burst)
+ m->dump_ratelimit.num = 0;
+ else
+ m->dump_ratelimit.num = num;
+ m->dump_ratelimit.begin = begin;
+ }
+
} else {
ManagerTimestamp q;