summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhunt <hunt>2005-07-19 06:52:14 +0000
committerhunt <hunt>2005-07-19 06:52:14 +0000
commit5ecb5763771af8db1b67cf2a2fb4a40c5107cd0f (patch)
tree8b7e02d25e00f30f90471158b06bf4a6e6d9147f
parent76e4b4ac675075e22be62935dc438139c4b17cb1 (diff)
downloadsystemtap-steved-5ecb5763771af8db1b67cf2a2fb4a40c5107cd0f.tar.gz
systemtap-steved-5ecb5763771af8db1b67cf2a2fb4a40c5107cd0f.tar.xz
systemtap-steved-5ecb5763771af8db1b67cf2a2fb4a40c5107cd0f.zip
2005-07-18 Martin Hunt <hunt@redhat.com>
* transport.h (_stp_transport_write): Call _stp_relay_write(). * transport.c (_stp_cleanup_and_exit): Print transport failure count. (_stp_relay_write): Like relay_write() except returns -1 on error.
-rw-r--r--runtime/transport/ChangeLog9
-rw-r--r--runtime/transport/transport.c37
-rw-r--r--runtime/transport/transport.h4
3 files changed, 47 insertions, 3 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index 09ea19e2..e0080601 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,12 @@
+2005-07-18 Martin Hunt <hunt@redhat.com>
+
+ * transport.h (_stp_transport_write): Call _stp_relay_write().
+
+ * transport.c (_stp_cleanup_and_exit): Print transport
+ failure count.
+ (_stp_relay_write): Like relay_write() except returns
+ -1 on error.
+
2005-07-14 Tom Zanussi <zanussi@us.ibm.com>
* netlink.c (_stp_netlink_open): Add missing delayed_pkts
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index 18177ab2..d5699303 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -114,11 +114,15 @@ static void _stp_cleanup_and_exit (char *name)
int trylimit = 50;
if (_stp_exit_called == 0) {
+
+ int failures = atomic_read(&_stp_transport_failures);
_stp_exit_called = 1;
probe_exit();
+ if (failures)
+ _stp_warn ("There were %d transport failures.\n", failures);
_stp_transport_flush();
}
-
+
while (_stp_ctrl_send(STP_EXIT, name, strlen(name)+1, _stp_tport->pid) < 0 && trylimit--)
msleep (5);
}
@@ -126,6 +130,9 @@ static void _stp_cleanup_and_exit (char *name)
/*
* Call probe_exit() if necessary and send a message to stpd to unload the module.
*/
+
+
+
static void stp_exit_helper (void *data)
{
_stp_cleanup_and_exit(__this_module.name);
@@ -180,7 +187,7 @@ void _stp_transport_close()
{
if (!_stp_tport)
return;
-
+
_stp_ctrl_unregister(_stp_tport->pid);
if (!_stp_streaming())
_stp_relayfs_close(_stp_tport->chan, _stp_tport->dir);
@@ -245,5 +252,31 @@ int _stp_transport_send (int pid, void *data, int len)
return err;
}
+/* like relay_write except returns an error code */
+
+static int _stp_relay_write (struct rchan *chan,
+ const void *data,
+ unsigned length)
+{
+ unsigned long flags;
+ struct rchan_buf *buf;
+
+ if (unlikely(length == 0))
+ return 0;
+
+ local_irq_save(flags);
+ buf = chan->buf[smp_processor_id()];
+ if (unlikely(buf->offset + length > chan->subbuf_size))
+ length = relay_switch_subbuf(buf, length);
+ memcpy(buf->data + buf->offset, data, length);
+ buf->offset += length;
+ local_irq_restore(flags);
+
+ if (unlikely(length == 0))
+ return -1;
+
+ return length;
+}
+
/** @} */
#endif /* _TRANSPORT_C_ */
diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h
index 463d7671..3a4c6839 100644
--- a/runtime/transport/transport.h
+++ b/runtime/transport/transport.h
@@ -9,6 +9,8 @@
#include "netlink.h"
#include "relayfs.h"
+void _stp_warn (const char *fmt, ...);
+
static unsigned n_subbufs = 4;
static unsigned subbuf_size = 65536;
@@ -74,7 +76,7 @@ struct transport_info
#ifdef STP_NETLINK_ONLY
#define _stp_transport_write(t, data, len) _stp_transport_send (t->pid, data, len)
#else
-#define _stp_transport_write(t, data, len) relay_write(t->chan, data, len)
+#define _stp_transport_write(t, data, len) _stp_relay_write(t->chan, data, len)
#endif
extern void _stp_transport_cleanup(void);