package xenstore_transport

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

Install

Dune Dependency

Authors

Maintainers

Sources

v1.3.0.tar.gz
sha256=a1b17a2f175f3085e57728cb94c95041857bbce83c0942cd03bc109f1c4841b9
md5=7e1ef30d1958c65751c119075d2ba78a

doc/src/xenstore_transport/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
(*
 * 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.