package xenstore_transport

  1. Overview
  2. Docs
Low-level libraries for connecting to a xenstore service on a xen host

Install

dune-project
 Dependency

Authors

Maintainers

Sources

xenstore-tool-1.5.0.tbz
sha256=3e1b1d830ff982c5392910ea83bdee6d7aefa50e5c2a947a24d3beeb10c0e45f
sha512=435bb1de5a638c25d7e050cb12284379a0e9de4f8818f673a4b6d228d21b8d8103ab8bde76f598104a6c67b15b31c6b2a54e07caf4a0629538178fc6fc1abe4f

doc/src/xenstore_transport.unix/xs_transport.ml.html

Source file xs_transport.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(*
 * Copyright (C) Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)

let xenstored_socket = ref "/var/run/xenstored/socket"

(* We'll look for these paths in order: *)
let get_xenstore_paths () =
  let default =
    [
      !xenstored_socket;
      "/proc/xen/xenbus";
      (* Linux *)
      "/dev/xen/xenstore";
      (* FreeBSD *)
    ]
  in
  try Sys.getenv "XENSTORED_PATH" :: default with Not_found -> default

let choose_xenstore_path () =
  List.fold_left
    (fun acc possibility ->
      match acc with
      | Some x -> Some x
      | None -> if Sys.file_exists possibility then Some possibility else None)
    None (get_xenstore_paths ())

exception Could_not_find_xenstore
OCaml

Innovation. Community. Security.