Up

module Unix_syscalls

: sig

Unix_syscalls provides an interface to many of the functions in OCaml's standard Unix module. It uses a deferred in the return type of functions that would block. The idea is that in an Async program one does not use the standard Unix module, since in doing so one could accidentally block the whole program.

There are also a number of cosmetic changes (e.g. polymorphic variants) and other improvements (e.g. phantom types on sockets) over the standard Unix module.

#
module Syscall_result = Core.Std.Unix.Syscall_result
#
module Exit : module type of Core.Std.Unix.Exit
#
module Exit_or_signal : module type of Core.Std.Unix.Exit_or_signal
#
module Exit_or_signal_or_stop : module type of Core.Std.Unix.Exit_or_signal_or_stop
#
val system : string -> Exit_or_signal.t Import.Deferred.t
#
val system_exn : string -> unit Import.Deferred.t
#
val getpid : unit -> Core.Std.Pid.t
#
val getppid : unit -> Core.Std.Pid.t option
#
val getppid_exn : unit -> Core.Std.Pid.t
#
val this_process_became_child_of_init : ?poll_delay:Core.Std.Time.Span.t -> unit -> unit Import.Deferred.t

this_process_became_child_of_init returns a deferred that becomes determined when the current process becomes a child of init(8). This is useful to determine if one's parent has died, because in that case init will becomes one's parent.

See Linux_ext.pr_set_pdeathsig : Signal.t -> unit for related way to get information about parent death.

Poll_delay controls how often to check
#
val nice : int -> int
#
val cores : (unit -> int Import.Deferred.t) Core.Std.Or_error.t

cores () Returns the number of cores

