1(* 2 * Copyright (C) 2006-2007 XenSource Ltd. 3 * Copyright (C) 2008 Citrix Ltd. 4 * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as published 8 * by the Free Software Foundation; version 2.1 only. with the special 9 * exception on linking described in file LICENSE. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 *) 16 17(** Event channel bindings: see tools/libxc/include/xenctrl.h *) 18 19type handle 20(** An initialised event channel interface. *) 21 22type t 23(** A local event channel. *) 24 25type virq_t = 26 | Timer (* #define VIRQ_TIMER 0 *) 27 | Debug (* #define VIRQ_DEBUG 1 *) 28 | Console (* #define VIRQ_CONSOLE 2 *) 29 | Dom_exc (* #define VIRQ_DOM_EXC 3 *) 30 | Tbuf (* #define VIRQ_TBUF 4 *) 31 | Reserved_5 (* Do not use this value as it's not defined *) 32 | Debugger (* #define VIRQ_DEBUGGER 6 *) 33 | Xenoprof (* #define VIRQ_XENOPROF 7 *) 34 | Con_ring (* #define VIRQ_CON_RING 8 *) 35 | Pcpu_state (* #define VIRQ_PCPU_STATE 9 *) 36 | Mem_event (* #define VIRQ_MEM_EVENT 10 *) 37 | Xc_reserved (* #define VIRQ_XC_RESERVED 11 *) 38 | Enomem (* #define VIRQ_ENOMEM 12 *) 39 | Xenpmu (* #define VIRQ_XENPMU 13 *) 40 41 42val to_int: t -> int 43 44val of_int: int -> t 45 46val init: ?cloexec:bool -> unit -> handle 47(** [init ?cloexec ()] 48 Return an initialised event channel interface. 49 The default is to close the underlying file descriptor 50 on [execve], which can be overriden with [~cloexec:false]. 51 On error it will throw a Failure exception. *) 52 53val fdopen: Unix.file_descr -> handle 54(** Return an initialised event channel interface, from an already open evtchn 55 file descriptor. On error it will throw a Failure exception. *) 56 57val fd: handle -> Unix.file_descr 58(** Return a file descriptor suitable for Unix.select. When 59 the descriptor becomes readable, it is safe to call 'pending'. 60 On error it will throw a Failure exception. *) 61 62val notify : handle -> t -> unit 63(** Notify the given event channel. On error it will throw a 64 Failure exception. *) 65 66val bind_interdomain : handle -> int -> int -> t 67(** [bind_interdomain h domid remote_port] returns a local event 68 channel connected to domid:remote_port. On error it will 69 throw a Failure exception. *) 70 71val bind_dom_exc_virq : handle -> t 72(** Binds a local event channel to the VIRQ_DOM_EXC 73 (domain exception VIRQ). On error it will throw a Failure 74 exception. *) 75 76val bind_virq: handle -> virq_t -> t 77(** Binds a local event channel to the specific VIRQ type. 78 On error it will throw a Failure exception. *) 79 80val unbind : handle -> t -> unit 81(** Unbinds the given event channel. On error it will throw a 82 Failure exception. *) 83 84val pending : handle -> t 85(** Returns the next event channel to become pending. On error it 86 will throw a Failure exception. *) 87 88val unmask : handle -> t -> unit 89(** Unmasks the given event channel. On error it will throw a 90 Failure exception. *) 91