package uwt

  1. Overview
  2. Docs

Popular functions from the standard Unix module, but all calls are executed in work threads.

They are usually part of uwt, not libuv. They were added to simplify testing uwt with existing code that originally used lwt.unix.

But be careful: Functions like gethostbyname don't fail with Not_found, but with Unix_error(Unix.ENOENT,"function_name",x) or other appropriate error codes. Uwt_compat.Lwt_unix provides functions under the same name that also fails with Not_found.

val gethostname : unit -> string Lwt.t

Return the name of the local host.

val gethostbyname : string -> Unix.host_entry Lwt.t

Find an entry in hosts with the given name.

val gethostbyaddr : Unix.inet_addr -> Unix.host_entry Lwt.t

Find an entry in hosts with the given address.

val getservbyname : name:string -> protocol:string -> Unix.service_entry Lwt.t

Find an entry in services with the given name.

val getservbyport : int -> string -> Unix.service_entry Lwt.t

Find an entry in services with the given service number.

val getprotobyname : string -> Unix.protocol_entry Lwt.t

Find an entry in protocols with the given name.

val getprotobynumber : int -> Unix.protocol_entry Lwt.t

Find an entry in protocols with the given protocol number.

val getlogin : unit -> string Lwt.t

Return the login name of the user executing the process.

val getpwnam : string -> Unix.passwd_entry Lwt.t

Find an entry in passwd with the given name.

val getpwuid : int -> Unix.passwd_entry Lwt.t

Find an entry in passwd with the given user id.

val getgrnam : string -> Unix.group_entry Lwt.t

Find an entry in group with the given name.

val getgrgid : int -> Unix.group_entry Lwt.t

Find an entry in group with the given group id.

val lseek : file -> int64 -> Unix.seek_command -> int64 Lwt.t

Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

val getcwd : unit -> string Lwt.t

Return the name of the current working directory.

val chdir : string -> unit Lwt.t

Change the process working directory.

val chroot : string -> unit Lwt.t

Change the process root directory.

val lockf : file -> Unix.lock_command -> int64 -> unit Lwt.t

See the long comment at the standard Unix module

val sleep : float -> unit Lwt.t

sleep d is a thread that remains suspended for d seconds and then terminates.

val pipe : ?cloexec:bool -> unit -> (Pipe.t * Pipe.t) uv_result

pipe () creates pipes similar to Unix.pipe, but as Pipe.t

  • parameter cloexec

    is true by default

val pipe_exn : ?cloexec:bool -> unit -> Pipe.t * Pipe.t
val realpath : string -> string Lwt.t

wrapper around realpath under Unix and GetFinalPathNameByHandleW or GetFullPathName under windows. Deprecated. Use Uwt.Fs.realpath instead, it will also work for older libuv versions.

  • deprecated Use Uwt.Fs.realpath instead
OCaml

Innovation. Community. Security.