summaryrefslogtreecommitdiffstats
path: root/runtime/staprun
diff options
context:
space:
mode:
authorhunt <hunt>2007-03-20 20:21:36 +0000
committerhunt <hunt>2007-03-20 20:21:36 +0000
commit6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3 (patch)
tree72a9861b7d77b0cbfa87f1328892d78417e9ab82 /runtime/staprun
parenta39e781f2dcd56e155b0612cb1e045bb485c5c23 (diff)
downloadsystemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.tar.gz
systemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.tar.xz
systemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.zip
2007-03-20 Martin Hunt <hunt@redhat.com>
* symbols.c (send_module): If send returns < 0 then cleanup and exit. (do_kernel_symbols): Ditto.
Diffstat (limited to 'runtime/staprun')
-rw-r--r--runtime/staprun/ChangeLog6
-rw-r--r--runtime/staprun/mainloop.c1
-rw-r--r--runtime/staprun/symbols.c28
3 files changed, 29 insertions, 6 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index c55e8850..50d56ce3 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-20 Martin Hunt <hunt@redhat.com>
+
+ * symbols.c (send_module): If send returns < 0 then
+ cleanup and exit.
+ (do_kernel_symbols): Ditto.
+
2007-03-18 Martin Hunt <hunt@redhat.com>
* staprun.h (err): Define.
* symbols.c (get_sections): More overflow checking.
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index ba34b265..0bede8cf 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -359,6 +359,7 @@ int stp_main_loop(void)
}
case STP_MODULE:
{
+ dbug("STP_MODULES request received\n");
do_module(data);
break;
}
diff --git a/runtime/staprun/symbols.c b/runtime/staprun/symbols.c
index ca18a8ca..c8758c37 100644
--- a/runtime/staprun/symbols.c
+++ b/runtime/staprun/symbols.c
@@ -128,8 +128,12 @@ void send_module (char *mname)
{
char data[32768];
int len = get_sections(mname, data, sizeof(data));
- if (len)
- send_request(STP_MODULE, data, len);
+ if (len) {
+ if (send_request(STP_MODULE, data, len) < 0) {
+ err("Loading of module %s failed. Exiting...\n", mname);
+ cleanup_and_exit(0);
+ }
+ }
}
int do_module (void *data)
@@ -221,20 +225,32 @@ void do_kernel_symbols(void)
*(int *)buf = STP_SYMBOLS;
*(int *)(buf+sizeof(long)) = num_syms;
*(int *)(buf+sizeof(long)+sizeof(int)) = (unsigned)(dataptr - data);
- send_data(buf, 2*sizeof(int)+sizeof(long));
+ if (send_data(buf, 2*sizeof(int)+sizeof(long)) < 0)
+ goto err;
/* send syms */
- send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long));
+ if (send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long)) < 0)
+ goto err;
/* send data */
- send_data(data_base, dataptr-data+sizeof(long));
+ if (send_data(data_base, dataptr-data+sizeof(long)) < 0)
+ goto err;
free(data_base);
free(sym_base);
fclose(kallsyms);
if (dataptr >= datamax) {
- fprintf(stderr,"Error: overflowed symbol data area.\n");
+ err("Error: overflowed symbol data area.\n");
cleanup_and_exit(0);
}
+ return;
+
+err:
+ free(data_base);
+ free(sym_base);
+ fclose(kallsyms);
+
+ err("Loading of symbols failed. Exiting...\n");
+ cleanup_and_exit(0);
}