[systemd-commits] 3 commits - man/systemctl.xml man/systemd.xml src/nspawn.c src/systemctl.c
Lennart Poettering
lennart at kemper.freedesktop.org
Sat Jul 23 06:56:12 PDT 2011
man/systemctl.xml | 10 --
man/systemd.xml | 2
src/nspawn.c | 2
src/systemctl.c | 255 +++---------------------------------------------------
4 files changed, 18 insertions(+), 251 deletions(-)
New commits:
commit 4b7a6af440ee1a957fd8fe1c6ca3b7f310fdf77c
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 23 15:54:52 2011 +0200
nspawn: mount a new /proc instance in the container so that we don't see the hosts' PID tree
This partially reverts f5c1b9eeb94c112e5dac09fc6a47c571356c30c0.
diff --git a/src/nspawn.c b/src/nspawn.c
index 8f3cd74..8d7e0d0 100644
--- a/src/nspawn.c
+++ b/src/nspawn.c
@@ -124,7 +124,7 @@ static int mount_all(const char *dest) {
} MountPoint;
static const MountPoint mount_table[] = {
- { "/proc", "/proc", "bind", NULL, MS_BIND, true },
+ { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
{ "/proc/sys", "/proc/sys", "bind", NULL, MS_BIND, true }, /* Bind mount first */
{ "/proc/sys", "/proc/sys", "bind", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, true }, /* Then, make it r/o */
{ "/sys", "/sys", "bind", NULL, MS_BIND, true }, /* Bind mount first */
commit e1ea662c3393f479312436fc2d50ebd30f2466ef
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 23 04:21:47 2011 +0200
systemctl: remove monitor command since it is mostly useless
diff --git a/man/systemctl.xml b/man/systemctl.xml
index fca19c6..b60731a 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -759,16 +759,6 @@
IDs. If no job id is specified, cancel all pending jobs.</para></listitem>
</varlistentry>
<varlistentry>
- <term><command>monitor</command></term>
-
- <listitem><para>Monitor unit/job
- changes. This is mostly useful for
- debugging purposes and prints a line
- each time systemd loads or unloads a
- unit configuration file, or a unit
- property changes.</para></listitem>
- </varlistentry>
- <varlistentry>
<term><command>dump</command></term>
<listitem><para>Dump server
diff --git a/src/systemctl.c b/src/systemctl.c
index d94105e..9f5ba8a 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -2692,234 +2692,6 @@ finish:
return ret;
}
-static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage *message, void *data) {
- DBusError error;
- DBusMessage *m = NULL, *reply = NULL;
-
- assert(connection);
- assert(message);
-
- dbus_error_init(&error);
-
- log_debug("Got D-Bus request: %s.%s() on %s",
- dbus_message_get_interface(message),
- dbus_message_get_member(message),
- dbus_message_get_path(message));
-
- if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
- log_error("Warning! D-Bus connection terminated.");
- dbus_connection_close(connection);
-
- } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "UnitNew") ||
- dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "UnitRemoved")) {
- const char *id, *path;
-
- if (!dbus_message_get_args(message, &error,
- DBUS_TYPE_STRING, &id,
- DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s", bus_error_message(&error));
- else if (streq(dbus_message_get_member(message), "UnitNew"))
- printf("Unit %s added.\n", id);
- else
- printf("Unit %s removed.\n", id);
-
- } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "JobNew")) {
- uint32_t id;
- const char *path;
-
- if (!dbus_message_get_args(message, &error,
- DBUS_TYPE_UINT32, &id,
- DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s", bus_error_message(&error));
- else
- printf("Job %u added.\n", id);
-
-
- } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "JobRemoved")) {
- uint32_t id;
- const char *path, *result;
-
- if (!dbus_message_get_args(message, &error,
- DBUS_TYPE_UINT32, &id,
- DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_STRING, &result,
- DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s", bus_error_message(&error));
- else
- printf("Job %u removed (result=%s).\n", id, result);
-
-
- } else if (dbus_message_is_signal(message, "org.freedesktop.DBus.Properties", "PropertiesChanged")) {
-
- const char *path, *interface, *property = "Id";
- DBusMessageIter iter, sub;
-
- path = dbus_message_get_path(message);
-
- if (!dbus_message_get_args(message, &error,
- DBUS_TYPE_STRING, &interface,
- DBUS_TYPE_INVALID)) {
- log_error("Failed to parse message: %s", bus_error_message(&error));
- goto finish;
- }
-
- if (!streq(interface, "org.freedesktop.systemd1.Job") &&
- !streq(interface, "org.freedesktop.systemd1.Unit"))
- goto finish;
-
- if (!(m = dbus_message_new_method_call(
- "org.freedesktop.systemd1",
- path,
- "org.freedesktop.DBus.Properties",
- "Get"))) {
- log_error("Could not allocate message.");
- goto oom;
- }
-
- if (!dbus_message_append_args(m,
- DBUS_TYPE_STRING, &interface,
- DBUS_TYPE_STRING, &property,
- DBUS_TYPE_INVALID)) {
- log_error("Could not append arguments to message.");
- goto finish;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(connection, m, -1, &error))) {
- log_error("Failed to issue method call: %s", bus_error_message(&error));
- goto finish;
- }
-
- if (!dbus_message_iter_init(reply, &iter) ||
- dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) {
- log_error("Failed to parse reply.");
- goto finish;
- }
-
- dbus_message_iter_recurse(&iter, &sub);
-
- if (streq(interface, "org.freedesktop.systemd1.Unit")) {
- const char *id;
-
- if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) {
- log_error("Failed to parse reply.");
- goto finish;
- }
-
- dbus_message_iter_get_basic(&sub, &id);
- printf("Unit %s changed.\n", id);
- } else {
- uint32_t id;
-
- if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_UINT32) {
- log_error("Failed to parse reply.");
- goto finish;
- }
-
- dbus_message_iter_get_basic(&sub, &id);
- printf("Job %u changed.\n", id);
- }
- }
-
-finish:
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
-oom:
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
-}
-
-static int monitor(DBusConnection *bus, char **args, unsigned n) {
- DBusMessage *m = NULL, *reply = NULL;
- DBusError error;
- int r;
-
- dbus_error_init(&error);
-
- if (!private_bus) {
- dbus_bus_add_match(bus,
- "type='signal',"
- "sender='org.freedesktop.systemd1',"
- "interface='org.freedesktop.systemd1.Manager',"
- "path='/org/freedesktop/systemd1'",
- &error);
-
- if (dbus_error_is_set(&error)) {
- log_error("Failed to add match: %s", bus_error_message(&error));
- r = -EIO;
- goto finish;
- }
-
- dbus_bus_add_match(bus,
- "type='signal',"
- "sender='org.freedesktop.systemd1',"
- "interface='org.freedesktop.DBus.Properties',"
- "member='PropertiesChanged'",
- &error);
-
- if (dbus_error_is_set(&error)) {
- log_error("Failed to add match: %s", bus_error_message(&error));
- r = -EIO;
- goto finish;
- }
- }
-
- if (!dbus_connection_add_filter(bus, monitor_filter, NULL, NULL)) {
- log_error("Failed to add filter.");
- r = -ENOMEM;
- goto finish;
- }
-
- if (!(m = dbus_message_new_method_call(
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "Subscribe"))) {
- log_error("Could not allocate message.");
- r = -ENOMEM;
- goto finish;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s", bus_error_message(&error));
- r = -EIO;
- goto finish;
- }
-
- while (dbus_connection_read_write_dispatch(bus, -1))
- ;
-
- r = 0;
-
-finish:
-
- /* This is slightly dirty, since we don't undo the filter or the matches. */
-
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
- dbus_error_free(&error);
-
- return r;
-}
-
static int dump(DBusConnection *bus, char **args, unsigned n) {
DBusMessage *m = NULL, *reply = NULL;
DBusError error;
@@ -4293,7 +4065,6 @@ static int systemctl_help(void) {
" list-jobs List jobs\n"
" cancel [JOB...] Cancel all, one, or more jobs\n\n"
"Status Commands:\n"
- " monitor Monitor unit/job changes\n"
" dump Dump server status\n"
" dot Dump dependency graph for dot(1)\n\n"
"Snapshot Commands:\n"
@@ -5208,7 +4979,6 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
{ "check", MORE, 2, check_unit },
{ "show", MORE, 1, show },
{ "status", MORE, 2, show },
- { "monitor", EQUAL, 1, monitor },
{ "dump", EQUAL, 1, dump },
{ "dot", EQUAL, 1, dot },
{ "snapshot", LESS, 2, snapshot },
commit 34c4b47b7f00041be03919bd36500d0ffb3959d3
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 23 04:20:22 2011 +0200
systemctl: split --help into multiple sections
diff --git a/man/systemd.xml b/man/systemd.xml
index 5129fbb..fc48107 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -826,7 +826,7 @@
<literal>console</literal>
(resp. <literal>kmsg</literal> on
<literal>SIGRTMIN+28</literal>;
- resp.<literal>syslog-or-kmsg</literal>
+ resp. <literal>syslog-or-kmsg</literal>
on <literal>SIGRTMIN+29</literal>), as
controlled via
<varname>systemd.log_target=console</varname>
diff --git a/src/systemctl.c b/src/systemctl.c
index 36346ee..d94105e 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4265,7 +4265,7 @@ static int systemctl_help(void) {
" -f --force When enabling unit files, override existing symlinks\n"
" When shutting down, execute action immediately\n"
" --defaults When disabling unit files, remove default symlinks only\n\n"
- "Commands:\n"
+ "Unit Commands:\n"
" list-units List units\n"
" start [NAME...] Start (activate) one or more units\n"
" stop [NAME...] Stop (deactivate) one or more units\n"
@@ -4284,22 +4284,29 @@ static int systemctl_help(void) {
" units/jobs or the manager\n"
" reset-failed [NAME...] Reset failed state for all, one, or more\n"
" units\n"
+ " load [NAME...] Load one or more units\n\n"
+ "Unit File Commands:\n"
" enable [NAME...] Enable one or more unit files\n"
" disable [NAME...] Disable one or more unit files\n"
- " is-enabled [NAME...] Check whether unit files are enabled\n"
- " load [NAME...] Load one or more units\n"
+ " is-enabled [NAME...] Check whether unit files are enabled\n\n"
+ "Job Commands:\n"
" list-jobs List jobs\n"
- " cancel [JOB...] Cancel all, one, or more jobs\n"
+ " cancel [JOB...] Cancel all, one, or more jobs\n\n"
+ "Status Commands:\n"
" monitor Monitor unit/job changes\n"
" dump Dump server status\n"
- " dot Dump dependency graph for dot(1)\n"
+ " dot Dump dependency graph for dot(1)\n\n"
+ "Snapshot Commands:\n"
" snapshot [NAME] Create a snapshot\n"
- " delete [NAME...] Remove one or more snapshots\n"
- " daemon-reload Reload systemd manager configuration\n"
- " daemon-reexec Reexecute systemd manager\n"
+ " delete [NAME...] Remove one or more snapshots\n\n"
+ "Environment Commands:\n"
" show-environment Dump environment\n"
" set-environment [NAME=VALUE...] Set one or more environment variables\n"
- " unset-environment [NAME...] Unset one or more environment variables\n"
+ " unset-environment [NAME...] Unset one or more environment variables\n\n"
+ "Manager Lifecycle Commands:\n"
+ " daemon-reload Reload systemd manager configuration\n"
+ " daemon-reexec Reexecute systemd manager\n\n"
+ "System Commands:\n"
" default Enter system default mode\n"
" rescue Enter system rescue mode\n"
" emergency Enter system emergency mode\n"
More information about the systemd-commits
mailing list