-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfdinfo.mli
40 lines (27 loc) · 1.1 KB
/
fdinfo.mli
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
39
40
(**
This module provides informations on file descriptors opened by another processus
*)
type fdinfo = {
offset : int64;
flags : string;
}
type pid
type fd
type valret =
| Ppid of pid list
| Ffd of (fd * string) list
exception Fdinfo_parse_error
exception Fdinfo_sys_error of string
(* string is the failing Unix function name *)
exception Fdinfo_unix_error of (Unix.error * string * valret) ;;
val pid_of_int : int -> pid
val int_of_pid : pid -> int
val fd_of_int : int -> fd
val int_of_fd : fd -> int
val fd_of_string : string -> fd
(** [get_pids ()] returns a list of processus. In case of errors, it raises [Fdinfo_unix_error] *)
val get_pids : unit -> pid list
(** [get_fds pid] returns a list of file descriptors [fd] and fullpath [string] of files opened by [pid]. In case of errors, it raises [Fdinfo_unix_error] *)
val get_fds : pid -> (fd * string) list
(** [get_infos pid fd] returns informations [fdinfo] extracted from /proc on the file [fd] opened by the processus [pid]. In case of errors, it raises [Fdinfo_parse_error] or [Fdinfo_sys_error] *)
val get_infos : pid -> fd -> fdinfo