package lwt

  1. Overview
  2. Docs
val handle_unix_error : ('a -> 'b Lwt.t) -> 'a -> 'b Lwt.t
type async_method =
  1. | Async_none
  2. | Async_detach
  3. | Async_switch
val default_async_method : unit -> async_method
val set_default_async_method : async_method -> unit
val async_method : unit -> async_method
val async_method_key : async_method Lwt.key
val with_async_none : (unit -> 'a) -> 'a
val with_async_detach : (unit -> 'a) -> 'a
val with_async_switch : (unit -> 'a) -> 'a
val sleep : float -> unit Lwt.t
val yield : unit -> unit Lwt.t
val auto_yield : float -> unit -> unit Lwt.t
exception Timeout
val timeout : float -> 'a Lwt.t
val with_timeout : float -> (unit -> 'a Lwt.t) -> 'a Lwt.t
type file_descr
type state =
  1. | Opened
  2. | Closed
  3. | Aborted of exn
val state : file_descr -> state
val unix_file_descr : file_descr -> Unix.file_descr
val of_unix_file_descr : ?blocking:bool -> ?set_flags:bool -> Unix.file_descr -> file_descr
val blocking : file_descr -> bool Lwt.t
val set_blocking : ?set_flags:bool -> file_descr -> bool -> unit
val abort : file_descr -> exn -> unit
val fork : unit -> int
type process_status = Unix.process_status =
  1. | WEXITED of int
  2. | WSIGNALED of int
  3. | WSTOPPED of int
type wait_flag = Unix.wait_flag =
  1. | WNOHANG
  2. | WUNTRACED
val wait : unit -> (int * process_status) Lwt.t
val waitpid : wait_flag list -> int -> (int * process_status) Lwt.t
type resource_usage = {
  1. ru_utime : float;
  2. ru_stime : float;
}
val wait4 : wait_flag list -> int -> (int * process_status * resource_usage) Lwt.t
val wait_count : unit -> int
val system : string -> process_status Lwt.t
val stdin : file_descr
val stdout : file_descr
val stderr : file_descr
type file_perm = Unix.file_perm
type open_flag = Unix.open_flag =
  1. | O_RDONLY
  2. | O_WRONLY
  3. | O_RDWR
  4. | O_NONBLOCK
  5. | O_APPEND
  6. | O_CREAT
  7. | O_TRUNC
  8. | O_EXCL
  9. | O_NOCTTY
  10. | O_DSYNC
  11. | O_SYNC
  12. | O_RSYNC
  13. | O_SHARE_DELETE
  14. | O_CLOEXEC
val openfile : string -> open_flag list -> file_perm -> file_descr Lwt.t
val close : file_descr -> unit Lwt.t
val read : file_descr -> string -> int -> int -> int Lwt.t
val write : file_descr -> string -> int -> int -> int Lwt.t
val readable : file_descr -> bool
val writable : file_descr -> bool
val wait_read : file_descr -> unit Lwt.t
val wait_write : file_descr -> unit Lwt.t
type seek_command = Unix.seek_command =
  1. | SEEK_SET
  2. | SEEK_CUR
  3. | SEEK_END
val lseek : file_descr -> int -> seek_command -> int Lwt.t
val truncate : string -> int -> unit Lwt.t
val ftruncate : file_descr -> int -> unit Lwt.t
val fsync : file_descr -> unit Lwt.t
val fdatasync : file_descr -> unit Lwt.t
type file_kind = Unix.file_kind =
  1. | S_REG
  2. | S_DIR
  3. | S_CHR
  4. | S_BLK
  5. | S_LNK
  6. | S_FIFO
  7. | S_SOCK
type stats = Unix.stats = {
  1. st_dev : int;
  2. st_ino : int;
  3. st_kind : file_kind;
  4. st_perm : file_perm;
  5. st_uid : int;
  6. st_gid : int;
  7. st_rdev : int;
  8. st_size : int;
  9. st_atime : float;
  10. st_mtime : float;
  11. st_ctime : float;
}
val stat : string -> stats Lwt.t
val lstat : string -> stats Lwt.t
val fstat : file_descr -> stats Lwt.t
val isatty : file_descr -> bool Lwt.t
module LargeFile : sig ... end
val rename : string -> string -> unit Lwt.t
val chmod : string -> file_perm -> unit Lwt.t
val fchmod : file_descr -> file_perm -> unit Lwt.t
val chown : string -> int -> int -> unit Lwt.t
val fchown : file_descr -> int -> int -> unit Lwt.t
type access_permission = Unix.access_permission =
  1. | R_OK
  2. | W_OK
  3. | X_OK
  4. | F_OK
val access : string -> access_permission list -> unit Lwt.t
val dup : file_descr -> file_descr
val dup2 : file_descr -> file_descr -> unit
val set_close_on_exec : file_descr -> unit
val clear_close_on_exec : file_descr -> unit
val mkdir : string -> file_perm -> unit Lwt.t
val rmdir : string -> unit Lwt.t
val chdir : string -> unit Lwt.t
val chroot : string -> unit Lwt.t
type dir_handle = Unix.dir_handle
val opendir : string -> dir_handle Lwt.t
val readdir : dir_handle -> string Lwt.t
val readdir_n : dir_handle -> int -> string array Lwt.t
val rewinddir : dir_handle -> unit Lwt.t
val closedir : dir_handle -> unit Lwt.t
val files_of_directory : string -> string Lwt_stream.t
val pipe : unit -> file_descr * file_descr
val pipe_in : unit -> file_descr * Unix.file_descr
val pipe_out : unit -> Unix.file_descr * file_descr
val mkfifo : string -> file_perm -> unit Lwt.t
type lock_command = Unix.lock_command =
  1. | F_ULOCK
  2. | F_LOCK
  3. | F_TLOCK
  4. | F_TEST
  5. | F_RLOCK
  6. | F_TRLOCK
val lockf : file_descr -> lock_command -> int -> unit Lwt.t
type passwd_entry = Unix.passwd_entry = {
  1. pw_name : string;
  2. pw_passwd : string;
  3. pw_uid : int;
  4. pw_gid : int;
  5. pw_gecos : string;
  6. pw_dir : string;
  7. pw_shell : string;
}
type group_entry = Unix.group_entry = {
  1. gr_name : string;
  2. gr_passwd : string;
  3. gr_gid : int;
  4. gr_mem : string array;
}
val getlogin : unit -> string Lwt.t
val getpwnam : string -> passwd_entry Lwt.t
val getgrnam : string -> group_entry Lwt.t
val getpwuid : int -> passwd_entry Lwt.t
val getgrgid : int -> group_entry Lwt.t
type signal_handler_id
val on_signal : int -> (int -> unit) -> signal_handler_id
val on_signal_full : int -> (signal_handler_id -> int -> unit) -> signal_handler_id
val disable_signal_handler : signal_handler_id -> unit
val signal_count : unit -> int
val reinstall_signal_handler : int -> unit
type inet_addr = Unix.inet_addr
type socket_domain = Unix.socket_domain =
  1. | PF_UNIX
  2. | PF_INET
  3. | PF_INET6
type socket_type = Unix.socket_type =
  1. | SOCK_STREAM
  2. | SOCK_DGRAM
  3. | SOCK_RAW
  4. | SOCK_SEQPACKET
type sockaddr = Unix.sockaddr =
  1. | ADDR_UNIX of string
  2. | ADDR_INET of inet_addr * int
val socket : socket_domain -> socket_type -> int -> file_descr
val socketpair : socket_domain -> socket_type -> int -> file_descr * file_descr
val bind : file_descr -> sockaddr -> unit
val listen : file_descr -> int -> unit
val accept : file_descr -> (file_descr * sockaddr) Lwt.t
val accept_n : file_descr -> int -> ((file_descr * sockaddr) list * exn option) Lwt.t
val connect : file_descr -> sockaddr -> unit Lwt.t
type shutdown_command = Unix.shutdown_command =
  1. | SHUTDOWN_RECEIVE
  2. | SHUTDOWN_SEND
  3. | SHUTDOWN_ALL
val shutdown : file_descr -> shutdown_command -> unit
val getsockname : file_descr -> sockaddr
val getpeername : file_descr -> sockaddr
type msg_flag = Unix.msg_flag =
  1. | MSG_OOB
  2. | MSG_DONTROUTE
  3. | MSG_PEEK
val recv : file_descr -> string -> int -> int -> msg_flag list -> int Lwt.t
val recvfrom : file_descr -> string -> int -> int -> msg_flag list -> (int * sockaddr) Lwt.t
val send : file_descr -> string -> int -> int -> msg_flag list -> int Lwt.t
val sendto : file_descr -> string -> int -> int -> msg_flag list -> sockaddr -> int Lwt.t
type io_vector = {
  1. iov_buffer : string;
  2. iov_offset : int;
  3. iov_length : int;
}
val io_vector : buffer:string -> offset:int -> length:int -> io_vector
val recv_msg : socket:file_descr -> io_vectors:io_vector list -> (int * Unix.file_descr list) Lwt.t
val send_msg : socket:file_descr -> io_vectors:io_vector list -> fds:Unix.file_descr list -> int Lwt.t
type credentials = {
  1. cred_pid : int;
  2. cred_uid : int;
  3. cred_gid : int;
}
val get_credentials : file_descr -> credentials
type socket_bool_option = Unix.socket_bool_option =
  1. | SO_DEBUG
  2. | SO_BROADCAST
  3. | SO_REUSEADDR
  4. | SO_KEEPALIVE
  5. | SO_DONTROUTE
  6. | SO_OOBINLINE
  7. | SO_ACCEPTCONN
  8. | TCP_NODELAY
  9. | IPV6_ONLY
type socket_int_option = Unix.socket_int_option =
  1. | SO_SNDBUF
  2. | SO_RCVBUF
  3. | SO_ERROR
  4. | SO_TYPE
  5. | SO_RCVLOWAT
  6. | SO_SNDLOWAT
type socket_optint_option = Unix.socket_optint_option =
  1. | SO_LINGER
type socket_float_option = Unix.socket_float_option =
  1. | SO_RCVTIMEO
  2. | SO_SNDTIMEO
val getsockopt : file_descr -> socket_bool_option -> bool
val setsockopt : file_descr -> socket_bool_option -> bool -> unit
val getsockopt_int : file_descr -> socket_int_option -> int
val setsockopt_int : file_descr -> socket_int_option -> int -> unit
val getsockopt_optint : file_descr -> socket_optint_option -> int option
val setsockopt_optint : file_descr -> socket_optint_option -> int option -> unit
val getsockopt_float : file_descr -> socket_float_option -> float
val setsockopt_float : file_descr -> socket_float_option -> float -> unit
val getsockopt_error : file_descr -> Unix.error option
type host_entry = Unix.host_entry = {
  1. h_name : string;
  2. h_aliases : string array;
  3. h_addrtype : socket_domain;
  4. h_addr_list : inet_addr array;
}
type protocol_entry = Unix.protocol_entry = {
  1. p_name : string;
  2. p_aliases : string array;
  3. p_proto : int;
}
type service_entry = Unix.service_entry = {
  1. s_name : string;
  2. s_aliases : string array;
  3. s_port : int;
  4. s_proto : string;
}
val gethostname : unit -> string Lwt.t
val gethostbyname : string -> host_entry Lwt.t
val gethostbyaddr : inet_addr -> host_entry Lwt.t
val getprotobyname : string -> protocol_entry Lwt.t
val getprotobynumber : int -> protocol_entry Lwt.t
val getservbyname : string -> string -> service_entry Lwt.t
val getservbyport : int -> string -> service_entry Lwt.t
type addr_info = Unix.addr_info = {
  1. ai_family : socket_domain;
  2. ai_socktype : socket_type;
  3. ai_protocol : int;
  4. ai_addr : sockaddr;
  5. ai_canonname : string;
}
type getaddrinfo_option = Unix.getaddrinfo_option =
  1. | AI_FAMILY of socket_domain
  2. | AI_SOCKTYPE of socket_type
  3. | AI_PROTOCOL of int
  4. | AI_NUMERICHOST
  5. | AI_CANONNAME
  6. | AI_PASSIVE
val getaddrinfo : string -> string -> getaddrinfo_option list -> addr_info list Lwt.t
type name_info = Unix.name_info = {
  1. ni_hostname : string;
  2. ni_service : string;
}
type getnameinfo_option = Unix.getnameinfo_option =
  1. | NI_NOFQDN
  2. | NI_NUMERICHOST
  3. | NI_NAMEREQD
  4. | NI_NUMERICSERV
  5. | NI_DGRAM
val getnameinfo : sockaddr -> getnameinfo_option list -> name_info Lwt.t
type terminal_io = Unix.terminal_io = {
  1. mutable c_ignbrk : bool;
  2. mutable c_brkint : bool;
  3. mutable c_ignpar : bool;
  4. mutable c_parmrk : bool;
  5. mutable c_inpck : bool;
  6. mutable c_istrip : bool;
  7. mutable c_inlcr : bool;
  8. mutable c_igncr : bool;
  9. mutable c_icrnl : bool;
  10. mutable c_ixon : bool;
  11. mutable c_ixoff : bool;
  12. mutable c_opost : bool;
  13. mutable c_obaud : int;
  14. mutable c_ibaud : int;
  15. mutable c_csize : int;
  16. mutable c_cstopb : int;
  17. mutable c_cread : bool;
  18. mutable c_parenb : bool;
  19. mutable c_parodd : bool;
  20. mutable c_hupcl : bool;
  21. mutable c_clocal : bool;
  22. mutable c_isig : bool;
  23. mutable c_icanon : bool;
  24. mutable c_noflsh : bool;
  25. mutable c_echo : bool;
  26. mutable c_echoe : bool;
  27. mutable c_echok : bool;
  28. mutable c_echonl : bool;
  29. mutable c_vintr : char;
  30. mutable c_vquit : char;
  31. mutable c_verase : char;
  32. mutable c_vkill : char;
  33. mutable c_veof : char;
  34. mutable c_veol : char;
  35. mutable c_vmin : int;
  36. mutable c_vtime : int;
  37. mutable c_vstart : char;
  38. mutable c_vstop : char;
}
val tcgetattr : file_descr -> terminal_io Lwt.t
type setattr_when = Unix.setattr_when =
  1. | TCSANOW
  2. | TCSADRAIN
  3. | TCSAFLUSH
val tcsetattr : file_descr -> setattr_when -> terminal_io -> unit Lwt.t
val tcsendbreak : file_descr -> int -> unit Lwt.t
val tcdrain : file_descr -> unit Lwt.t
type flush_queue = Unix.flush_queue =
  1. | TCIFLUSH
  2. | TCOFLUSH
  3. | TCIOFLUSH
val tcflush : file_descr -> flush_queue -> unit Lwt.t
type flow_action = Unix.flow_action =
  1. | TCOOFF
  2. | TCOON
  3. | TCIOFF
  4. | TCION
val tcflow : file_descr -> flow_action -> unit Lwt.t
exception Retry
exception Retry_read
exception Retry_write
type io_event =
  1. | Read
  2. | Write
val wrap_syscall : io_event -> file_descr -> (unit -> 'a) -> 'a Lwt.t
val check_descriptor : file_descr -> unit
val register_action : io_event -> file_descr -> (unit -> 'a) -> 'a Lwt.t
type 'a job
val execute_job : ?async_method:async_method -> job:'a job -> result:('a job -> 'b) -> free:('a job -> unit) -> 'b Lwt.t
val run_job : ?async_method:async_method -> 'a job -> 'a Lwt.t
val abort_jobs : exn -> unit
val cancel_jobs : unit -> unit
val wait_for_jobs : unit -> unit Lwt.t
val make_notification : ?once:bool -> (unit -> unit) -> int
val send_notification : int -> unit
val stop_notification : int -> unit
val call_notification : int -> unit
val set_notification : int -> (unit -> unit) -> unit
val pool_size : unit -> int
val set_pool_size : int -> unit
val thread_count : unit -> int
val thread_waiting_count : unit -> int
val get_cpu : unit -> int
val get_affinity : ?pid:int -> unit -> int list
val set_affinity : ?pid:int -> int list -> unit
val run : 'a Lwt.t -> 'a
val has_wait4 : bool
OCaml

Innovation. Community. Security.