summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-08-28 15:46:29 +0200
committerTom Gundersen <teg@jklm.no>2014-08-28 21:19:17 +0200
commit9021bb9f935c93b516b10c88db2a212a9e3a8140 (patch)
tree812f2077c86db0d38da59649b03d0728ddd363a0 /src
parent752bbf75b9b52c0faae29bb4b77a99c4bb0d298f (diff)
sd-event: name event sources used in libraries
This should help in debugging failing event sources.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c35
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c30
-rw-r--r--src/libsystemd-network/sd-icmp6-nd.c13
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c11
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c16
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c12
-rw-r--r--src/network/networkd-manager.c4
7 files changed, 121 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 8a9887d19f..7cf1b80d29 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -700,6 +700,11 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
+
switch (client->state) {
case DHCP_STATE_INIT:
r = client_send_discover(client);
@@ -773,6 +778,11 @@ static int client_initialize_io_events(sd_dhcp_client *client,
if (r < 0)
goto error;
+ r = sd_event_source_set_name(client->receive_message,
+ "dhcp4-receive-message");
+ if (r < 0)
+ goto error;
+
error:
if (r < 0)
client_stop(client, r);
@@ -799,6 +809,11 @@ static int client_initialize_time_events(sd_dhcp_client *client) {
r = sd_event_source_set_priority(client->timeout_resend,
client->event_priority);
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
+
error:
if (r < 0)
client_stop(client, r);
@@ -1107,6 +1122,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_expire,
+ "dhcp4-lifetime");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "lease expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
lifetime_timeout - time_now, 0));
@@ -1130,6 +1150,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_t2,
+ "dhcp4-t2-timeout");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "T2 expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
t2_timeout - time_now, 0));
@@ -1152,6 +1177,11 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_t1,
+ "dhcp4-t1-timer");
+ if (r < 0)
+ return r;
+
log_dhcp_client(client, "T1 expires in %s",
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
t1_timeout - time_now, 0));
@@ -1192,6 +1222,11 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
client->event_priority);
if (r < 0)
goto error;
+
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp4-resend-timer");
+ if (r < 0)
+ goto error;
} else if (r == -ENOMSG)
/* invalid message, let's ignore it */
return 0;
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index f69c0ed8a6..342a231413 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -496,6 +496,11 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp6-resend-timer");
+ if (r < 0)
+ goto error;
+
if (max_retransmit_duration && !client->timeout_resend_expire) {
log_dhcp6_client(client, "Max retransmission duration %"PRIu64" secs",
@@ -514,6 +519,11 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
client->event_priority);
if (r < 0)
goto error;
+
+ r = sd_event_source_set_name(client->timeout_resend_expire,
+ "dhcp6-resend-expire-timer");
+ if (r < 0)
+ goto error;
}
error:
@@ -894,6 +904,11 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->receive_message,
+ "dhcp6-receive-message");
+ if (r < 0)
+ return r;
+
client->state = DHCP6_STATE_SOLICITATION;
break;
@@ -942,6 +957,11 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->lease->ia.timeout_t1,
+ "dhcp6-t1-timeout");
+ if (r < 0)
+ return r;
+
timeout = client_timeout_compute_random(be32toh(client->lease->ia.lifetime_t2) * USEC_PER_SEC);
log_dhcp6_client(client, "T2 expires in %s",
@@ -962,6 +982,11 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->lease->ia.timeout_t2,
+ "dhcp6-t2-timeout");
+ if (r < 0)
+ return r;
+
client->state = state;
return 0;
@@ -980,6 +1005,11 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
+ r = sd_event_source_set_name(client->timeout_resend,
+ "dhcp6-resend-timeout");
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/src/libsystemd-network/sd-icmp6-nd.c b/src/libsystemd-network/sd-icmp6-nd.c
index b264e793ee..243f06a85f 100644
--- a/src/libsystemd-network/sd-icmp6-nd.c
+++ b/src/libsystemd-network/sd-icmp6-nd.c
@@ -277,6 +277,12 @@ static int icmp6_router_solicitation_timeout(sd_event_source *s, uint64_t usec,
icmp6_nd_notify(nd, r);
return 0;
}
+
+ r = sd_event_source_set_name(nd->timeout, "icmp6-timeout");
+ if (r < 0) {
+ icmp6_nd_notify(nd, r);
+ return 0;
+ }
}
return 0;
@@ -322,13 +328,20 @@ int sd_icmp6_router_solicitation_start(sd_icmp6_nd *nd) {
if (r < 0)
goto error;
+ r = sd_event_source_set_name(nd->recv, "icmp6-receive-message");
+ if (r < 0)
+ goto error;
+
r = sd_event_add_time(nd->event, &nd->timeout, clock_boottime_or_monotonic(),
0, 0, icmp6_router_solicitation_timeout, nd);
if (r < 0)
goto error;
r = sd_event_source_set_priority(nd->timeout, nd->event_priority);
+ if (r < 0)
+ goto error;
+ r = sd_event_source_set_name(nd->timeout, "icmp6-timeout");
error:
if (r < 0)
icmp6_nd_init(nd);
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index b17987904a..3d15fc85ea 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -352,6 +352,10 @@ static void ipv4ll_run_state_machine(sd_ipv4ll *ll, IPv4LLTrigger trigger, void
r = sd_event_source_set_priority(ll->timer, ll->event_priority);
if (r < 0)
goto out;
+
+ r = sd_event_source_set_name(ll->timer, "ipv4ll-timer");
+ if (r < 0)
+ goto out;
}
out:
@@ -560,6 +564,10 @@ int sd_ipv4ll_start (sd_ipv4ll *ll) {
if (r < 0)
goto out;
+ r = sd_event_source_set_name(ll->timer, "ipv4ll-receive-message");
+ if (r < 0)
+ goto out;
+
r = sd_event_add_time(ll->event,
&ll->timer,
clock_boottime_or_monotonic(),
@@ -570,7 +578,10 @@ int sd_ipv4ll_start (sd_ipv4ll *ll) {
goto out;
r = sd_event_source_set_priority(ll->timer, ll->event_priority);
+ if (r < 0)
+ goto out;
+ r = sd_event_source_set_name(ll->timer, "ipv4ll-timer");
out:
if (r < 0)
ipv4ll_stop(ll, IPV4LL_EVENT_STOP);
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 8caa404227..78e91b9654 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -3013,6 +3013,10 @@ static int attach_io_events(sd_bus *bus) {
return r;
r = sd_event_source_set_priority(bus->input_io_event_source, bus->event_priority);
+ if (r < 0)
+ return r;
+
+ r = sd_event_source_set_name(bus->input_io_event_source, "bus-input");
} else
r = sd_event_source_set_io_fd(bus->input_io_event_source, bus->input_fd);
@@ -3028,6 +3032,10 @@ static int attach_io_events(sd_bus *bus) {
return r;
r = sd_event_source_set_priority(bus->output_io_event_source, bus->event_priority);
+ if (r < 0)
+ return r;
+
+ r = sd_event_source_set_name(bus->input_io_event_source, "bus-output");
} else
r = sd_event_source_set_io_fd(bus->output_io_event_source, bus->output_fd);
@@ -3080,10 +3088,18 @@ _public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
if (r < 0)
goto fail;
+ r = sd_event_source_set_name(bus->time_event_source, "bus-time");
+ if (r < 0)
+ goto fail;
+
r = sd_event_add_exit(bus->event, &bus->quit_event_source, quit_callback, bus);
if (r < 0)
goto fail;
+ r = sd_event_source_set_name(bus->quit_event_source, "bus-exit");
+ if (r < 0)
+ goto fail;
+
r = attach_io_events(bus);
if (r < 0)
goto fail;
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index c19bad1bc9..f883f2842c 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -859,6 +859,10 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
+ r = sd_event_source_set_name(rtnl->io_event_source, "rtnl-receive-message");
+ if (r < 0)
+ goto fail;
+
r = sd_event_source_set_prepare(rtnl->io_event_source, prepare_callback);
if (r < 0)
goto fail;
@@ -871,10 +875,18 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
+ r = sd_event_source_set_name(rtnl->time_event_source, "rtnl-timer");
+ if (r < 0)
+ goto fail;
+
r = sd_event_add_exit(rtnl->event, &rtnl->exit_event_source, exit_callback, rtnl);
if (r < 0)
goto fail;
+ r = sd_event_source_set_name(rtnl->exit_event_source, "rtnl-exit");
+ if (r < 0)
+ goto fail;
+
return 0;
fail:
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index f2fe5d5443..5a4f93a06b 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -370,6 +370,10 @@ int manager_udev_listen(Manager *m) {
if (r < 0)
return r;
+ r = sd_event_source_set_name(m->udev_event_source, "networkd-udev");
+ if (r < 0)
+ return r;
+
return 0;
}