[systemd-commits] 2 commits - Makefile.am src/core units/basic.target units/machine.slice units/slices.target units/system.slice units/user.slice
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jun 17 16:02:35 PDT 2013
Makefile.am | 7 +++++++
src/core/dbus-unit.c | 20 ++++++++++++++++++++
src/core/dbus-unit.h | 1 +
units/basic.target | 4 ++--
units/machine.slice | 13 +++++++++++++
units/slices.target | 12 ++++++++++++
units/system.slice | 11 +++++++++++
units/user.slice | 13 +++++++++++++
8 files changed, 79 insertions(+), 2 deletions(-)
New commits:
commit 4ec9a8a48d61266638524a7cbc2c4763a9c92e2c
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Jun 18 01:00:13 2013 +0200
core: expose a "Slice" property on Unit objects on the bus
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 575f8eb..b7391b5 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -81,6 +81,25 @@ static int bus_unit_append_following(DBusMessageIter *i, const char *property, v
return 0;
}
+static int bus_unit_append_slice(DBusMessageIter *i, const char *property, void *data) {
+ Unit *u = data;
+ const char *d;
+
+ assert(i);
+ assert(property);
+ assert(u);
+
+ if (UNIT_DEREF(u->slice))
+ d = UNIT_DEREF(u->slice)->id;
+ else
+ d = "";
+
+ if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &d))
+ return -ENOMEM;
+
+ return 0;
+}
+
static int bus_unit_append_dependencies(DBusMessageIter *i, const char *property, void *data) {
Unit *u;
Iterator j;
@@ -1255,6 +1274,7 @@ const BusProperty bus_unit_properties[] = {
{ "Id", bus_property_append_string, "s", offsetof(Unit, id), true },
{ "Names", bus_unit_append_names, "as", 0 },
{ "Following", bus_unit_append_following, "s", 0 },
+ { "Slice", bus_unit_append_slice, "s", 0 },
{ "Requires", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES]), true },
{ "RequiresOverridable", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES_OVERRIDABLE]), true },
{ "Requisite", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUISITE]), true },
diff --git a/src/core/dbus-unit.h b/src/core/dbus-unit.h
index acd1ddb..83932c5 100644
--- a/src/core/dbus-unit.h
+++ b/src/core/dbus-unit.h
@@ -64,6 +64,7 @@
" <property name=\"Id\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Names\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"Following\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"Slice\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Requires\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"RequiresOverridable\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"Requisite\" type=\"as\" access=\"read\"/>\n" \
commit f2561e85982ed25b610cad6253599a051f9ec8e2
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Jun 18 00:59:54 2013 +0200
units: add default units for system.slice, user.slice, machine.slice
diff --git a/Makefile.am b/Makefile.am
index 5a285be..f84236d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -222,6 +222,7 @@ install-target-wants-hook:
what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && $(add-wants)
what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && $(add-wants)
what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && $(add-wants)
+ what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
define add-wants
[ -z "$$what" ] || ( \
@@ -376,6 +377,10 @@ dist_systemunit_DATA = \
units/paths.target \
units/suspend.target \
units/swap.target \
+ units/slices.target \
+ units/system.slice \
+ units/user.slice \
+ units/machine.slice \
units/systemd-initctl.socket \
units/systemd-shutdownd.socket \
units/syslog.socket \
@@ -4181,6 +4186,8 @@ USER_UNIT_ALIASES += \
GENERAL_ALIASES += \
$(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \
$(systemunitdir)/getty at .service $(pkgsysconfdir)/system/getty.target.wants/getty at tty1.service \
+ $(systemunitdir)/machine.slice $(pkgsysconfdir)/system/slices.target.wants/machine.slice \
+ $(systemunitdir)/user.slice $(pkgsysconfdir)/system/slices.target.wants/user.slice \
$(pkgsysconfdir)/user $(sysconfdir)/xdg/systemd/user \
../system-services/org.freedesktop.systemd1.service $(dbussessionservicedir)/org.freedesktop.systemd1.service
diff --git a/units/basic.target b/units/basic.target
index 6b9cfe4..d7c68f4 100644
--- a/units/basic.target
+++ b/units/basic.target
@@ -9,6 +9,6 @@
Description=Basic System
Documentation=man:systemd.special(7)
Requires=sysinit.target
-Wants=sockets.target timers.target paths.target
-After=sysinit.target sockets.target timers.target paths.target
+Wants=sockets.target timers.target paths.target slices.target
+After=sysinit.target sockets.target timers.target paths.target slices.target
RefuseManualStart=yes
diff --git a/units/machine.slice b/units/machine.slice
new file mode 100644
index 0000000..6b1754b
--- /dev/null
+++ b/units/machine.slice
@@ -0,0 +1,13 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Virtual Machine and Container Slice
+Documentation=man:systemd.special(7)
+
+[Install]
+WantedBy=slices.target
diff --git a/units/slices.target b/units/slices.target
new file mode 100644
index 0000000..cbfdba0
--- /dev/null
+++ b/units/slices.target
@@ -0,0 +1,12 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Slices
+Documentation=man:systemd.special(7)
+Wants=system.slice
+After=system.slice
diff --git a/units/system.slice b/units/system.slice
new file mode 100644
index 0000000..f78ecb4
--- /dev/null
+++ b/units/system.slice
@@ -0,0 +1,11 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=System Slice
+Documentation=man:systemd.special(7)
+DefaultDependencies=no
diff --git a/units/user.slice b/units/user.slice
new file mode 100644
index 0000000..dfaa44b
--- /dev/null
+++ b/units/user.slice
@@ -0,0 +1,13 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=User and Session Slice
+Documentation=man:systemd.special(7)
+
+[Install]
+WantedBy=slices.target
More information about the systemd-commits
mailing list