diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-17 18:21:25 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-17 18:21:25 +0100 |
commit | b9488ab5f5c72a1856ef21e7fd79f422799f6469 (patch) | |
tree | 4e1c29972bd515530aec4a9f5a16fdf38807c99a /tools/xenstore/xenstored_solaris.c | |
parent | 5b8acb9ddfd8efc1d0f10760cc4510f50b0c466f (diff) | |
download | xen-b9488ab5f5c72a1856ef21e7fd79f422799f6469.tar.gz xen-b9488ab5f5c72a1856ef21e7fd79f422799f6469.tar.bz2 xen-b9488ab5f5c72a1856ef21e7fd79f422799f6469.zip |
[SOLARIS] Create kernel-interface implementations for libxc and xenstored.
Additionally, on Solaris, tell the kernel when xenstored is running.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/xenstore/xenstored_solaris.c')
-rw-r--r-- | tools/xenstore/xenstored_solaris.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tools/xenstore/xenstored_solaris.c b/tools/xenstore/xenstored_solaris.c new file mode 100644 index 0000000000..376a00081b --- /dev/null +++ b/tools/xenstore/xenstored_solaris.c @@ -0,0 +1,66 @@ +/****************************************************************************** + * + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright (C) 2005 Rusty Russell IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2 of the + * License. + */ + +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/mman.h> +#include <xen/sys/xenbus.h> + +#include "xenstored_core.h" + +evtchn_port_t xenbus_evtchn(void) +{ + int fd; + evtchn_port_t port; + + fd = open("/dev/xen/xenbus", O_RDONLY); + if (fd == -1) + return -1; + + port = ioctl(fd, IOCTL_XENBUS_XENSTORE_EVTCHN); + + close(fd); + return port; +} + +void *xenbus_map(void) +{ + int fd; + void *addr; + + fd = open("/dev/xen/xenbus", O_RDWR); + if (fd == -1) + return NULL; + + addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE, + MAP_SHARED, fd, 0); + + if (addr == MAP_FAILED) + addr = NULL; + + close(fd); + + return addr; +} + +void xenbus_notify_running(void) +{ + int fd; + + fd = open("/dev/xen/xenbus", O_RDONLY); + + (void) ioctl(fd, IOCTL_XENBUS_NOTIFY_UP); + + close(fd); +} |