All of lore.kernel.org
 help / color / mirror / Atom feed
* capturing SIGKILL in DomU
@ 2010-10-04 19:03 Srujan D. Kotikela
  2010-10-05  8:36 ` Michal Novotny
  0 siblings, 1 reply; 9+ messages in thread
From: Srujan D. Kotikela @ 2010-10-04 19:03 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 890 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1191 bytes --]

[-- Attachment #2: EcTest.c --]
[-- Type: text/x-csrc, Size: 1999 bytes --]

#include <stdint.h>
#include <stdio.h>
#include <xenctrl.h>
#include <xen/xen.h>
#include <xen/event_channel.h>


static int xce_handle = -1; 
static int src_port = -1;
static int dst_port = -1;
static int xc_handle = -1;

int create_channel(int dom, int remote_dom) {
   
	//open the hypervisor interface
    if (-1 != (xc_handle=xc_interface_open())) {

    //	printf("\n Accquired HYPERVISOR INTERFACE HANDLE: %d \n", xc_handle);

    } else {
    	return -1;	//HYPERVISOR_INTERFACE_OPEN_FAIL
	}
	
	//allocate a port on the remote domain
    if (-1 != (dst_port = xc_evtchn_alloc_unbound(xc_handle, remote_dom, dom))) {
    	
    //	printf("\n Allocated the DEST port %d \n", dst_port);
	
	} else {
		return -2;	//UNBOUND_PORT_ALLOCATION_FAIL
	}
	
	//create a handle for event channel
    if (-1 != (xce_handle = xc_evtchn_open())) {    
    	
    //	printf("\n Accquired HYPERVISOR INTERFACE EVTCHN HANDLE: %d\n", xce_handle);
	
	} else {
		return -3;	//EVENT_CHANN    //create the event channelEL_OPEN_FAIL
	}
	
    //bind src and dst ports
    if(-1 != (src_port = xc_evtchn_bind_interdomain(xce_handle, remote_dom, dst_port))) {
       
    //	printf("\n Allocated the SRC port %d \n", src_port);
    	 
    } else {
    	return -4;	//BINDING_SRC_DST_PORTS_FAIL
    }
    
    return 0;
}

void close_channel(void){
	
	//close hypervisor interface
	xc_interface_close(xc_handle);

	//close event channel
    xc_evtchn_close(xce_handle);

}

void wait_for_event(long ms){

	sleep(ms);
	
}

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;
   
}


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-10-05 23:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04 19:03 capturing SIGKILL in DomU Srujan D. Kotikela
2010-10-05  8:36 ` Michal Novotny
2010-10-05 13:14   ` Srujan D. Kotikela
2010-10-05 13:22     ` Michal Novotny
2010-10-05 13:36       ` Srujan D. Kotikela
2010-10-05 13:49         ` Michal Novotny
2010-10-05 14:21           ` Srujan D. Kotikela
2010-10-05 15:33             ` Michal Novotny
2010-10-05 23:09               ` Srujan D. Kotikela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.