aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-06-29 22:04:58 +0200
committerHarald Welte <laforge@osmocom.org>2020-06-29 23:10:31 +0200
commitbbd39359eb8e8fbc44efd760688374ee925708e5 (patch)
tree12f1c3f2f94408c36d2fb068ba8c0ed9ab6823b9
parent4b1f06a47f5b2e41d81fb9452fa708185970779b (diff)
extend logging (log more noteworthy events)
Let's log some more events that might happen. Change-Id: I37fd290f0f0621fbf6e20e33fa709efc14df94c7
-rw-r--r--src/ctl.c6
-rw-r--r--src/intf_line.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 1fa5d84..b29e990 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -31,11 +31,13 @@
#include <osmocom/core/isdnhdlc.h>
#include <osmocom/core/msgb.h>
+#include <osmocom/core/logging.h>
#include <osmocom/e1d/proto.h>
#include <osmocom/e1d/proto_srv.h>
#include "e1d.h"
+#include "log.h"
struct e1_intf *
@@ -94,6 +96,8 @@ _e1d_fill_ts_info(struct osmo_e1dp_ts_info *ti, struct e1_ts *ts)
void
e1_ts_stop(struct e1_ts *ts)
{
+ LOGPTS(ts, DE1D, LOGL_INFO, "Stopping\n");
+
ts->mode = E1_TS_MODE_OFF;
if (ts->fd >= 0) {
@@ -107,6 +111,8 @@ _e1d_ts_start(struct e1_ts *ts, enum e1_ts_mode mode)
{
int ret, sd[2];
+ LOGPTS(ts, DE1D, LOGL_INFO, "Starting in mode %u\n", mode);
+
ret = socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sd);
if (ret < 0)
return ret;
diff --git a/src/intf_line.c b/src/intf_line.c
index 305f5dd..a1fbc0f 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -64,6 +64,8 @@ e1_intf_new(struct e1_daemon *e1d, void *drv_data)
llist_add_tail(&intf->list, &e1d->interfaces);
+ LOGPIF(intf, DE1D, LOGL_NOTICE, "Created\n");
+
return intf;
}
@@ -72,6 +74,8 @@ e1_intf_destroy(struct e1_intf *intf)
{
struct e1_line *line, *line2;
+ LOGPIF(intf, DE1D, LOGL_NOTICE, "Destroying\n");
+
/* destroy all lines */
llist_for_each_entry_safe(line, line2, &intf->lines, list)
e1_line_destroy(line);
@@ -107,12 +111,16 @@ e1_line_new(struct e1_intf *intf, void *drv_data)
llist_add_tail(&line->list, &intf->lines);
+ LOGPLI(line, DE1D, LOGL_NOTICE, "Created\n");
+
return line;
}
void
e1_line_destroy(struct e1_line *line)
{
+ LOGPLI(line, DE1D, LOGL_NOTICE, "Destroying\n");
+
/* close all [peer] file descriptors */
for (int i=0; i<32; i++)
e1_ts_stop(&line->ts[i]);
@@ -243,7 +251,7 @@ e1_line_mux_out(struct e1_line *line, uint8_t *buf, int fts)
}
if (l < 0 && errno != EAGAIN) {
- LOGP(DE1D, LOGL_ERROR, "dead socket during read: %s\n",
+ LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during read: %s\n",
strerror(errno));
e1_ts_stop(ts);
}
@@ -300,7 +308,7 @@ e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size)
continue;
}
if (rv < 0 && errno != EAGAIN) {
- LOGP(DE1D, LOGL_ERROR, "dead socket during write: %s\n",
+ LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during write: %s\n",
strerror(errno));
e1_ts_stop(ts);
}