X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fdbus-socket.c;h=60a8d0501c4feeb44dbe962201c4f84e8e8352ee;hb=30374ebe5e9f0b37e99dcbdc965c00fcf542f89d;hp=728958131db6db045fa7c7a135b232927614eedb;hpb=67419600875f3dae2182e3f92640bae4c8cd1f2f;p=elogind.git diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index 728958131..60a8d0501 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -22,24 +22,26 @@ #include #include "dbus-unit.h" -#include "dbus-socket.h" #include "dbus-execute.h" #include "dbus-kill.h" +#include "dbus-cgroup.h" #include "dbus-common.h" #include "selinux-access.h" +#include "dbus-socket.h" #define BUS_SOCKET_INTERFACE \ " \n" \ " \n" \ " \n" \ " \n" \ + BUS_UNIT_CGROUP_INTERFACE \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPre") \ BUS_EXEC_COMMAND_INTERFACE("ExecStartPost") \ BUS_EXEC_COMMAND_INTERFACE("ExecStopPre") \ BUS_EXEC_COMMAND_INTERFACE("ExecStopPost") \ BUS_EXEC_CONTEXT_INTERFACE \ BUS_KILL_CONTEXT_INTERFACE \ - BUS_UNIT_CGROUP_INTERFACE \ + BUS_CGROUP_CONTEXT_INTERFACE \ " \n" \ " \n" \ " \n" \ @@ -65,6 +67,7 @@ " \n" \ " \n" \ " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -84,7 +87,7 @@ BUS_UNIT_INTERFACES_LIST \ "org.freedesktop.systemd1.Socket\0" -const char bus_socket_interface[] _introspect_("Socket") = BUS_SOCKET_INTERFACE; +const char bus_socket_interface[] = BUS_SOCKET_INTERFACE; const char bus_socket_invalidating_properties[] = "ExecStartPre\0" @@ -114,7 +117,7 @@ static int bus_socket_append_listen(DBusMessageIter *i, const char *property, vo LIST_FOREACH(port, p, s->ports) { const char *type = socket_port_type_to_string(p); - char _cleanup_free_ *address = NULL; + _cleanup_free_ char *address = NULL; const char *a; if (!dbus_message_iter_open_container(&array, DBUS_TYPE_STRUCT, NULL, &stru)) @@ -192,24 +195,54 @@ static const BusProperty bus_socket_properties[] = { { "MessageQueueMaxMessages", bus_property_append_long, "x", offsetof(Socket, mq_maxmsg) }, { "MessageQueueMessageSize", bus_property_append_long, "x", offsetof(Socket, mq_msgsize) }, { "Result", bus_socket_append_socket_result, "s", offsetof(Socket, result) }, + { "ReusePort", bus_property_append_bool, "b", offsetof(Socket, reuseport) }, { "SmackLabel", bus_property_append_string, "s", offsetof(Socket, smack), true }, { "SmackLabelIPIn", bus_property_append_string, "s", offsetof(Socket, smack_ip_in), true }, { "SmackLabelIPOut",bus_property_append_string, "s", offsetof(Socket, smack_ip_out), true }, - { NULL, } + {} }; DBusHandlerResult bus_socket_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { Socket *s = SOCKET(u); const BusBoundProperties bps[] = { - { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, - { "org.freedesktop.systemd1.Socket", bus_socket_properties, s }, - { "org.freedesktop.systemd1.Socket", bus_exec_context_properties, &s->exec_context }, - { "org.freedesktop.systemd1.Socket", bus_kill_context_properties, &s->kill_context }, - { "org.freedesktop.systemd1.Socket", bus_unit_properties, u }, - { NULL, } + { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, + { "org.freedesktop.systemd1.Socket", bus_unit_cgroup_properties, u }, + { "org.freedesktop.systemd1.Socket", bus_socket_properties, s }, + { "org.freedesktop.systemd1.Socket", bus_exec_context_properties, &s->exec_context }, + { "org.freedesktop.systemd1.Socket", bus_kill_context_properties, &s->kill_context }, + { "org.freedesktop.systemd1.Socket", bus_cgroup_context_properties, &s->cgroup_context }, + {} }; SELINUX_UNIT_ACCESS_CHECK(u, c, message, "status"); return bus_default_message_handler(c, message, INTROSPECTION, INTERFACES_LIST, bps); } + +int bus_socket_set_property( + Unit *u, + const char *name, + DBusMessageIter *i, + UnitSetPropertiesMode mode, + DBusError *error) { + + Socket *s = SOCKET(u); + int r; + + assert(name); + assert(u); + assert(i); + + r = bus_cgroup_set_property(u, &s->cgroup_context, name, i, mode, error); + if (r != 0) + return r; + + return 0; +} + +int bus_socket_commit_properties(Unit *u) { + assert(u); + + unit_realize_cgroup(u); + return 0; +}