]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
ocaml/xs: prefer using character device
authorDoug Goldstein <cardoe@cardoe.com>
Tue, 1 Sep 2015 18:34:02 +0000 (13:34 -0500)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 2 Sep 2015 11:05:41 +0000 (12:05 +0100)
Since 9c89dc95201ffed5fead17b35754bf9440fdbdc0 libxenstore prefers using
/dev/xen/xenbus over /proc/xen/xenbus. This makes the OCaml xenstore
library contain the same preference.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: David Scott <dave.scott@citrix.com>
tools/ocaml/libs/xs/xs.ml

index 57575710729bc036a4dd951a2227374595296024..7e14487939aabcb97c5d80cf7236c97a40b98c19 100644 (file)
@@ -162,7 +162,13 @@ let daemon_open () =
        with _ -> raise Failed_to_connect
 
 let domain_open () =
-       let path = "/proc/xen/xenbus" in
+       let path = try
+               let devpath = "/dev/xen/xenbus" in
+               Unix.access devpath [ Unix.F_OK ];
+               devpath
+       with Unix.Unix_error(_, _, _) ->
+               "/proc/xen/xenbus" in
+
        let fd = Unix.openfile path [ Unix.O_RDWR ] 0o550 in
        Unix.set_close_on_exec fd;
        make fd