From: Nick 'S. M. <sh...@zo...> - 2002-02-21 07:02:36
|
G'day Jeff & list, I've been playing with virtual networks of UML hosts, and one thing that's been annoying me is that it's difficult to shut the network down cleanly. Here's a patch which catches a SIGHUP to the tracing thread and calls the kernel ctrl_alt_del() procedure. If I'm doing this a totally bone-headed way, I'm sure you'll let me know ... hey, I said it was trivial! -----sharks -----8<-----cut here-----8<----- Based on 2.4.16-2 diff -c trap_kern.orig.c trap_kern.c *** trap_kern.orig.c Thu Feb 21 17:40:46 2002 --- trap_kern.c Thu Feb 21 17:42:24 2002 *************** *** 274,279 **** --- 274,286 ---- init_proxy(debugger_pid, 0, 0); } + void signal_hup(int sig) + { + printk(KERN_ERR "Tracing thread caught SIGHUP: simulating ctrl-alt-del\n"); + /* do I have to do anything clever here? */ + ctrl_alt_del(); + } + int init_ptrace_proxy(int idle_pid, int startup, int stop) { int pid, status; diff -c trap_user.orig.c trap_user.c *** trap_user.orig.c Thu Feb 21 17:40:34 2002 --- trap_user.c Thu Feb 21 17:46:30 2002 *************** *** 114,119 **** --- 114,120 ---- extern int io_nsignals, io_count, intr_count; extern void signal_usr1(int sig); + extern void signal_hup(int sig); int tracing_pid = -1; *************** *** 129,134 **** --- 130,136 ---- calc_sigframe_size(); signal(SIGSEGV, signal_segv); signal(SIGUSR1, signal_usr1); + signal(SIGHUP, signal_hup); signal(SIGPIPE, SIG_IGN); tracing_pid = getpid(); printk("tracing thread pid = %d\n", tracing_pid); -----8<-----cut here-----8<----- -- Nick 'Sharkey' Moore <Nic...@en...> Research Fellow, CTIE Tel: +61 3 9905 3707 Monash University, Australia Fax: +61 3 9905 5358 |