[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Why xs_handle is not part of header rather xs.c file






On Mon, Sep 2, 2013 at 1:29 AM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
On Fri, 2013-08-30 at 09:58 -0700, Shakil k wrote:

>
> Â Â Â ÂThe reason being for watch functionality we have n number of times to watch for. However
> Â Â Â Âit doesn't have a timeout. What if my program waiting for watch and the data is never delivered
> Â Â Â Âas the client died or crashed.

You use xs_fileno() to get an fd which you can then use select(2) or
poll(2) with a timeout on.
Ian.
Â
 ÂThis doesn't work, as per the below code. I can never see the data coming to select if I do xenstore-watch on the node from other terminal on the same dom0.
Do we need to do xs_watch before calling select? and why so?

struct xs_handle *xen_handle;
xs_transaction_t xen_transact;Â
int xen_fd;Â
int xenstore_initialized = 0;


int xenstore_watch(const char *path, struct timeval *Timeout)
{
int status = 0;
fd_set set;
fd_set set1;
int error;
char **vec;
unsigned int num_strings;
static int watch_counter=0;
static int counter=0;

//INIT
xen_handle = xs_daemon_open();
xen_fd = xs_fileno(xen_handle);
FD_ZERO(&set);
FD_SET(xen_fd, &set);

FD_ZERO(&set1);
FD_SET(xen_fd, &set1);

if ( select(xen_fd + 1, &set, &set1, NULL, Timeout) != -1)
{
printf("Data is availabale after select\n");
}

return 0;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.