aboutsummaryrefslogtreecommitdiffstats
path: root/xenlog.c
diff options
context:
space:
mode:
authorkraxel <kraxel>2006-01-31 14:05:09 +0000
committerkraxel <kraxel>2006-01-31 14:05:09 +0000
commit204520ac1d70a7d6c6084c2ec98560d580f38fa2 (patch)
tree5fef0b342a450412e74c32de62e45423f987402d /xenlog.c
parentc28bc1bc12c466c58a71eeed8f2d38e46008ee2f (diff)
downloadxenwatch-204520ac1d70a7d6c6084c2ec98560d580f38fa2.tar.gz
- lots of mdns updates.
Diffstat (limited to 'xenlog.c')
-rw-r--r--xenlog.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/xenlog.c b/xenlog.c
index af3bef5..d7e951c 100644
--- a/xenlog.c
+++ b/xenlog.c
@@ -7,19 +7,42 @@
int main(int argc, char *argv[])
{
- struct xs_handle *xenstore;
+ struct xs_handle *xenstore = NULL;
xs_transaction_t xst;
char *xs_value = NULL, **vec;
char *value;
unsigned int count;
- xenstore = xs_daemon_open_readonly();
if (NULL == xenstore) {
- fprintf(stderr,"can't connect to %s\n",xs_daemon_socket_ro());
+ xenstore = xs_daemon_open_readonly();
+ if (NULL == xenstore)
+ fprintf(stderr,"can't connect to %s\n",xs_daemon_socket_ro());
+ else
+ printf("connected to %s\n", xs_daemon_socket_ro());
+ }
+
+ if (NULL == xenstore) {
+ xenstore = xs_daemon_open();
+ if (NULL == xenstore)
+ fprintf(stderr,"can't connect to %s\n",xs_daemon_socket());
+ else
+ printf("connected to %s\n", xs_daemon_socket());
+ }
+
+ if (NULL == xenstore) {
+ xenstore = xs_domain_open();
+ if (NULL == xenstore)
+ fprintf(stderr, "can't connect to %s\n", xs_domain_dev());
+ else
+ printf("connected to %s\n", xs_domain_dev());
+ }
+
+ if (NULL == xenstore) {
+ fprintf(stderr, "can't access xenstore, exiting\n");
exit(1);
}
- xs_watch(xenstore, "/", "token");
+ xs_watch(xenstore, "/", "token");
for (;;) {
vec = xs_read_watch(xenstore, &count);
if (NULL == vec) {
@@ -44,7 +67,8 @@ int main(int argc, char *argv[])
value = "<null>";
break;
}
- fprintf(stderr,"%-64s : \"%s\"\n", vec[XS_WATCH_PATH], value);
+ printf("%-64s : \"%s\"\n", vec[XS_WATCH_PATH], value);
+ fflush(stdout);
if (xs_value) {
free(xs_value);