From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Novotny Subject: Re: capturing SIGKILL in DomU Date: Tue, 05 Oct 2010 10:36:44 +0200 Message-ID: <4CAAE39C.1020708@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Srujan D. Kotikela" Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi Srujan, what about adding a signal handler to qemu-dm in the tools/ioemu-dir of the user-space tools? Using the signal() API? Nevertheless why would you like to catch SIGKILL? This one (as can be seen using included program source and killing it using kill -9 pid or kill -SIGKILL pid) is not being caught at all nevertheless most of the other signals can be caught. This is the source of the example mentioned: #include #include #include void sig_handler(int sig) { fprintf(stderr, "Signal %d caught.\n", sig); exit(sig); } int main() { signal(SIGINT, sig_handler); signal(SIGKILL, sig_handler); sleep(10000); return 0; } When I did try SIGINT (Ctrl + C or kill -2 pid) it caught the signal well but when I did try kill -9 pid (or kill -SIGKILL pid respectively) it was not working at all since it killed the process instead of going to the signal handler. When you need to catch signals like interruption signal (Ctrl + C one) this will work fine. Michal On 10/04/2010 09:03 PM, Srujan D. Kotikela wrote: > Hi, > > I am trying to capture SIGKILL through event channel. > > On my Dom0, the following process is running (remaining code in > attachment). > > > int main(void){ > > int ret, dom, remote_dom; > > //initialize domains > dom=0; > remote_dom=2; > > //create the event channel > ret = create_channel(dom, remote_dom); > > > if (0 == ret) { > printf("\n Event Channel established successfully \n"); > } else { > return -1; //EVENT_CHANNEL_CREATION_FAILED > } > > //wait 20 seconds for an event to occur in DomU > wait_for_event(20); > > //close the opened interfaces > close_channel(); > > return 0; > > } > > > While this process is running; I killed a process in DomU using `*kill > SIGKILL pid*` > > How can I capture this event (occured in DomU) at the Dom0. I watched > /dev/xen/evtchn, but no notification. > > > -- > Srujan D. Kotikela > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > -- Michal Novotny, RHCE Virtualization Team (xen userspace), Red Hat