From da5bc00621edbd01f290b8f779b075d3048c99a0 Mon Sep 17 00:00:00 2001 From: hunt Date: Mon, 2 Apr 2007 17:03:57 +0000 Subject: 2007-04-02 Martin Hunt * relay_old.c (close_oldrelayfs): If just detaching, call pthread_cancel. (open_relayfs_files): Just return 0 if relay_fd[cpu] not opened. (init_oldrelayfs): Scan percpu files to calculate ncpus. * mainloop.c (init_staprun): Call old transport init when necessary. (cleanup_and_exit): Ignore signals when cleaning up. * ctl.c (read_buffer_info): For old transport, need to read transport parameters. --- runtime/staprun/mainloop.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'runtime/staprun/mainloop.c') diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index d3b3d3b7..720f9ec5 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -143,9 +143,16 @@ int init_staprun(void) if (attach_mod) { if (init_ctl_channel() < 0) return -1; - if (init_relayfs() < 0) { - close_ctl_channel(); - return -1; + if (use_old_transport) { + if (init_oldrelayfs() < 0) { + close_ctl_channel(); + return -1; + } + } else { + if (init_relayfs() < 0) { + close_ctl_channel(); + return -1; + } } return 0; } @@ -204,6 +211,11 @@ void cleanup_and_exit (int closed) pid_t err; static int exiting = 0; + signal(SIGINT, SIG_IGN); + signal(SIGTERM, SIG_IGN); + signal(SIGHUP, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + if (exiting) return; exiting = 1; @@ -217,7 +229,7 @@ void cleanup_and_exit (int closed) while(wait(NULL) > 0) ; if (use_old_transport) - close_oldrelayfs(); + close_oldrelayfs(closed == 2); else close_relayfs(); @@ -228,8 +240,7 @@ void cleanup_and_exit (int closed) dbug("removing module\n"); snprintf(tmpbuf, sizeof(tmpbuf), "/sbin/rmmod -w %s", modname); if (system(tmpbuf)) { - fprintf(stderr, "ERROR: couldn't rmmod probe module %s. No output will be written.\n", - modname); + fprintf(stderr, "ERROR: couldn't rmmod probe module %s.\n", modname); exit(1); } } else if (closed == 2) { -- cgit