ia64/xen-unstable

view tools/xenstore/xs_dom0_test.c @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents 3233e7ecfa9f
children 06d84bf87159
line source
1 /* Test introduction of domain 0 */
2 #include <linux/ioctl.h>
3 #include <sys/ioctl.h>
4 #include "xs.h"
5 #include "utils.h"
6 #include <xenctrl.h>
7 #include <xen/linux/privcmd.h>
8 #include <stdio.h>
9 #include <unistd.h>
10 #include <sys/mman.h>
12 int main()
13 {
14 int h, local = 0, kernel = 0;
15 long err;
16 void *page;
18 h = xc_interface_open();
19 if (h < 0)
20 barf_perror("Failed to open xc");
22 if (xc_evtchn_bind_interdomain(h, DOMID_SELF, 0, &local, &kernel) != 0)
23 barf_perror("Failed to bind interdomain");
25 printf("Got ports %i & %i\n", local, kernel);
27 err = ioctl(h, IOCTL_PRIVCMD_INITDOMAIN_STORE, kernel);
28 if (err < 0)
29 barf_perror("Failed to initialize store");
30 printf("Got mfn %li\n", err);
32 page = xc_map_foreign_range(h, 0, getpagesize(), PROT_READ|PROT_WRITE,
33 err);
34 if (!page)
35 barf_perror("Failed to map page %li", err);
36 printf("Mapped page at %p\n", page);
37 printf("Page says %s\n", (char *)page);
38 munmap(page, getpagesize());
39 printf("unmapped\n");
41 return 0;
42 }