#
type open_flag = [
| `Rdonly
| `Wronly
| `Rdwr
| `Nonblock
| `Append
| `Creat
| `Trunc
| `Excl
| `Noctty
| `Dsync
| `Sync
| `Rsync
]
#
type file_perm = int
#
val openfile : ?perm:file_perm -> ?close_on_exec:bool -> string -> mode:open_flag list -> Fd.t Import.Deferred.t
#
val with_file : ?exclusive:[
| `Read
| `Write
] -> ?perm:file_perm -> string -> mode:open_flag list -> f:(Fd.t -> 'a Import.Deferred.t) -> 'a Import.Deferred.t

with_file file ~mode ~perm ~f ?exclusive opens file, and applies f to the resulting file descriptor. When the result of f becomes determined, it closes the descriptor and returns the result of f. If exclusive is supplied, then the file descriptor is locked before calling f and unlocked after calling f.

#
module Open_flags : module type of Core.Std.Unix.Open_flags
#
val fcntl_getfl : Fd.t -> Open_flags.t Import.Deferred.t

fcntl_getfl and fcntl_setf are deferred wrappers around the corresponding functions in Core.Unix for accessing the open-file-descriptor table.

#
val fcntl_setfl : Fd.t -> Open_flags.t -> unit Import.Deferred.t
#
val close : ?should_close_file_descriptor:bool -> Fd.t -> unit Import.Deferred.t

close fd closes the file descriptor fd, and raises an exception if fd has already been closed.

In some situations, one may need to cause Async to release an fd that it is managing without closing the underlying file descriptor. In that case, one should supply ~should_close_file_descriptor:false, which will skip the underlying close() system call.

#
val lseek : Fd.t -> int64 -> mode:[<
| `Set
| `Cur
| `End
] -> int64 Import.Deferred.t
#
val truncate : string -> len:int64 -> unit Import.Deferred.t
#
val ftruncate : Fd.t -> len:int64 -> unit Import.Deferred.t
#
val fsync : Fd.t -> unit Import.Deferred.t
#
val fdatasync : Fd.t -> unit Import.Deferred.t
#
val sync : unit -> unit Import.Deferred.t
#
val lockf : ?len:Core.Std.Int64.t -> Fd.t -> [
| `Read
| `Write
] -> unit Import.Deferred.t

lockf fd read_or_write ?len exclusively locks for reading/writing the section of the open file fd specified by the current file position and len (see man lockf). It returns when the lock has been acquired. It raises if fd is closed.

#
val try_lockf : ?len:Core.Std.Int64.t -> Fd.t -> [
| `Read
| `Write
] -> bool

try_lockf fd read_or_write ?len attempts to exclusively lock for reading/writing the section of the open file fd specified by the current file position and len (see man lockf). It returns true if it acquired the lock. It raises if fd is closed.

#
val test_lockf : ?len:Core.Std.Int64.t -> Fd.t -> bool

lockf_is_locked fd ?len checks the lock on section of the open file fd specified by the current file position and len (see man lockf). If the section is unlocked or locked by this process, it returns true, else it returns false. It raises if fd is closed.

#
val unlockf : ?len:Core.Std.Int64.t -> Fd.t -> unit

unlockf fd ?len unlocks the section of the open file fd specified by the current file position and len (see man lockf). It raises if fd is closed.

#
module File_kind : sig
#
type t = [
| `File
| `Directory
| `Char
| `Block
| `Link
| `Fifo
| `Socket
]
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val __t_of_sexp__ : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Stats : sig
#
type t = {
# dev
: int;
# ino
: int;
# kind
: File_kind.t;
# perm
: file_perm;
: int;
# uid
: int;
# gid
: int;
# rdev
: int;
# size
: int64;
# atime
: Core.Std.Time.t;
# mtime
: Core.Std.Time.t;
# ctime
: Core.Std.Time.t;
}
#
val ctime : t -> Core.Std.Time.t
#
val mtime : t -> Core.Std.Time.t
#
val atime : t -> Core.Std.Time.t
#
val size : t -> int64
#
val rdev : t -> int
#
val gid : t -> int
#
val uid : t -> int
#
val perm : t -> file_perm
#
val kind : t -> File_kind.t
#
val ino : t -> int
#
val dev : t -> int
#
module Fields : sig
#
val names : string list
#
val ctime : (t, Core.Std.Time.t) Fieldslib.Field.t
#
val mtime : (t, Core.Std.Time.t) Fieldslib.Field.t
#
val atime : (t, Core.Std.Time.t) Fieldslib.Field.t
#
val size : (t, int64) Fieldslib.Field.t
#
val rdev : (t, int) Fieldslib.Field.t
#
val gid : (t, int) Fieldslib.Field.t
#
val uid : (t, int) Fieldslib.Field.t
#
val perm : (t, file_perm) Fieldslib.Field.t
#
val kind : (t, File_kind.t) Fieldslib.Field.t
#
val ino : (t, int) Fieldslib.Field.t
#
val dev : (t, int) Fieldslib.Field.t
#
val fold : init:'acc__ -> dev:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> ino:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> kind:('acc__ -> (t, File_kind.t) Fieldslib.Field.t -> 'acc__) -> perm:('acc__ -> (t, file_perm) Fieldslib.Field.t -> 'acc__) -> nlink:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> uid:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> rdev:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> size:('acc__ -> (t, int64) Fieldslib.Field.t -> 'acc__) -> atime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> 'acc__) -> mtime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> 'acc__) -> ctime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> 'acc__) -> 'acc__
#
val make_creator : dev:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> ino:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> kind:((t, File_kind.t) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> File_kind.t) * 'compile_acc__) -> perm:((t, file_perm) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> file_perm) * 'compile_acc__) -> nlink:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> uid:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> gid:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> rdev:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> size:((t, int64) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int64) * 'compile_acc__) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> Core.Std.Time.t) * 'compile_acc__) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> Core.Std.Time.t) * 'compile_acc__) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> Core.Std.Time.t) * 'compile_acc__) -> 'compile_acc__ -> ('input__ -> t) * 'compile_acc__
#
val create : dev:int -> ino:int -> kind:File_kind.t -> perm:file_perm -> nlink:int -> uid:int -> gid:int -> rdev:int -> size:int64 -> atime:Core.Std.Time.t -> mtime:Core.Std.Time.t -> ctime:Core.Std.Time.t -> t
#
val map : dev:((t, int) Fieldslib.Field.t -> int) -> ino:((t, int) Fieldslib.Field.t -> int) -> kind:((t, File_kind.t) Fieldslib.Field.t -> File_kind.t) -> perm:((t, file_perm) Fieldslib.Field.t -> file_perm) -> nlink:((t, int) Fieldslib.Field.t -> int) -> uid:((t, int) Fieldslib.Field.t -> int) -> gid:((t, int) Fieldslib.Field.t -> int) -> rdev:((t, int) Fieldslib.Field.t -> int) -> size:((t, int64) Fieldslib.Field.t -> int64) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> Core.Std.Time.t) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> Core.Std.Time.t) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> Core.Std.Time.t) -> t
#
val iter : dev:((t, int) Fieldslib.Field.t -> unit) -> ino:((t, int) Fieldslib.Field.t -> unit) -> kind:((t, File_kind.t) Fieldslib.Field.t -> unit) -> perm:((t, file_perm) Fieldslib.Field.t -> unit) -> nlink:((t, int) Fieldslib.Field.t -> unit) -> uid:((t, int) Fieldslib.Field.t -> unit) -> gid:((t, int) Fieldslib.Field.t -> unit) -> rdev:((t, int) Fieldslib.Field.t -> unit) -> size:((t, int64) Fieldslib.Field.t -> unit) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> unit) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> unit) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> unit) -> unit
#
val for_all : dev:((t, int) Fieldslib.Field.t -> bool) -> ino:((t, int) Fieldslib.Field.t -> bool) -> kind:((t, File_kind.t) Fieldslib.Field.t -> bool) -> perm:((t, file_perm) Fieldslib.Field.t -> bool) -> nlink:((t, int) Fieldslib.Field.t -> bool) -> uid:((t, int) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> rdev:((t, int) Fieldslib.Field.t -> bool) -> size:((t, int64) Fieldslib.Field.t -> bool) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> bool
#
val exists : dev:((t, int) Fieldslib.Field.t -> bool) -> ino:((t, int) Fieldslib.Field.t -> bool) -> kind:((t, File_kind.t) Fieldslib.Field.t -> bool) -> perm:((t, file_perm) Fieldslib.Field.t -> bool) -> nlink:((t, int) Fieldslib.Field.t -> bool) -> uid:((t, int) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> rdev:((t, int) Fieldslib.Field.t -> bool) -> size:((t, int64) Fieldslib.Field.t -> bool) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> bool) -> bool
#
val to_list : dev:((t, int) Fieldslib.Field.t -> 'elem__) -> ino:((t, int) Fieldslib.Field.t -> 'elem__) -> kind:((t, File_kind.t) Fieldslib.Field.t -> 'elem__) -> perm:((t, file_perm) Fieldslib.Field.t -> 'elem__) -> nlink:((t, int) Fieldslib.Field.t -> 'elem__) -> uid:((t, int) Fieldslib.Field.t -> 'elem__) -> gid:((t, int) Fieldslib.Field.t -> 'elem__) -> rdev:((t, int) Fieldslib.Field.t -> 'elem__) -> size:((t, int64) Fieldslib.Field.t -> 'elem__) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'elem__) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'elem__) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> 'elem__) -> 'elem__ list
#
val map_poly : ([<
| `Read
| `Set_and_create
], t, 'x0) Fieldslib.Field.user -> 'x0 list
#
module Direct : sig
#
val iter : t -> dev:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> ino:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> kind:((t, File_kind.t) Fieldslib.Field.t -> t -> File_kind.t -> unit) -> perm:((t, file_perm) Fieldslib.Field.t -> t -> file_perm -> unit) -> nlink:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> uid:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> gid:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> rdev:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> size:((t, int64) Fieldslib.Field.t -> t -> int64 -> unit) -> atime:((t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> unit) -> mtime:((t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> unit) -> ctime:((t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> unit) -> unit
#
val fold : t -> init:'acc__ -> dev:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> ino:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> kind:('acc__ -> (t, File_kind.t) Fieldslib.Field.t -> t -> File_kind.t -> 'acc__) -> perm:('acc__ -> (t, file_perm) Fieldslib.Field.t -> t -> file_perm -> 'acc__) -> nlink:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> uid:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> rdev:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> size:('acc__ -> (t, int64) Fieldslib.Field.t -> t -> int64 -> 'acc__) -> atime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> 'acc__) -> mtime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> 'acc__) -> ctime:('acc__ -> (t, Core.Std.Time.t) Fieldslib.Field.t -> t -> Core.Std.Time.t -> 'acc__) -> 'acc__
end
end
#
val to_string : t -> string
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
val fstat : Fd.t -> Stats.t Import.Deferred.t
#
val stat : string -> Stats.t Import.Deferred.t
#
val lstat : string -> Stats.t Import.Deferred.t
#
val remove : string -> unit Import.Deferred.t
#
val rename : src:string -> dst:string -> unit Import.Deferred.t
#
val chmod : string -> perm:file_perm -> unit Import.Deferred.t
#
val fchmod : Fd.t -> perm:file_perm -> unit Import.Deferred.t
#
val chown : string -> uid:int -> gid:int -> unit Import.Deferred.t
#
val fchown : Fd.t -> uid:int -> gid:int -> unit Import.Deferred.t
#
val access : string -> [
| `Read
| `Write
| `Exec
| `Exists
] list -> (unit, exn) Core.Std.Result.t Import.Deferred.t
#
val access_exn : string -> [
| `Read
| `Write
| `Exec
| `Exists
] list -> unit Import.Deferred.t
#
val set_close_on_exec : Fd.t -> unit
#
val clear_close_on_exec : Fd.t -> unit
#
val mkdir : ?p:unit -> ?perm:file_perm -> string -> unit Import.Deferred.t
#
val rmdir : string -> unit Import.Deferred.t
#
val chdir : string -> unit Import.Deferred.t
#
val getcwd : unit -> string Import.Deferred.t
#
val chroot : string -> unit Import.Deferred.t
#
type dir_handle = Core.Std.Unix.dir_handle
#
val opendir : string -> dir_handle Import.Deferred.t
#
val readdir : dir_handle -> string Import.Deferred.t
#
val rewinddir : dir_handle -> unit Import.Deferred.t
#
val closedir : dir_handle -> unit Import.Deferred.t
#
val pipe : Core.Std.Info.t -> ([
| `Reader of Fd.t
] * [
| `Writer of Fd.t
]) Import.Deferred.t

The info supplied to pipe is debugging information that will be included in the returned Fds.

#
val mkfifo : ?perm:file_perm -> string -> unit Import.Deferred.t

Create a named pipe with the given permissions.

#
val mkstemp : string -> (string * Fd.t) Import.Deferred.t

mkstemp prefix creates and opens a unique temporary file with prefix, automatically appending a suffix of six random characters to make the name unique. Unlike C's mkstemp, prefix should not include six X's at the end.

Raises Unix_error on errors.
#
val mkdtemp : string -> string Import.Deferred.t
#
type process_times = Core.Std.Unix.process_times = {
# tms_utime
: float;(*User time for the process*)
# tms_stime
: float;(*System time for the process*)
# tms_cutime
: float;(*User time for the children processes*)
# tms_cstime
: float;(*System time for the children processes*)
}

Time functions.

#
val times : unit -> process_times
#
type tm = Core.Std.Unix.tm = {
# tm_sec
: int;(*Seconds 0..59*)
# tm_min
: int;(*Minutes 0..59*)
# tm_hour
: int;(*Hours 0..23*)
# tm_mday
: int;(*Day of month 1..31*)
# tm_mon
: int;(*Month of year 0..11*)
# tm_year
: int;(*Year - 1900*)
# tm_wday
: int;(*Day of week (Sunday is 0)*)
# tm_yday
: int;(*Day of year 0..365*)
# tm_isdst
: bool;(*Daylight time savings in effect*)
}
#
val time : unit -> float
#
val gettimeofday : unit -> float
#
val gmtime : float -> tm
#
val localtime : float -> tm
#
val mktime : tm -> float * tm
#
val utimes : string -> access:float -> modif:float -> unit Import.Deferred.t
#
val environment : unit -> string array
#
val getenv : string -> string option
#
val getenv_exn : string -> string
#
val putenv : key:string -> data:string -> unit
#
val unsetenv : string -> unit
#
val fork_exec : prog:string -> args:string list -> ?use_path:bool -> ?env:[
| Core.Std.Unix.env
| `Replace_raw of string list
] -> unit -> Core.Std.Pid.t Import.Deferred.t

fork_exec ~prog ~args ?path ?env forks and execs prog with args, and returns the child pid. If use_path = true (the default) and prog doesn't contain a slash, then fork_exec searches the PATH environment variable for prog. If env is supplied, it specifies the environment when prog is executed.

If env contains multiple bindings for the same variable, the last takes precedence. In the case of `Extend, bindings in env take precedence over the existing environment. See Unix.exec.

#
type wait_on = [
| `Any
| `Group of Core.Std.Pid.t
| `My_group
| `Pid of Core.Std.Pid.t
]
#
val wait : wait_on -> (Core.Std.Pid.t * Exit_or_signal.t) Import.Deferred.t
#
val wait_nohang : wait_on -> (Core.Std.Pid.t * Exit_or_signal.t) option
#
val wait_untraced : wait_on -> (Core.Std.Pid.t * Exit_or_signal_or_stop.t) Import.Deferred.t
#
val wait_nohang_untraced : wait_on -> (Core.Std.Pid.t * Exit_or_signal_or_stop.t) option
#
val waitpid : Core.Std.Pid.t -> Exit_or_signal.t Import.Deferred.t

waitpid pid returns a deferred that becomes determined with the child's exit status, when the child process with process id pid exits. waitpid_exn is like waitpid, except the result only becomes determined if the child exits with status zero; it raises if the child terminates win any other way.

#
val waitpid_exn : Core.Std.Pid.t -> unit Import.Deferred.t
#
module Inet_addr : sig
#
type t = Core.Std.Unix.Inet_addr.t
include Core.Std.Comparable.S with type t := t
#
val of_string : string -> t
#
val to_string : t -> string
#
val bind_any : t
#
val bind_any_inet6 : t
#
val localhost : t

127.0.0.1

#
val localhost_inet6 : t

(::1)

#
val inet4_addr_of_int32 : Core.Std.Int32.t -> t
#
val inet4_addr_to_int32_exn : t -> Core.Std.Int32.t
#
val of_string_or_getbyname : string -> t Import.Deferred.t

of_string_or_getbyname hostname does a DNS lookup of hostname and returns the resulting IP address. The implemenation sequentializes all calls so that only a single call is active at a time. The is because we've observed thread safety issues with certain versions of winbind using "wins" name resolution.

#
val compare : t -> t -> int
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
end
#
module Cidr : module type of Core.Std.Unix.Cidr
#
module Protocol_family : sig
#
type t = Core.Std.Unix.Protocol_family.t
end
#
val socketpair : unit -> Fd.t * Fd.t
#
module Socket : sig
#
module Address : sig
#
module Unix : sig
#
type t = [
| `Unix of string
]
#
val create : string -> t
#
val to_string : t -> string
#
val compare : t -> t -> int
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val __t_of_sexp__ : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
end
#
module Inet : sig
#
type t = [
| `Inet of Inet_addr.t * int
]
#
val create : Inet_addr.t -> port:int -> t
#
val create_bind_any : port:int -> t
#
val addr : t -> Inet_addr.t
#
val port : t -> int
#
val to_string : t -> string
#
val to_host_and_port : t -> Core.Std.Host_and_port.t
#
val compare : t -> t -> int
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val __t_of_sexp__ : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
end
#
type t = [ ]
#
val to_string : [<
| t
] -> string
#
val to_sockaddr : [<
| t
] -> Core.Std.Unix.sockaddr
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val __t_of_sexp__ : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
end
#
module Family : sig
#
type 'a t constraint 'a = [< ]
#
val unix : Address.Unix.t t
#
val inet : Address.Inet.t t
#
val to_string : 'a t -> string
end
#
type ('a, 'b) t constraint 'a = [<
| `Unconnected
| `Bound
| `Passive
| `Active
] constraint 'b = [< ]

Sockets have a phantom type parameter that tracks the state of the socket in order to eliminate certain errors in which socket functions are called in the wrong order. Initially, a socket is `Unconnected. As various socket functions are called, they return a socket with a new phantom state. Here is a chart of the allowed state transitions.

        Unconnected ---connect--> Active
        |
        | ---bind--> Bound ---listen--> Passive ---accept---> Active
                     |
                     | ---connect--> Active
#
module Type : sig
#
type 'a t constraint 'a = [< ]
#
val tcp : Address.Inet.t t
#
val udp : Address.Inet.t t
#
val unix : Address.Unix.t t
#
val unix_dgram : Address.Unix.t t
#
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
end
#
val create : 'addr Type.t -> ([
| `Unconnected
], 'addr) t
#
val connect : ([<
| `Unconnected
| `Bound
], 'addr) t -> 'addr -> ([
| `Active
], 'addr) t Import.Deferred.t
#
val connect_interruptible : ([<
| `Unconnected
| `Bound
], 'addr) t -> 'addr -> interrupt:unit Import.Deferred.t -> [
| `Ok of ([
| `Active
], 'addr) t
| `Interrupted
] Import.Deferred.t
#
val bind : ?reuseaddr:bool -> ([
| `Unconnected
], 'addr) t -> 'addr -> ([
| `Bound
], 'addr) t Import.Deferred.t

bind socket addr sets close_on_exec for the fd of socket.

#
val listen : ?max_pending_connections:int -> ([
| `Bound
], 'addr) t -> ([
| `Passive
], 'addr) t
#
val accept : ([
| `Passive
], 'addr) t -> [
| `Ok of ([
| `Active
], 'addr) t * 'addr
| `Socket_closed
] Import.Deferred.t
#
val accept_interruptible : ([
| `Passive
], 'addr) t -> interrupt:unit Import.Deferred.t -> [
| `Ok of ([
| `Active
], 'addr) t * 'addr
| `Socket_closed
| `Interrupted
] Import.Deferred.t
#
val shutdown : ('a, 'addr) t -> [
| `Receive
| `Send
| `Both
] -> unit
#
val fd : ('a, 'addr) t -> Fd.t
#
val of_fd : Fd.t -> 'addr Type.t -> ('a, 'addr) t
#
val getsockname : ('a, 'addr) t -> 'addr
#
val getpeername : ('a, 'addr) t -> 'addr
#
module Opt : sig
#
type 'a t
#
val debug : bool t
#
val broadcast : bool t
#
val reuseaddr : bool t
#
val keepalive : bool t
#
val dontroute : bool t
#
val oobinline : bool t
#
val acceptconn : bool t
#
val nodelay : bool t
#
val sndbuf : int t
#
val rcvbuf : int t
#
val error : int t
#
val typ : int t
#
val rcvlowat : int t
#
val sndlowat : int t
#
val linger : int option t
#
val rcvtimeo : float t
#
val sndtimeo : float t
#
val mcast_loop : bool t
#
val mcast_ttl : int t
#
val to_string : 'a t -> string
end
#
val getopt : ('a, 'addr) t -> 'c Opt.t -> 'c
#
val setopt : ('a, 'addr) t -> 'c Opt.t -> 'c -> unit
#
val mcast_join : ?ifname:string -> ?source:Inet_addr.t -> ('a, 'addr) t -> 'addr -> unit
#
val mcast_leave : ?ifname:string -> ('a, 'addr) t -> 'addr -> unit
#
val bind_to_interface_exn : (([
| `Unconnected
], _) t -> [
| `Any
| `Interface_name of string
] -> unit) Core.Std.Or_error.t

bind_to_interface_exn t (`Interface_name "eth0") restricts messages from being received or sent on interfaces other than eth0. See Linux_ext.bind_to_interface.

Typically, one would use this function for very specific non-multicast requirements. For similar functionality when using multicast, see Core_unix.mcast_set_ifname.

#
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> ('b -> Sexplib.Sexp.t) -> ('a, 'b) t -> Sexplib.Sexp.t
end
#
val bind_to_interface_exn : (Fd.t -> [
| `Any
| `Interface_name of string
] -> unit) Core.Std.Or_error.t
#
module Host : sig
#
type t = Core.Std.Unix.Host.t = {
# name
: string;
# aliases
: string array;
# family
: Protocol_family.t;
# addresses
: Inet_addr.t array;
}
#
val getbyname : string -> t option Import.Deferred.t
#
val getbyname_exn : string -> t Import.Deferred.t
#
val getbyaddr : Inet_addr.t -> t option Import.Deferred.t
#
val getbyaddr_exn : Inet_addr.t -> t Import.Deferred.t
#
val have_address_in_common : t -> t -> bool
end
#
type socket_domain = Core.Std.Unix.socket_domain =
# | PF_UNIX
# | PF_INET
# | PF_INET6
#
type socket_type = Core.Std.Unix.socket_type =
# | SOCK_STREAM
# | SOCK_DGRAM
# | SOCK_RAW
# | SOCK_SEQPACKET
#
type sockaddr = Core.Std.Unix.sockaddr =
# | ADDR_UNIX of string
# | ADDR_INET of Inet_addr.t * int
#
module Addr_info : sig
#
type t = Core.Std.Unix.addr_info = {
# ai_family
: socket_domain;
# ai_socktype
: socket_type;
# ai_protocol
: int;
# ai_addr
: sockaddr;
# ai_canonname
: string;
}
#
type getaddrinfo_option = Core.Std.Unix.getaddrinfo_option =
# | AI_FAMILY of socket_domain
# | AI_SOCKTYPE of socket_type
# | AI_PROTOCOL of int
# | AI_NUMERICHOST
# | AI_CANONNAME
# | AI_PASSIVE
#
val get : ?service:string -> host:string -> getaddrinfo_option list -> t list Import.Deferred.t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
#
val getaddrinfo_option_of_sexp : Sexplib.Sexp.t -> getaddrinfo_option
#
val sexp_of_getaddrinfo_option : getaddrinfo_option -> Sexplib.Sexp.t
#
val bin_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Type_class.t
#
val bin_read_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Read.reader
#
val __bin_read_getaddrinfo_option__ : (int -> getaddrinfo_option) Core.Std.Bin_prot.Read.reader
#
val bin_reader_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Type_class.reader
#
val bin_size_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Size.sizer
#
val bin_write_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Write.writer
#
val bin_writer_getaddrinfo_option : getaddrinfo_option Core.Std.Bin_prot.Type_class.writer
end
#
module Name_info : sig
#
type t = Core.Std.Unix.name_info = {
# ni_hostname
: string;
# ni_service
: string;
}
#
type getnameinfo_option = Core.Std.Unix.getnameinfo_option =
# | NI_NOFQDN
# | NI_NUMERICHOST
# | NI_NAMEREQD
# | NI_NUMERICSERV
# | NI_DGRAM
#
val get : sockaddr -> getnameinfo_option list -> t Import.Deferred.t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Core.Std.Bin_prot.Type_class.t
#
val bin_read_t : t Core.Std.Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
#
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
#
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
#
val bin_write_t : t Core.Std.Bin_prot.Write.writer
#
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
#
val getnameinfo_option_of_sexp : Sexplib.Sexp.t -> getnameinfo_option
#
val sexp_of_getnameinfo_option : getnameinfo_option -> Sexplib.Sexp.t
#
val bin_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Type_class.t
#
val bin_read_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Read.reader
#
val __bin_read_getnameinfo_option__ : (int -> getnameinfo_option) Core.Std.Bin_prot.Read.reader
#
val bin_reader_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Type_class.reader
#
val bin_size_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Size.sizer
#
val bin_write_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Write.writer
#
val bin_writer_getnameinfo_option : getnameinfo_option Core.Std.Bin_prot.Type_class.writer
end
#
val gethostname : unit -> string
#
val getuid : unit -> int
#
val geteuid : unit -> int
#
val getgid : unit -> int
#
val getegid : unit -> int
#
val setuid : int -> unit
#
module Error = Core.Std.Unix.Error
#
type error = Core.Std.Unix.error =
# | E2BIG
# | EACCES
# | EAGAIN
# | EBADF
# | EBUSY
# | ECHILD
# | EDEADLK
# | EDOM
# | EEXIST
# | EFAULT
# | EFBIG
# | EINTR
# | EINVAL
# | EIO
# | EISDIR
# | EMFILE
# | ENAMETOOLONG
# | ENFILE
# | ENODEV
# | ENOENT
# | ENOEXEC
# | ENOLCK
# | ENOMEM
# | ENOSPC
# | ENOSYS
# | ENOTDIR
# | ENOTEMPTY
# | ENOTTY
# | ENXIO
# | EPERM
# | EPIPE
# | ERANGE
# | EROFS
# | ESPIPE
# | ESRCH
# | EXDEV
# | EWOULDBLOCK
# | EINPROGRESS
# | EALREADY
# | ENOTSOCK
# | EDESTADDRREQ
# | EMSGSIZE
# | EPROTOTYPE
# | ENOPROTOOPT
# | EPROTONOSUPPORT
# | ESOCKTNOSUPPORT
# | EOPNOTSUPP
# | EPFNOSUPPORT
# | EAFNOSUPPORT
# | EADDRINUSE
# | EADDRNOTAVAIL
# | ENETDOWN
# | ENETUNREACH
# | ENETRESET
# | ECONNABORTED
# | ECONNRESET
# | ENOBUFS
# | EISCONN
# | ENOTCONN
# | ESHUTDOWN
# | ETOOMANYREFS
# | ETIMEDOUT
# | ECONNREFUSED
# | EHOSTDOWN
# | EHOSTUNREACH
# | ELOOP
# | EOVERFLOW
# | EUNKNOWNERR of int

Deprecated in favor of Error.t
#
exception Unix_error of Error.t * string * string
#
module Terminal_io : sig
#
type t = Core.Std.Caml.Unix.terminal_io = {
# mutable c_ignbrk
: bool;(*Ignore the break condition.*)
# mutable c_brkint
: bool;(*Signal interrupt on break condition.*)
# mutable c_ignpar
: bool;(*Ignore characters with parity errors.*)
# mutable c_parmrk
: bool;(*Mark parity errors.*)
# mutable c_inpck
: bool;(*Enable parity check on input.*)
# mutable c_istrip
: bool;(*Strip 8th bit on input characters.*)
# mutable c_inlcr
: bool;(*Map NL to CR on input.*)
# mutable c_igncr
: bool;(*Ignore CR on input.*)
# mutable c_icrnl
: bool;(*Map CR to NL on input.*)
# mutable c_ixon
: bool;(*Recognize XON/XOFF characters on input.*)
# mutable c_ixoff
: bool;(*Emit XON/XOFF chars to control input flow.*)
# mutable c_opost
: bool;(*Enable output processing.*)
# mutable c_obaud
: int;(*Output baud rate (0 means close connection).*)
# mutable c_ibaud
: int;(*Input baud rate.*)
# mutable c_csize
: int;(*Number of bits per character (5-8).*)
# mutable c_cstopb
: int;(*Number of stop bits (1-2).*)
# mutable c_cread
: bool;(*Reception is enabled.*)
# mutable c_parenb
: bool;(*Enable parity generation and detection.*)
# mutable c_parodd
: bool;(*Specify odd parity instead of even.*)
# mutable c_hupcl
: bool;(*Hang up on last close.*)
# mutable c_clocal
: bool;(*Ignore modem status lines.*)
# mutable c_isig
: bool;(*Generate signal on INTR, QUIT, SUSP.*)
# mutable c_icanon
: bool;(*Enable canonical processing (line buffering and editing)*)
# mutable c_noflsh
: bool;(*Disable flush after INTR, QUIT, SUSP.*)
# mutable c_echo
: bool;(*Echo input characters.*)
# mutable c_echoe
: bool;(*Echo ERASE (to erase previous character).*)
# mutable c_echok
: bool;(*Echo KILL (to erase the current line).*)
# mutable c_echonl
: bool;(*Echo NL even if c_echo is not set.*)
# mutable c_vintr
: char;(*Interrupt character (usually ctrl-C).*)
# mutable c_vquit
: char;(*Quit character (usually ctrl-\ ).*)
# mutable c_verase
: char;(*Erase character (usually DEL or ctrl-H).*)
# mutable c_vkill
: char;(*Kill line character (usually ctrl-U).*)
# mutable c_veof
: char;(*End-of-file character (usually ctrl-D).*)
# mutable c_veol
: char;(*Alternate end-of-line char. (usually none).*)
# mutable c_vmin
: int;(*Minimum number of characters to read before the read request is satisfied.*)
# mutable c_vtime
: int;(*Maximum read wait (in 0.1s units).*)
# mutable c_vstart
: char;(*Start character (usually ctrl-Q).*)
# mutable c_vstop
: char;(*Stop character (usually ctrl-S).*)
}
#
type setattr_when = Core.Std.Caml.Unix.setattr_when =
# | TCSANOW
# | TCSADRAIN
# | TCSAFLUSH
#
val tcgetattr : Fd.t -> t Import.Deferred.t
#
val tcsetattr : t -> Fd.t -> mode:setattr_when -> unit Import.Deferred.t
end
#
module Passwd : sig

Structure of entries in the passwd database.

#
type t = Core.Std.Unix.Passwd.t = {
# name
: string;
# passwd
: string;
# uid
: int;
# gid
: int;
# gecos
: string;
# dir
: string;
# shell
: string;
}
#
val shell : t -> string
#
val dir : t -> string
#
val gecos : t -> string
#
val gid : t -> int
#
val uid : t -> int
#
val passwd : t -> string
#
val name : t -> string
#
module Fields : sig
#
val names : string list
#
val shell : (t, string) Fieldslib.Field.t
#
val dir : (t, string) Fieldslib.Field.t
#
val gecos : (t, string) Fieldslib.Field.t
#
val gid : (t, int) Fieldslib.Field.t
#
val uid : (t, int) Fieldslib.Field.t
#
val passwd : (t, string) Fieldslib.Field.t
#
val name : (t, string) Fieldslib.Field.t
#
val fold : init:'acc__ -> name:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> passwd:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> uid:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> gecos:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> dir:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> shell:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> 'acc__
#
val make_creator : name:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> passwd:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> uid:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> gid:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> gecos:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> dir:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> shell:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> 'compile_acc__ -> ('input__ -> t) * 'compile_acc__
#
val create : name:string -> passwd:string -> uid:int -> gid:int -> gecos:string -> dir:string -> shell:string -> t
#
val map : name:((t, string) Fieldslib.Field.t -> string) -> passwd:((t, string) Fieldslib.Field.t -> string) -> uid:((t, int) Fieldslib.Field.t -> int) -> gid:((t, int) Fieldslib.Field.t -> int) -> gecos:((t, string) Fieldslib.Field.t -> string) -> dir:((t, string) Fieldslib.Field.t -> string) -> shell:((t, string) Fieldslib.Field.t -> string) -> t
#
val iter : name:((t, string) Fieldslib.Field.t -> unit) -> passwd:((t, string) Fieldslib.Field.t -> unit) -> uid:((t, int) Fieldslib.Field.t -> unit) -> gid:((t, int) Fieldslib.Field.t -> unit) -> gecos:((t, string) Fieldslib.Field.t -> unit) -> dir:((t, string) Fieldslib.Field.t -> unit) -> shell:((t, string) Fieldslib.Field.t -> unit) -> unit
#
val for_all : name:((t, string) Fieldslib.Field.t -> bool) -> passwd:((t, string) Fieldslib.Field.t -> bool) -> uid:((t, int) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> gecos:((t, string) Fieldslib.Field.t -> bool) -> dir:((t, string) Fieldslib.Field.t -> bool) -> shell:((t, string) Fieldslib.Field.t -> bool) -> bool
#
val exists : name:((t, string) Fieldslib.Field.t -> bool) -> passwd:((t, string) Fieldslib.Field.t -> bool) -> uid:((t, int) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> gecos:((t, string) Fieldslib.Field.t -> bool) -> dir:((t, string) Fieldslib.Field.t -> bool) -> shell:((t, string) Fieldslib.Field.t -> bool) -> bool
#
val to_list : name:((t, string) Fieldslib.Field.t -> 'elem__) -> passwd:((t, string) Fieldslib.Field.t -> 'elem__) -> uid:((t, int) Fieldslib.Field.t -> 'elem__) -> gid:((t, int) Fieldslib.Field.t -> 'elem__) -> gecos:((t, string) Fieldslib.Field.t -> 'elem__) -> dir:((t, string) Fieldslib.Field.t -> 'elem__) -> shell:((t, string) Fieldslib.Field.t -> 'elem__) -> 'elem__ list
#
val map_poly : ([<
| `Read
| `Set_and_create
], t, 'x0) Fieldslib.Field.user -> 'x0 list
#
module Direct : sig
#
val iter : t -> name:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> passwd:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> uid:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> gid:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> gecos:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> dir:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> shell:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> unit
#
val fold : t -> init:'acc__ -> name:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> passwd:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> uid:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> gecos:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> dir:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> shell:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> 'acc__
end
end
#
val getbyname : string -> t option Import.Deferred.t
#
val getbyname_exn : string -> t Import.Deferred.t
#
val getbyuid : int -> t option Import.Deferred.t
#
val getbyuid_exn : int -> t Import.Deferred.t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Group : sig

Structure of entries in the groups database.

#
type t = {
# name
: string;
# passwd
: string;
# gid
: int;
# mem
: string array;
}
#
val mem : t -> string array
#
val gid : t -> int
#
val passwd : t -> string
#
val name : t -> string
#
module Fields : sig
#
val names : string list
#
val mem : (t, string array) Fieldslib.Field.t
#
val gid : (t, int) Fieldslib.Field.t
#
val passwd : (t, string) Fieldslib.Field.t
#
val name : (t, string) Fieldslib.Field.t
#
val fold : init:'acc__ -> name:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> passwd:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> 'acc__) -> mem:('acc__ -> (t, string array) Fieldslib.Field.t -> 'acc__) -> 'acc__
#
val make_creator : name:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> passwd:((t, string) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string) * 'compile_acc__) -> gid:((t, int) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> int) * 'compile_acc__) -> mem:((t, string array) Fieldslib.Field.t -> 'compile_acc__ -> ('input__ -> string array) * 'compile_acc__) -> 'compile_acc__ -> ('input__ -> t) * 'compile_acc__
#
val create : name:string -> passwd:string -> gid:int -> mem:string array -> t
#
val map : name:((t, string) Fieldslib.Field.t -> string) -> passwd:((t, string) Fieldslib.Field.t -> string) -> gid:((t, int) Fieldslib.Field.t -> int) -> mem:((t, string array) Fieldslib.Field.t -> string array) -> t
#
val iter : name:((t, string) Fieldslib.Field.t -> unit) -> passwd:((t, string) Fieldslib.Field.t -> unit) -> gid:((t, int) Fieldslib.Field.t -> unit) -> mem:((t, string array) Fieldslib.Field.t -> unit) -> unit
#
val for_all : name:((t, string) Fieldslib.Field.t -> bool) -> passwd:((t, string) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> mem:((t, string array) Fieldslib.Field.t -> bool) -> bool
#
val exists : name:((t, string) Fieldslib.Field.t -> bool) -> passwd:((t, string) Fieldslib.Field.t -> bool) -> gid:((t, int) Fieldslib.Field.t -> bool) -> mem:((t, string array) Fieldslib.Field.t -> bool) -> bool
#
val to_list : name:((t, string) Fieldslib.Field.t -> 'elem__) -> passwd:((t, string) Fieldslib.Field.t -> 'elem__) -> gid:((t, int) Fieldslib.Field.t -> 'elem__) -> mem:((t, string array) Fieldslib.Field.t -> 'elem__) -> 'elem__ list
#
val map_poly : ([<
| `Read
| `Set_and_create
], t, 'x0) Fieldslib.Field.user -> 'x0 list
#
module Direct : sig
#
val iter : t -> name:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> passwd:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> gid:((t, int) Fieldslib.Field.t -> t -> int -> unit) -> mem:((t, string array) Fieldslib.Field.t -> t -> string array -> unit) -> unit
#
val fold : t -> init:'acc__ -> name:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> passwd:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) -> gid:('acc__ -> (t, int) Fieldslib.Field.t -> t -> int -> 'acc__) -> mem:('acc__ -> (t, string array) Fieldslib.Field.t -> t -> string array -> 'acc__) -> 'acc__
end
end
#
val getbyname : string -> t option Import.Deferred.t
#
val getbyname_exn : string -> t Import.Deferred.t
#
val getbygid : int -> t option Import.Deferred.t
#
val getbygid_exn : int -> t Import.Deferred.t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
val getlogin : unit -> string Import.Deferred.t

Return the login name of the user executing the process.

This returns a deferred because the username may need to be looked up in what is essentially a database elsewhere on the network (winbound user, or NIS).

#
val wordexp : (?flags:[
| `No_cmd
| `Show_err
| `Undef
] list -> string -> string array Import.Deferred.t) Core.Std.Or_error.t
#
val wait_on_of_sexp : Sexplib.Sexp.t -> wait_on
#
val __wait_on_of_sexp__ : Sexplib.Sexp.t -> wait_on
#
val sexp_of_wait_on : wait_on -> Sexplib.Sexp.t
#
val socket_domain_of_sexp : Sexplib.Sexp.t -> socket_domain
#
val sexp_of_socket_domain : socket_domain -> Sexplib.Sexp.t
#
val bin_socket_domain : socket_domain Core.Std.Bin_prot.Type_class.t
#
val bin_read_socket_domain : socket_domain Core.Std.Bin_prot.Read.reader
#
val __bin_read_socket_domain__ : (int -> socket_domain) Core.Std.Bin_prot.Read.reader
#
val bin_reader_socket_domain : socket_domain Core.Std.Bin_prot.Type_class.reader
#
val bin_size_socket_domain : socket_domain Core.Std.Bin_prot.Size.sizer
#
val bin_write_socket_domain : socket_domain Core.Std.Bin_prot.Write.writer
#
val bin_writer_socket_domain : socket_domain Core.Std.Bin_prot.Type_class.writer
#
val socket_type_of_sexp : Sexplib.Sexp.t -> socket_type
#
val sexp_of_socket_type : socket_type -> Sexplib.Sexp.t
#
val bin_socket_type : socket_type Core.Std.Bin_prot.Type_class.t
#
val bin_read_socket_type : socket_type Core.Std.Bin_prot.Read.reader
#
val __bin_read_socket_type__ : (int -> socket_type) Core.Std.Bin_prot.Read.reader
#
val bin_reader_socket_type : socket_type Core.Std.Bin_prot.Type_class.reader
#
val bin_size_socket_type : socket_type Core.Std.Bin_prot.Size.sizer
#
val bin_write_socket_type : socket_type Core.Std.Bin_prot.Write.writer
#
val bin_writer_socket_type : socket_type Core.Std.Bin_prot.Type_class.writer
#
val sockaddr_of_sexp : Sexplib.Sexp.t -> sockaddr
#
val sexp_of_sockaddr : sockaddr -> Sexplib.Sexp.t
#
val bin_sockaddr : sockaddr Core.Std.Bin_prot.Type_class.t
#
val bin_read_sockaddr : sockaddr Core.Std.Bin_prot.Read.reader
#
val __bin_read_sockaddr__ : (int -> sockaddr) Core.Std.Bin_prot.Read.reader
#
val bin_reader_sockaddr : sockaddr Core.Std.Bin_prot.Type_class.reader
#
val bin_size_sockaddr : sockaddr Core.Std.Bin_prot.Size.sizer
#
val bin_write_sockaddr : sockaddr Core.Std.Bin_prot.Write.writer
#
val bin_writer_sockaddr : sockaddr Core.Std.Bin_prot.Type_class.writer
#
val error_of_sexp : Sexplib.Sexp.t -> error
#
val sexp_of_error : error -> Sexplib.Sexp.t
end