[systemd-commits] 7 commits - src/dbus-execute.c src/dbus-execute.h src/dbus-manager.c src/dbus-unit.h src/log.c src/manager.c src/mount-setup.c src/readahead-common.c src/systemctl.c src/systemd-analyze src/unit.c src/util.c TODO
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Apr 7 12:35:45 PDT 2011
TODO | 12 ++----------
src/dbus-execute.c | 2 ++
src/dbus-execute.h | 6 +++++-
src/dbus-manager.c | 8 +++++++-
src/dbus-unit.h | 16 +++++++++++++---
src/log.c | 10 +++++-----
src/manager.c | 48 ++++++++++++++++++++++++++++++++++++++----------
src/mount-setup.c | 14 +++++++-------
src/readahead-common.c | 1 -
src/systemctl.c | 6 ++++--
src/systemd-analyze | 40 ++++++++++++++++++++++++++++++----------
src/unit.c | 17 ++++++++++++-----
src/util.c | 10 +++++-----
13 files changed, 130 insertions(+), 60 deletions(-)
New commits:
commit b21a0ef8fc3d78ca3cc9d08e8ec8e41705d9902e
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 21:35:37 2011 +0200
dbus: expose monotonic timestamps on the bus
diff --git a/TODO b/TODO
index 5a3944f..e16fdee 100644
--- a/TODO
+++ b/TODO
@@ -32,8 +32,6 @@ Features:
* show enablement status in systemctl status
-* expose monotonic timestamps on the bus and make systemd-analyze use it
-
* write blog stories about:
- chroot, nspawn and friends
- the blame game: systemd-analyze
diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index 35e6d37..3cb09c2 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -346,7 +346,9 @@ int bus_execute_append_command(Manager *m, DBusMessageIter *i, const char *prope
if (!dbus_message_iter_close_container(&sub2, &sub3) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_BOOLEAN, &c->ignore) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.start_timestamp.realtime) ||
+ !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.start_timestamp.monotonic) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.exit_timestamp.realtime) ||
+ !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.exit_timestamp.monotonic) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &pid) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_INT32, &code) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_INT32, &status))
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index 8bfaaaf..548738a 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -28,7 +28,9 @@
#define BUS_EXEC_STATUS_INTERFACE(prefix) \
" <property name=\"" prefix "StartTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"" prefix "StartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"" prefix "ExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"" prefix "ExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"" prefix "PID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"" prefix "Code\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"" prefix "Status\" type=\"i\" access=\"read\"/>\n"
@@ -149,13 +151,15 @@
#define BUS_EXEC_STATUS_PROPERTIES(interface, estatus, prefix) \
{ interface, prefix "StartTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \
+ { interface, prefix "StartTimestampMonotonic",bus_property_append_usec, "t", &(estatus).start_timestamp.monotonic }, \
{ interface, prefix "ExitTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \
+ { interface, prefix "ExitTimestampMonotonic", bus_property_append_usec, "t", &(estatus).start_timestamp.monotonic }, \
{ interface, prefix "PID", bus_property_append_pid, "u", &(estatus).pid }, \
{ interface, prefix "Code", bus_property_append_int, "i", &(estatus).code }, \
{ interface, prefix "Status", bus_property_append_int, "i", &(estatus).status }
#define BUS_EXEC_COMMAND_PROPERTY(interface, command, name) \
- { interface, name, bus_execute_append_command, "a(sasbttuii)", (command) }
+ { interface, name, bus_execute_append_command, "a(sasbttttuii)", (command) }
int bus_execute_append_output(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_input(Manager *m, DBusMessageIter *i, const char *property, void *data);
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 5b5bda2..e1bf9fd 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -155,8 +155,11 @@
" <property name=\"Tainted\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"RunningAs\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"InitRDTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"InitRDTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"StartupTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"StartupTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"FinishTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"FinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"LogLevel\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"LogTarget\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"NNames\" type=\"u\" access=\"read\"/>\n" \
@@ -369,8 +372,11 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
{ "org.freedesktop.systemd1.Manager", "RunningAs", bus_manager_append_running_as, "s", &m->running_as },
{ "org.freedesktop.systemd1.Manager", "Tainted", bus_manager_append_tainted, "s", m },
{ "org.freedesktop.systemd1.Manager", "InitRDTimestamp", bus_property_append_uint64, "t", &m->initrd_timestamp.realtime },
+ { "org.freedesktop.systemd1.Manager", "InitRDTimestampMonotonic", bus_property_append_uint64, "t", &m->initrd_timestamp.monotonic },
{ "org.freedesktop.systemd1.Manager", "StartupTimestamp", bus_property_append_uint64, "t", &m->startup_timestamp.realtime },
+ { "org.freedesktop.systemd1.Manager", "StartupTimestampMonotonic", bus_property_append_uint64, "t", &m->startup_timestamp.monotonic },
{ "org.freedesktop.systemd1.Manager", "FinishTimestamp", bus_property_append_uint64, "t", &m->finish_timestamp.realtime },
+ { "org.freedesktop.systemd1.Manager", "FinishTimestampMonotonic", bus_property_append_uint64, "t",&m->finish_timestamp.monotonic },
{ "org.freedesktop.systemd1.Manager", "LogLevel", bus_manager_append_log_level, "s", NULL, bus_manager_set_log_level},
{ "org.freedesktop.systemd1.Manager", "LogTarget", bus_manager_append_log_target, "s", NULL, bus_manager_set_log_target},
{ "org.freedesktop.systemd1.Manager", "NNames", bus_manager_append_n_names, "u", NULL },
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index dfbc82c..b9f0895 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -86,9 +86,13 @@
" <property name=\"SubState\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"FragmentPath\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"InactiveExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"InactiveExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"ActiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"ActiveEnterTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"ActiveExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"ActiveExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"InactiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"InactiveEnterTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"CanReload\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"CanStart\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"CanStop\" type=\"b\" access=\"read\"/>\n" \
@@ -103,6 +107,7 @@
" <property name=\"NeedDaemonReload\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"JobTimeoutUSec\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"ConditionTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"ConditionTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"ConditionResult\" type=\"b\" access=\"read\"/>\n" \
" </interface>\n"
@@ -134,10 +139,14 @@
{ "org.freedesktop.systemd1.Unit", "ActiveState", bus_unit_append_active_state, "s", u }, \
{ "org.freedesktop.systemd1.Unit", "SubState", bus_unit_append_sub_state, "s", u }, \
{ "org.freedesktop.systemd1.Unit", "FragmentPath", bus_property_append_string, "s", u->meta.fragment_path }, \
- { "org.freedesktop.systemd1.Unit", "InactiveExitTimestamp",bus_property_append_usec, "t", &u->meta.inactive_exit_timestamp.realtime }, \
- { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestamp", bus_property_append_usec, "t", &u->meta.active_enter_timestamp.realtime }, \
- { "org.freedesktop.systemd1.Unit", "ActiveExitTimestamp", bus_property_append_usec, "t", &u->meta.active_exit_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "InactiveExitTimestamp",bus_property_append_usec, "t", &u->meta.inactive_exit_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "InactiveExitTimestampMonotonic",bus_property_append_usec, "t", &u->meta.inactive_exit_timestamp.monotonic }, \
+ { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestamp", bus_property_append_usec, "t", &u->meta.active_enter_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestampMonotonic", bus_property_append_usec, "t", &u->meta.active_enter_timestamp.monotonic }, \
+ { "org.freedesktop.systemd1.Unit", "ActiveExitTimestamp", bus_property_append_usec, "t", &u->meta.active_exit_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "ActiveExitTimestampMonotonic", bus_property_append_usec, "t", &u->meta.active_exit_timestamp.monotonic }, \
{ "org.freedesktop.systemd1.Unit", "InactiveEnterTimestamp",bus_property_append_usec, "t", &u->meta.inactive_enter_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "InactiveEnterTimestampMonotonic",bus_property_append_usec,"t", &u->meta.inactive_enter_timestamp.monotonic }, \
{ "org.freedesktop.systemd1.Unit", "CanStart", bus_unit_append_can_start, "b", u }, \
{ "org.freedesktop.systemd1.Unit", "CanStop", bus_unit_append_can_stop, "b", u }, \
{ "org.freedesktop.systemd1.Unit", "CanReload", bus_unit_append_can_reload, "b", u }, \
@@ -154,6 +163,7 @@
{ "org.freedesktop.systemd1.Unit", "NeedDaemonReload", bus_unit_append_need_daemon_reload, "b", u }, \
{ "org.freedesktop.systemd1.Unit", "JobTimeoutUSec", bus_property_append_usec, "t", &u->meta.job_timeout }, \
{ "org.freedesktop.systemd1.Unit", "ConditionTimestamp", bus_property_append_usec, "t", &u->meta.condition_timestamp.realtime }, \
+ { "org.freedesktop.systemd1.Unit", "ConditionTimestampMonotonic", bus_property_append_usec,"t", &u->meta.condition_timestamp.monotonic }, \
{ "org.freedesktop.systemd1.Unit", "ConditionResult", bus_property_append_bool, "b", &u->meta.condition_result }
int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property, void *data);
diff --git a/src/systemctl.c b/src/systemctl.c
index 00db47f..0a72874 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1735,7 +1735,7 @@ static void exec_status_info_free(ExecStatusInfo *i) {
}
static int exec_status_info_deserialize(DBusMessageIter *sub, ExecStatusInfo *i) {
- uint64_t start_timestamp, exit_timestamp;
+ uint64_t start_timestamp, exit_timestamp, start_timestamp_monotonic, exit_timestamp_monotonic;
DBusMessageIter sub2, sub3;
const char*path;
unsigned n;
@@ -1789,7 +1789,9 @@ static int exec_status_info_deserialize(DBusMessageIter *sub, ExecStatusInfo *i)
if (!dbus_message_iter_next(&sub2) ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_BOOLEAN, &ignore, true) < 0 ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &start_timestamp, true) < 0 ||
+ bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &start_timestamp_monotonic, true) < 0 ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &exit_timestamp, true) < 0 ||
+ bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &exit_timestamp_monotonic, true) < 0 ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT32, &pid, true) < 0 ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_INT32, &code, true) < 0 ||
bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_INT32, &status, false) < 0)
@@ -2278,7 +2280,7 @@ static int print_property(const char *name, DBusMessageIter *iter) {
/* Yes, heuristics! But we can change this check
* should it turn out to not be sufficient */
- if (strstr(name, "Timestamp")) {
+ if (endswith(name, "Timestamp")) {
char timestamp[FORMAT_TIMESTAMP_MAX], *t;
if ((t = format_timestamp(timestamp, sizeof(timestamp), u)) || arg_all)
diff --git a/src/systemd-analyze b/src/systemd-analyze
index 5e3a087..6f03d13 100755
--- a/src/systemd-analyze
+++ b/src/systemd-analyze
@@ -15,10 +15,10 @@ def acquire_time_data():
properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', i[6]), 'org.freedesktop.DBus.Properties')
- ixt = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveExitTimestamp'))
- aet = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveEnterTimestamp'))
- axt = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveExitTimestamp'))
- iet = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveEnterTimestamp'))
+ ixt = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic'))
+ aet = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic'))
+ axt = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic'))
+ iet = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic'))
l.append((str(i[0]), ixt, aet, axt, iet))
@@ -27,12 +27,14 @@ def acquire_time_data():
def acquire_start_time():
properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.DBus.Properties')
- startup_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'StartupTimestamp'))
- finish_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'FinishTimestamp'))
+ initrd_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic'))
+ startup_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'StartupTimestampMonotonic'))
+ finish_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic'))
+ assert initrd_time <= startup_time
assert startup_time <= finish_time
- return startup_time, finish_time
+ return initrd_time, startup_time, finish_time
def draw_box(context, j, k, l, m, r = 0, g = 0, b = 0):
context.save()
@@ -63,7 +65,8 @@ def draw_text(context, x, y, text, size = 12, r = 0, g = 0, b = 0, vcenter = 0.5
context.restore()
def help():
- sys.stdout.write("""systemd-analyze blame
+ sys.stdout.write("""systemd-analyze time
+systemd-analyze blame
systemd-analyze plot
Process systemd profiling information
@@ -74,7 +77,24 @@ Process systemd profiling information
bus = dbus.SystemBus()
-if len(sys.argv) <= 1 or sys.argv[1] == 'blame':
+if len(sys.argv) <= 1 or sys.argv[1] == 'time':
+
+ initrd_time, start_time, finish_time = acquire_start_time()
+
+ if initrd_time > 0:
+ print "Startup finished in %lums (kernel) + %lums (initrd) + %lums (userspace) = %lums" % ( \
+ initrd_time/1000, \
+ (start_time - initrd_time)/1000, \
+ (finish_time - start_time)/1000, \
+ finish_time/1000)
+ else:
+ print "Startup finished in %lums (kernel) + %lums (userspace) = %lums" % ( \
+ startup_time/1000, \
+ (finish_time - start_time)/1000, \
+ finish_time/1000)
+
+
+elif sys.argv[1] == 'blame':
data = acquire_time_data()
s = sorted(data, key = lambda i: i[2] - i[1], reverse = True)
@@ -92,7 +112,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == 'blame':
elif sys.argv[1] == 'plot':
import cairo
- start_time, finish_time = acquire_start_time()
+ initrd_time, start_time, finish_time = acquire_start_time()
data = acquire_time_data()
s = sorted(data, key = lambda i: i[1])
commit f1d19aa412b34fe025dfd48a5c79d34fdd0f9528
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 21:22:41 2011 +0200
manager: no need to use randomized generator dir when running as system manager
diff --git a/TODO b/TODO
index af264d3..5a3944f 100644
--- a/TODO
+++ b/TODO
@@ -2,9 +2,6 @@ F15:
* swap units that are activated by one name but shown in the kernel under another are semi-broken
-* isolate multi-user.target doesn't start a getty at tty1 if we run it from graphical.target
- https://bugzilla.redhat.com/show_bug.cgi?id=688661
-
* NFS, networkmanager ordering issue (PENDING)
* NM should pull in network.target (PENDING)
@@ -24,6 +21,8 @@ F15:
* 0595f9a1c182a84581749823ef47c5f292e545f9 is borked, freezes shutdown
(path: after installing inotify watches, recheck file again to fix race)
+* active_enter timestamps borked?
+
Features:
* fix alsa mixer restore to not print error when no config is stored
@@ -31,8 +30,6 @@ Features:
* don't trim empty cgroups
https://bugzilla.redhat.com/show_bug.cgi?id=678555
-* serialize used job ids and max job id
-
* show enablement status in systemctl status
* expose monotonic timestamps on the bus and make systemd-analyze use it
@@ -74,9 +71,6 @@ Features:
* when key file cannot be found, read it from kbd in cryptsetup
-* get rid of random file name in generator directory?
- /run/systemd/generator-IH1vFu
-
* add switch to systemctl to show enabled but not running services. Or
another switch that shows service that have been running since
booting but aren't running anymore.
diff --git a/src/manager.c b/src/manager.c
index 5cb3588..ad627fc 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2920,13 +2920,22 @@ void manager_run_generators(Manager *m) {
}
if (!m->generator_unit_path) {
- char *p;
- char system_path[] = "/run/systemd/generator-XXXXXX",
- user_path[] = "/tmp/systemd-generator-XXXXXX";
+ const char *p;
+ char user_path[] = "/tmp/systemd-generator-XXXXXX";
- if (!(p = mkdtemp(m->running_as == MANAGER_SYSTEM ? system_path : user_path))) {
- log_error("Failed to generate generator directory: %m");
- goto finish;
+ if (m->running_as == MANAGER_SYSTEM) {
+ p = "/run/systemd/generator";
+
+ if (mkdir_p(p, 0755) < 0) {
+ log_error("Failed to create generator directory: %m");
+ goto finish;
+ }
+
+ } else {
+ if (!(p = mkdtemp(user_path))) {
+ log_error("Failed to create generator directory: %m");
+ goto finish;
+ }
}
if (!(m->generator_unit_path = strdup(p))) {
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 4fa8ae5..8520583 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -242,22 +242,22 @@ int mount_setup(void) {
if ((r = mount_one(mount_table+i)) < 0)
return r;
- /* Nodes in devtmpfs need to be manually updated for the
- * appropriate labels, after mounting. The other virtual API
- * file systems do not need that. */
-
+ /* Nodes in devtmpfs and /run need to be manually updated for
+ * the appropriate labels, after mounting. The other virtual
+ * API file systems like /sys and /proc do not need that, they
+ * use the same label for all their files. */
if (unlink("/dev/.systemd-relabel-run-dev") >= 0) {
nftw("/dev", nftw_cb, 64, FTW_MOUNT|FTW_PHYS);
nftw("/run", nftw_cb, 64, FTW_MOUNT|FTW_PHYS);
}
/* Create a few default symlinks, which are normally created
- * bei udevd, but some scripts might need them before we start
+ * by udevd, but some scripts might need them before we start
* udevd. */
-
NULSTR_FOREACH_PAIR(j, k, symlinks)
symlink_and_label(j, k);
+
/* Create a few directories we always want around */
mkdir("/run/systemd", 0755);
mkdir("/run/systemd/ask-password", 0755);
commit 20c03b7be2c87ef54533db849fd046d7014c36b4
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 18:48:50 2011 +0200
don't make up buffer sizes, use standard LINE_MAX instead
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 2f755bc..5b5bda2 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -218,7 +218,7 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_outp
static int bus_manager_append_tainted(Manager *m, DBusMessageIter *i, const char *property, void *data) {
const char *t;
- char buf[64] = "", *e = buf, *p = NULL;
+ char buf[LINE_MAX] = "", *e = buf, *p = NULL;
assert(m);
assert(i);
diff --git a/src/log.c b/src/log.c
index 95c2765..3776f0d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -238,11 +238,11 @@ void log_set_max_level(int level) {
}
static int write_to_console(
- int level,
- const char*file,
- int line,
- const char *func,
- const char *buffer) {
+ int level,
+ const char*file,
+ int line,
+ const char *func,
+ const char *buffer) {
char location[64];
struct iovec iovec[5];
diff --git a/src/manager.c b/src/manager.c
index f9b3b59..5cb3588 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2681,7 +2681,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
m->n_deserializing ++;
for (;;) {
- char line[1024], *l;
+ char line[LINE_MAX], *l;
if (!fgets(line, sizeof(line), f)) {
if (feof(f))
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 9bc8946..4fa8ae5 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -134,7 +134,7 @@ static int mount_one(const MountPoint *p) {
static int mount_cgroup_controllers(void) {
int r;
FILE *f;
- char buf [256];
+ char buf[LINE_MAX];
/* Mount all available cgroup controllers that are built into the kernel. */
diff --git a/src/readahead-common.c b/src/readahead-common.c
index fc49a33..8a75b2e 100644
--- a/src/readahead-common.c
+++ b/src/readahead-common.c
@@ -209,7 +209,6 @@ finish:
return m;
}
-
#define BUMP_REQUEST_NR (16*1024)
int bump_request_nr(const char *p) {
diff --git a/src/unit.c b/src/unit.c
index 32071f2..37a7c07 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -2152,7 +2152,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
return 0;
for (;;) {
- char line[1024], *l, *v;
+ char line[LINE_MAX], *l, *v;
size_t k;
if (!fgets(line, sizeof(line), f)) {
diff --git a/src/util.c b/src/util.c
index 5daafdf..d39cb48 100644
--- a/src/util.c
+++ b/src/util.c
@@ -452,7 +452,7 @@ char **split_path_and_make_absolute(const char *p) {
int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
int r;
FILE *f;
- char fn[132], line[256], *p;
+ char fn[PATH_MAX], line[LINE_MAX], *p;
long unsigned ppid;
assert(pid >= 0);
@@ -2063,7 +2063,7 @@ int chvt(int vt) {
int read_one_char(FILE *f, char *ret, bool *need_nl) {
struct termios old_termios, new_termios;
char c;
- char line[1024];
+ char line[LINE_MAX];
assert(f);
assert(ret);
@@ -2271,7 +2271,7 @@ int flush_fd(int fd) {
pollfd.events = POLLIN;
for (;;) {
- char buf[1024];
+ char buf[LINE_MAX];
ssize_t l;
int r;
@@ -2897,7 +2897,7 @@ int getttyname_harder(int fd, char **r) {
int get_ctty_devnr(dev_t *d) {
int k;
- char line[256], *p;
+ char line[LINE_MAX], *p;
unsigned long ttynr;
FILE *f;
@@ -2932,7 +2932,7 @@ int get_ctty_devnr(dev_t *d) {
int get_ctty(char **r, dev_t *_devnr) {
int k;
- char fn[128], *s, *b, *p;
+ char fn[PATH_MAX], *s, *b, *p;
dev_t devnr;
assert(r);
commit f68319bbb8e95e6afa5793834668b5c094616249
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 18:47:35 2011 +0200
unit: disallow configuration of more than one on_failure dependencies if OnFailureIsolate= is on
diff --git a/src/unit.c b/src/unit.c
index e5a9623..32071f2 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -814,6 +814,16 @@ int unit_load(Unit *u) {
if ((r = unit_add_default_dependencies(u)) < 0)
goto fail;
+ if (u->meta.on_failure_isolate &&
+ set_size(u->meta.dependencies[UNIT_ON_FAILURE]) > 1) {
+
+ log_error("More than one OnFailure= dependencies specified for %s but OnFailureIsolate= enabled. Refusing.",
+ u->meta.id);
+
+ r = -EINVAL;
+ goto fail;
+ }
+
assert((u->meta.load_state != UNIT_MERGED) == !u->meta.merged_into);
unit_add_to_dbus_queue(unit_follow_merge(u));
commit ffd73e3599ea2a97c03c1765cd4bc94ebc152f89
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 18:47:11 2011 +0200
unit: pull in logger unit only when running in system mode
diff --git a/src/unit.c b/src/unit.c
index 90773e8..e5a9623 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -567,11 +567,8 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
/* If syslog or kernel logging is requested, make sure our own
* logging daemon is run first. */
- if ((r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
- return r;
-
if (u->meta.manager->running_as == MANAGER_SYSTEM)
- if ((r = unit_add_dependency_by_name(u, UNIT_REQUIRES, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
+ if ((r = unit_add_two_dependencies_by_name(u, UNIT_REQUIRES, UNIT_AFTER, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
return r;
return 0;
commit 01d67b43b067c39aec0a66b31943658c95cc56a1
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 18:46:39 2011 +0200
manager: serialize/deserialize max job id and /usr taint flag
diff --git a/src/manager.c b/src/manager.c
index 0530729..f9b3b59 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2640,6 +2640,9 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
assert(f);
assert(fds);
+ fprintf(f, "current-job-id=%i\n", m->current_job_id);
+ fprintf(f, "taint-usr=%s\n", yes_no(m->taint_usr));
+
dual_timestamp_serialize(f, "initrd-timestamp", &m->initrd_timestamp);
dual_timestamp_serialize(f, "startup-timestamp", &m->startup_timestamp);
dual_timestamp_serialize(f, "finish-timestamp", &m->finish_timestamp);
@@ -2695,7 +2698,21 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
if (l[0] == 0)
break;
- if (startswith(l, "initrd-timestamp="))
+ if (startswith(l, "current-job-id=")) {
+ uint32_t id;
+
+ if (safe_atou32(l+15, &id) < 0)
+ log_debug("Failed to parse current job id value %s", l+15);
+ else
+ m->current_job_id = MAX(m->current_job_id, id);
+ } else if (startswith(l, "taint-usr=")) {
+ int b;
+
+ if ((b = parse_boolean(l+10)) < 0)
+ log_debug("Failed to parse taint /usr flag %s", l+10);
+ else
+ m->taint_usr = m->taint_usr || b;
+ } else if (startswith(l, "initrd-timestamp="))
dual_timestamp_deserialize(l+17, &m->initrd_timestamp);
else if (startswith(l, "startup-timestamp="))
dual_timestamp_deserialize(l+18, &m->startup_timestamp);
commit a8049b7a7cad92982892ec258545e11fcdf5b9f5
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 7 18:45:34 2011 +0200
manager: don't garbage collect jobs when isolating, to change global state
diff --git a/src/manager.c b/src/manager.c
index 9b561c4..0530729 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1273,7 +1273,8 @@ static int transaction_activate(Manager *m, JobMode mode, DBusError *e) {
for (;;) {
/* Fourth step: Let's remove unneeded jobs that might
* be lurking. */
- transaction_collect_garbage(m);
+ if (mode != JOB_ISOLATE)
+ transaction_collect_garbage(m);
/* Fifth step: verify order makes sense and correct
* cycles if necessary and possible */
@@ -1303,7 +1304,8 @@ static int transaction_activate(Manager *m, JobMode mode, DBusError *e) {
/* Seventh step: an entry got dropped, let's garbage
* collect its dependencies. */
- transaction_collect_garbage(m);
+ if (mode != JOB_ISOLATE)
+ transaction_collect_garbage(m);
/* Let's see if the resulting transaction still has
* unmergeable entries ... */
More information about the systemd-commits
mailing list