diff options
author | hunt <hunt> | 2007-03-18 18:19:26 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-03-18 18:19:26 +0000 |
commit | 56bae3425ce425d5f0424887caa77d95a88b9803 (patch) | |
tree | eb67e663f01b3378af7f4aaa1fc66dc57aa66fe7 /runtime/staprun/mainloop.c | |
parent | 3d48c9833362aabc5faacb1f237e9914b794a247 (diff) | |
download | systemtap-steved-56bae3425ce425d5f0424887caa77d95a88b9803.tar.gz systemtap-steved-56bae3425ce425d5f0424887caa77d95a88b9803.tar.xz systemtap-steved-56bae3425ce425d5f0424887caa77d95a88b9803.zip |
2007-03-18 Martin Hunt <hunt@redhat.com>
* staprun.h (VERSION_CMD): Command to use for version check.
Changes to support runtime decision on new or old transport.
* mainloop.c (init_staprun): Check the kernel version at runtime
instead of at compile time.
(cleanup_and_exit): Call the correct relayfs close function.
(stp_main_loop): Call the correct relayfs init function.
* relay.c: Remove ifdef wrapper. File is always compiled and used
if the kernel version is appropriate.
* relay_old.c: Ditto.
Diffstat (limited to 'runtime/staprun/mainloop.c')
-rw-r--r-- | runtime/staprun/mainloop.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 7ef2efd0..b18976fc 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -15,6 +15,7 @@ /* globals */ int control_channel = 0; int ncpus; +int use_old_transport = 0; /** * send_request - send request to kernel over control channel @@ -155,6 +156,12 @@ int init_staprun(void) return 1; } + + if (system(VERSION_CMD)) { + dbug("Using OLD TRANSPORT\n"); + use_old_transport = 1; + } + /* insert module */ sprintf(buf, "_stp_pid=%d", (int)getpid()); sprintf(bufcmd, "_stp_bufsize=%d", buffer_size); @@ -221,7 +228,10 @@ void cleanup_and_exit (int closed) fprintf(stderr,"\nWaititing for processes to exit\n"); while(wait(NULL) > 0) ; - close_relayfs(); + if (use_old_transport) + close_oldrelayfs(); + else + close_relayfs(); dbug("closing control channel\n"); close_ctl_channel(); @@ -281,10 +291,12 @@ int stp_main_loop(void) signal(SIGTERM, sigproc); signal(SIGHUP, sigproc); signal(SIGCHLD, sigproc); + signal(SIGQUIT, sigproc); +/* if (driver_pid) driver_poll(0); - +*/ dbug("in main loop\n"); while (1) { /* handle messages from control channel */ @@ -336,12 +348,15 @@ int stp_main_loop(void) case STP_TRANSPORT: { struct _stp_msg_start ts; - if (init_relayfs((struct _stp_msg_trans *)data) < 0) - cleanup_and_exit(0); - else { - ts.target = target_pid; - send_request(STP_START, &ts, sizeof(ts)); + if (use_old_transport) { + if (init_oldrelayfs((struct _stp_msg_trans *)data) < 0) + cleanup_and_exit(0); + } else { + if (init_relayfs((struct _stp_msg_trans *)data) < 0) + cleanup_and_exit(0); } + ts.target = target_pid; + send_request(STP_START, &ts, sizeof(ts)); break; } case STP_MODULE: |