package stramon-lib

  1. Overview
  2. Docs

Process behavior monitoring library based on strace

Stramon-lib is primarily designed to power Stramon, or to be used in similar fashion of process monitoring.

Absolute path

module Abs_path : sig ... end

Normalized absolute path representation

Path trie

module Path_trie : sig ... end

Path trie based path set

module Path_trie_set : sig ... end

Main monitoring facilities

module Syscall : sig ... end

Syscall data and handler

module Stats : sig ... end

Basic monitoring statistics

module Monitor_result : sig ... end

Result of a monitoring session

type debug_level = [
  1. | `None
  2. | `Registered
]
val monitor : ?debug_level:debug_level -> ?stdin:Unix.file_descr -> ?stdout:Unix.file_descr -> ?stderr:Unix.file_descr -> handlers:'a Syscall.handler list -> init_ctx:'a -> string list -> ('a Monitor_result.t, string) Stdlib.result

monitor ~handlers ~init_ctx cmd spawns a monitoring session of cmd.

debug_level determines the debuging information printed to stderr:

  • `None: print nothing (default)
  • `Registered: print data recognized by one of the handlers

stdin, stdout, stderr are passed to Unix.create_process, default to Unix.stdin, Unix.stdout, and Unix.stderr respectively.

init_ctx defines the initial "context". It will be provided to the first handler to be invoked.

If any of the handlers raises an exception, then monitoring is interrupted, and exception is captured in the returned monitor result.

Returns Error if monitor fails to create process with cmd wrapped with strace. This normally means the strace program is not available.

Misc utilities

module Utils : sig ... end