diff options
Diffstat (limited to 'runtime/staprun')
-rw-r--r-- | runtime/staprun/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/staprun/common.c | 22 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 23 | ||||
-rw-r--r-- | runtime/staprun/stapio.c | 9 |
4 files changed, 32 insertions, 27 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog index 71e4d412..e2da236e 100644 --- a/runtime/staprun/ChangeLog +++ b/runtime/staprun/ChangeLog @@ -1,3 +1,8 @@ +2008-04-22 Martin Hunt <hunt@redhat.com> + + * mainloop.c (send_request): Move here from common.c + staprun no longer send any messages. + 2008-04-22 hunt <hunt@redhat.com> * common.c (usage): Add -d option. diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c index d07f85b1..2ae1d8e4 100644 --- a/runtime/staprun/common.c +++ b/runtime/staprun/common.c @@ -296,28 +296,6 @@ void setup_signals(void) #endif } -/** - * send_request - send request to kernel over control channel - * @type: the relay-app command id - * @data: pointer to the data to be sent - * @len: length of the data to be sent - * - * Returns 0 on success, negative otherwise. - */ -int send_request(int type, void *data, int len) -{ - char buf[1024]; - - /* Before doing memcpy, make sure 'buf' is big enough. */ - if ((len + 4) > (int)sizeof(buf)) { - _err("exceeded maximum send_request size.\n"); - return -1; - } - memcpy(buf, &type, 4); - memcpy(&buf[4], data, len); - return write(control_channel, buf, len+4); -} - /* * set FD_CLOEXEC for any file descriptor */ diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index f8328268..37a4f58a 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -19,6 +19,29 @@ static int use_old_transport = 0; enum _stp_sig_type { sig_none, sig_done, sig_detach }; static enum _stp_sig_type got_signal = sig_none; +/** + * send_request - send request to kernel over control channel + * @type: the relay-app command id + * @data: pointer to the data to be sent + * @len: length of the data to be sent + * + * Returns 0 on success, negative otherwise. + */ +int send_request(int type, void *data, int len) +{ + char buf[1024]; + + /* Before doing memcpy, make sure 'buf' is big enough. */ + if ((len + 4) > (int)sizeof(buf)) { + _err("exceeded maximum send_request size.\n"); + return -1; + } + memcpy(buf, &type, 4); + memcpy(&buf[4], data, len); + return write(control_channel, buf, len+4); +} + + static void sigproc(int signum) { dbug(2, "sigproc %d (%s)\n", signum, strsignal(signum)); diff --git a/runtime/staprun/stapio.c b/runtime/staprun/stapio.c index 70e40004..b591244f 100644 --- a/runtime/staprun/stapio.c +++ b/runtime/staprun/stapio.c @@ -27,7 +27,6 @@ char *__name__ = "stapio"; int main(int argc, char **argv) { setup_signals(); - parse_args(argc, argv); if (buffer_size) @@ -38,13 +37,13 @@ int main(int argc, char **argv) dbug(2, "modpath=\"%s\", modname=\"%s\"\n", modpath, modname); } - if (optind < argc) { + if (optind < argc) { if (attach_mod) { err("ERROR: Cannot have module options with attach (-A).\n"); usage(argv[0]); } else { - unsigned start_idx = 3; /* reserve three slots in modoptions[] */ - while (optind < argc && start_idx+1 < MAXMODOPTIONS) + unsigned start_idx = 3; /* reserve three slots in modoptions[] */ + while (optind < argc && start_idx + 1 < MAXMODOPTIONS) modoptions[start_idx++] = argv[optind++]; modoptions[start_idx] = NULL; } @@ -57,7 +56,7 @@ int main(int argc, char **argv) if (init_stapio()) exit(1); - + if (stp_main_loop()) { err("ERROR: Couldn't enter main loop. Exiting.\n"); exit(1); |