summaryrefslogtreecommitdiff
path: root/src/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-30 02:19:12 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-05 19:50:00 +0200
commitd9ff321ad9477664c34b81a9dd4fce616e44124e (patch)
tree96d0cc7c435b52309253b584b2b61f13096b61c1 /src/load-fragment.c
parent20ed3656786a36f58a27901356e67d03cdd6de5e (diff)
socket: make service to start on incoming traffic configurable
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r--src/load-fragment.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 4395fb280c..eba3fdbdfd 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1226,6 +1226,40 @@ static int config_parse_path_unit(
return 0;
}
+static int config_parse_socket_service(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ Socket *s = data;
+ int r;
+ DBusError error;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ dbus_error_init(&error);
+
+ if (endswith(rvalue, ".service")) {
+ log_error("[%s:%u] Unit must be of type serivce, ignoring: %s", filename, line, rvalue);
+ return 0;
+ }
+
+ if ((r = manager_load_unit(s->meta.manager, rvalue, NULL, &error, (Unit**) &s->service)) < 0) {
+ log_error("[%s:%u] Failed to load unit %s, ignoring: %s", filename, line, rvalue, bus_error(&error, r));
+ dbus_error_free(&error);
+ return 0;
+ }
+
+ return 0;
+}
+
static int config_parse_env_file(
const char *filename,
unsigned line,
@@ -1654,6 +1688,7 @@ static int load_from_path(Unit *u, const char *path) {
{ "PipeSize", config_parse_size, &u->socket.pipe_size, "Socket" },
{ "FreeBind", config_parse_bool, &u->socket.free_bind, "Socket" },
{ "TCPCongestion", config_parse_string, &u->socket.tcp_congestion, "Socket" },
+ { "Service", config_parse_socket_service, &u->socket, "Socket" },
EXEC_CONTEXT_CONFIG_ITEMS(u->socket.exec_context, "Socket"),
{ "What", config_parse_string, &u->mount.parameters_fragment.what, "Mount" },