Pure OCaml implementation of the "vchan" shared-memory communication protocol
OCaml Other
Latest commit 6b014d3 Feb 24, 2017 @yomimono yomimono committed on GitHub Merge pull request #101 from yomimono/remove-mirage-dev
remove EXTRA_REMOTE for mirage-dev from travis config
Failed to load latest commit information.
cli xencat: Lwt_io.read_into returns 0 on End_of_file Aug 27, 2014
doc Add vchan.xen, with a handy instantiation of the function Sep 16, 2014
js Add javascript stubs Jun 1, 2015
lib Update autogen files .. Dec 23, 2016
lib_test Fix compilation of the unikernel example Dec 23, 2016
lwt Adapt to the new error scheme Dec 22, 2016
xen Use ppx [@@deriving ...] and cstruct.ppx Mar 15, 2016
.coverage.sh Update the sed runes as the _oasis file changes a little bit Jul 5, 2015
.docgen.sh doc: another fix for gh-pages upload May 31, 2015
.gitignore Make -lxenctrl optional via configure script, update travis Sep 4, 2014
.travis.yml remove EXTRA_REMOTES=mirage-dev from .travis.yml Feb 24, 2017
CHANGES update changes for version 2.3.0 Jan 17, 2017
Dockerfile Add a `make xen-build` target to check the Xen build Mar 14, 2016
LICENSE Clarify license (ISC) by adding a LICENSE file Aug 26, 2014
Makefile Add a `make xen-build` target to check the Xen build Mar 14, 2016
README.md test: add coveralls, via travis May 30, 2015
_oasis Do not depend on mirage-types in _oasis Dec 23, 2016
_tags Update autogen files .. Dec 23, 2016
api.odocl Regenerate OASIS May 31, 2015
build.sh Add a `make xen-build` target to check the Xen build Mar 14, 2016
configure remove a bashism in the configure script Oct 4, 2014
configure.ml configure: add --disable-xen and --disable-xenctrl options Jul 21, 2016
myocamlbuild.ml switch to mirage-types-lwt ocamlfind package Dec 14, 2016
opam pull newer opam from mirage-dev Jan 18, 2017
setup.ml Update autogen files .. Dec 23, 2016


Build Status Coverage Status

This is an implementation of the Xen "libvchan" or "vchan" communication protocol in OCaml. It allows fast inter-domain communication using shared memory.

Linux configuration

Make sure your systems are properly configured. You may need to:

sudo modprobe xen-evtchn
sudo modprobe xen-gntdev
sudo modprobe xen-gntalloc
mount -t xenfs xenfs /proc/xen

To use in Linux

To connect as a server to a client with domid 'domid' and using the string 'port' to denote the connection:

open Vchan_lwt_unix

open_server ~domid ~port ()
>>= fun (ic, oc) ->
Lwt_io.write_line oc "hello"
>>= fun () ->
Lwt_io.flush oc
>>= fun () ->
Lwt_io.close ic
>>= fun () ->
Lwt_io.close oc

To connect as a client, replace open_server with open_client.

To use the command-line

On both of your VMs, find their domain ids:

xenstore-read domid

On the domain with domid <server domid>, listen for a single connection from <client domid> on <port>:

xencat -l <client domid> <port>

On the domain with domid <client domid>, connect to <server domid>:

xencat <server domid> <port>

So to transfer a file foo from domid 1 to domid 2:

On domain 2, listen for the connection and retrieve the file:

xencat -l 1 foo > copy-of-foo

On domain 1, transmit the file:

cat foo | xencat 2 foo