aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/init-xenstore-domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xenstore/init-xenstore-domain.c')
-rw-r--r--tools/xenstore/init-xenstore-domain.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-xenstore-domain.c
index 18c075bebd..35f1aa3e1a 100644
--- a/tools/xenstore/init-xenstore-domain.c
+++ b/tools/xenstore/init-xenstore-domain.c
@@ -1,4 +1,5 @@
#include <fcntl.h>
+#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
@@ -69,7 +70,7 @@ int main(int argc, char** argv)
xc_interface *xch;
struct xs_handle *xsh;
char buf[16];
- int rv;
+ int rv, fd;
if (argc != 4) {
printf("Use: %s <xenstore-kernel> <memory_mb> <flask-label>\n", argv[0]);
@@ -90,5 +91,14 @@ int main(int argc, char** argv)
xs_write(xsh, XBT_NULL, "/tool/xenstored/domid", buf, rv);
xs_daemon_close(xsh);
+ fd = creat("/var/run/xenstored.pid", 0666);
+ if (fd < 0)
+ return 3;
+ rv = snprintf(buf, 16, "domid:%d\n", domid);
+ rv = write(fd, buf, rv);
+ close(fd);
+ if (rv < 0)
+ return 3;
+
return 0;
}