sig
  module File_descr :
    sig
      type t = Caml.Unix.file_descr
      type hashable = t
      module Hashable : sig type t = hashable end
      val hash : hashable -> int
      module Table : Hashable.Table_sig(Hashable).S
      module Hash_set :
        sig
          type elem = hashable
          type t = elem Hash_set.t
          type sexpable = t
          val sexp_of_t : sexpable -> Sexplib.Sexp.t
          val t_of_sexp : Sexplib.Sexp.t -> sexpable
          val create : ?growth_allowed:bool -> ?size:int -> unit -> t
          val of_list : elem list -> t
        end
      module Hash_queue :
        sig
          module Key :
            sig
              type t = hashable
              val compare : t -> t -> int
              val hash : t -> int
              type sexpable = t
              val sexp_of_t : sexpable -> Sexplib.Sexp.t
              val t_of_sexp : Sexplib.Sexp.t -> sexpable
            end
          type 'a t
          type 'a container = 'a t
          val length : 'a container -> int
          val is_empty : 'a container -> bool
          val iter : 'a container -> f:('-> unit) -> unit
          val fold : 'a container -> init:'-> f:('-> '-> 'b) -> 'b
          val exists : 'a container -> f:('-> bool) -> bool
          val for_all : 'a container -> f:('-> bool) -> bool
          val find : 'a container -> f:('-> bool) -> 'a option
          val to_list : 'a container -> 'a list
          val to_array : 'a container -> 'a array
          val container : ('a, 'a container) Container.type_class
          val invariant : 'a t -> unit
          val create : unit -> 'a t
          val clear : 'a t -> unit
          val mem : 'a t -> Key.t -> bool
          val lookup : 'a t -> Key.t -> 'a option
          val lookup_exn : 'a t -> Key.t -> 'a
          val enqueue : 'a t -> Key.t -> '-> [ `Key_already_present | `Ok ]
          val enqueue_exn : 'a t -> Key.t -> '-> unit
          val keys : 'a t -> Key.t list
          val dequeue : 'a t -> 'a option
          val dequeue_exn : 'a t -> 'a
          val dequeue_with_key : 'a t -> (Key.t * 'a) option
          val dequeue_with_key_exn : 'a t -> Key.t * 'a
          val dequeue_all : 'a t -> f:('-> unit) -> unit
          val remove : 'a t -> Key.t -> [ `No_such_key | `Ok ]
          val remove_exn : 'a t -> Key.t -> unit
          val replace : 'a t -> Key.t -> '-> [ `No_such_key | `Ok ]
          val replace_exn : 'a t -> Key.t -> '-> unit
          val iteri : 'a t -> f:(key:Key.t -> data:'-> unit) -> unit
          val foldi :
            'a t -> init:'-> f:('-> key:Key.t -> data:'-> 'b) -> 'b
        end
      module Hash_heap :
        sig
          module Key :
            sig
              type t = hashable
              val compare : t -> t -> int
              val hash : t -> int
              type sexpable = t
              val sexp_of_t : sexpable -> Sexplib.Sexp.t
              val t_of_sexp : Sexplib.Sexp.t -> sexpable
            end
          type 'a t
          val create : ?min_size:int -> ('-> '-> int) -> 'a t
          val copy : 'a t -> 'a t
          val push :
            'a t -> key:Key.t -> data:'-> [ `Key_already_present | `Ok ]
          val push_exn : 'a t -> key:Key.t -> data:'-> unit
          val replace : 'a t -> key:Key.t -> data:'-> unit
          val remove : 'a t -> Key.t -> unit
          val mem : 'a t -> Key.t -> bool
          val top : 'a t -> 'a option
          val top_exn : 'a t -> 'a
          val top_with_key : 'a t -> (Key.t * 'a) option
          val top_with_key_exn : 'a t -> Key.t * 'a
          val pop_with_key : 'a t -> (Key.t * 'a) option
          val pop_with_key_exn : 'a t -> Key.t * 'a
          val pop : 'a t -> 'a option
          val pop_exn : 'a t -> 'a
          val cond_pop_with_key :
            'a t -> (key:Key.t -> data:'-> bool) -> (Key.t * 'a) option
          val cond_pop : 'a t -> ('-> bool) -> 'a option
          val find : 'a t -> Key.t -> 'a option
          val find_pop : 'a t -> Key.t -> 'a option
          val find_exn : 'a t -> Key.t -> 'a
          val find_pop_exn : 'a t -> Key.t -> 'a
          val iter : 'a t -> f:(key:Key.t -> data:'-> unit) -> unit
          val iter_vals : 'a t -> f:('-> unit) -> unit
        end
      type sexpable = t
      val t_of_sexp : Sexplib.Sexp.t -> sexpable
      val to_int : Core_unix.File_descr.t -> int
      val of_int : int -> Core_unix.File_descr.t
      val to_string : Core_unix.File_descr.t -> string
      val sexp_of_t : Core_unix.File_descr.t -> Sexplib.Sexp.t
    end
  type error =
    Unix.error =
      E2BIG
    | EACCES
    | EAGAIN
    | EBADF
    | EBUSY
    | ECHILD
    | EDEADLK
    | EDOM
    | EEXIST
    | EFAULT
    | EFBIG
    | EINTR
    | EINVAL
    | EIO
    | EISDIR
    | EMFILE
    | EMLINK
    | 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
  val sexp_of_error : Core_unix.error -> Sexplib.Sexp.t
  val error_of_sexp : Sexplib.Sexp.t -> Core_unix.error
  exception Unix_error of Core_unix.error * string * string
  external unix_error : int -> string -> string -> 'a = "unix_error_stub"
  val error_message : Core_unix.error -> string
  val handle_unix_error : ('-> 'b) -> '-> 'b
  val environment : unit -> string array
  val putenv : key:string -> data:string -> unit
  val unsetenv : string -> unit
  module Process_status :
    sig
      type t =
          [ `Exited of int | `Signaled of Signal.t | `Stopped of Signal.t ]
      val sexp_of_t : Core_unix.Process_status.t -> Sexplib.Sexp.t
      val t_of_sexp : Sexplib.Sexp.t -> Core_unix.Process_status.t
      val t_of_sexp__ : Sexplib.Sexp.t -> Core_unix.Process_status.t
      val is_ok : Core_unix.Process_status.t -> bool
      val of_unix : Caml.Unix.process_status -> Core_unix.Process_status.t
      val to_string_hum : Core_unix.Process_status.t -> string
    end
  type wait_flag = Unix.wait_flag = WNOHANG | WUNTRACED
  val execv : prog:string -> args:string array -> 'a
  val execve : prog:string -> args:string array -> env:string array -> 'a
  val execvp : prog:string -> args:string array -> 'a
  val execvpe : prog:string -> args:string array -> env:string array -> 'a
  val fork : unit -> int
  val wait : ?restart:bool -> unit -> int * Core_unix.Process_status.t
  val waitpid :
    ?restart:bool ->
    mode:Core_unix.wait_flag list -> int -> int * Core_unix.Process_status.t
  val system : string -> Core_unix.Process_status.t
  val getpid : unit -> int
  val getppid : unit -> int
  val nice : int -> int
  type file_descr = Unix.file_descr
  val stdin : Core_unix.file_descr
  val stdout : Core_unix.file_descr
  val stderr : Core_unix.file_descr
  type open_flag =
    Unix.open_flag =
      O_RDONLY
    | O_WRONLY
    | O_RDWR
    | O_NONBLOCK
    | O_APPEND
    | O_CREAT
    | O_TRUNC
    | O_EXCL
    | O_NOCTTY
    | O_DSYNC
    | O_SYNC
    | O_RSYNC
  type file_perm = int
  val sexp_of_file_perm : Core_unix.file_perm -> Sexplib.Sexp.t
  val file_perm_of_sexp : Sexplib.Sexp.t -> Core_unix.file_perm
  val openfile :
    string ->
    mode:Core_unix.open_flag list ->
    perm:Core_unix.file_perm -> Core_unix.file_descr
  val close : Core_unix.file_descr -> unit
  val read : Core_unix.file_descr -> buf:string -> pos:int -> len:int -> int
  val write : Core_unix.file_descr -> buf:string -> pos:int -> len:int -> int
  val single_write :
    Core_unix.file_descr -> buf:string -> pos:int -> len:int -> int
  val in_channel_of_descr : Core_unix.file_descr -> Pervasives.in_channel
  val out_channel_of_descr : Core_unix.file_descr -> Pervasives.out_channel
  val descr_of_in_channel : Pervasives.in_channel -> Core_unix.file_descr
  val descr_of_out_channel : Pervasives.out_channel -> Core_unix.file_descr
  type seek_command = Unix.seek_command = SEEK_SET | SEEK_CUR | SEEK_END
  val lseek :
    Core_unix.file_descr -> int64 -> mode:Core_unix.seek_command -> int64
  val truncate : string -> len:int64 -> unit
  val ftruncate : Core_unix.file_descr -> len:int64 -> unit
  type file_kind =
    Unix.file_kind =
      S_REG
    | S_DIR
    | S_CHR
    | S_BLK
    | S_LNK
    | S_FIFO
    | S_SOCK
  val sexp_of_file_kind : Core_unix.file_kind -> Sexplib.Sexp.t
  val file_kind_of_sexp : Sexplib.Sexp.t -> Core_unix.file_kind
  type stats =
    Unix.LargeFile.stats = {
    st_dev : int;
    st_ino : int;
    st_kind : Core_unix.file_kind;
    st_perm : Core_unix.file_perm;
    st_nlink : int;
    st_uid : int;
    st_gid : int;
    st_rdev : int;
    st_size : int64;
    st_atime : float;
    st_mtime : float;
    st_ctime : float;
  }
  val sexp_of_stats : Core_unix.stats -> Sexplib.Sexp.t
  val stats_of_sexp : Sexplib.Sexp.t -> Core_unix.stats
  val stat : string -> Core_unix.stats
  val lstat : string -> Core_unix.stats
  val fstat : Core_unix.file_descr -> Core_unix.stats
  module Native_file :
    sig
      type stats =
        Unix.stats = {
        st_dev : int;
        st_ino : int;
        st_kind : Core_unix.file_kind;
        st_perm : Core_unix.file_perm;
        st_nlink : int;
        st_uid : int;
        st_gid : int;
        st_rdev : int;
        st_size : int;
        st_atime : float;
        st_mtime : float;
        st_ctime : float;
      }
      val stat : string -> Core_unix.Native_file.stats
      val lstat : string -> Core_unix.Native_file.stats
      val fstat : Core_unix.file_descr -> Core_unix.Native_file.stats
      val lseek :
        Core_unix.file_descr -> int -> mode:Core_unix.seek_command -> int
      val truncate : string -> len:int -> unit
      val ftruncate : Core_unix.file_descr -> len:int -> unit
    end
  type lock_command =
    Unix.lock_command =
      F_ULOCK
    | F_LOCK
    | F_TLOCK
    | F_TEST
    | F_RLOCK
    | F_TRLOCK
  val lockf :
    Core_unix.file_descr ->
    mode:Core_unix.lock_command -> len:Core_int64.t -> unit
  module Flock_command : sig type t = LOCK_SH | LOCK_EX | LOCK_UN end
  val flock : Core_unix.file_descr -> Core_unix.Flock_command.t -> bool
  val isatty : Core_unix.file_descr -> bool
  val unlink : string -> unit
  val rename : src:string -> dst:string -> unit
  val link : ?force:bool -> target:string -> link_name:string -> unit -> unit
  val chmod : string -> perm:Core_unix.file_perm -> unit
  val fchmod : Core_unix.file_descr -> perm:Core_unix.file_perm -> unit
  val chown : string -> uid:int -> gid:int -> unit
  val fchown : Core_unix.file_descr -> uid:int -> gid:int -> unit
  val umask : int -> int
  type access_permission = Unix.access_permission = R_OK | W_OK | X_OK | F_OK
  val access : string -> perm:Core_unix.access_permission list -> unit
  val dup : Core_unix.file_descr -> Core_unix.file_descr
  val dup2 : src:Core_unix.file_descr -> dst:Core_unix.file_descr -> unit
  val set_nonblock : Core_unix.file_descr -> unit
  val clear_nonblock : Core_unix.file_descr -> unit
  val set_close_on_exec : Core_unix.file_descr -> unit
  val clear_close_on_exec : Core_unix.file_descr -> unit
  val mkdir : string -> perm:Core_unix.file_perm -> unit
  val rmdir : string -> unit
  val chdir : string -> unit
  val getcwd : unit -> string
  val chroot : string -> unit
  type dir_handle = Unix.dir_handle
  val opendir : string -> Core_unix.dir_handle
  val readdir : Core_unix.dir_handle -> string
  val rewinddir : Core_unix.dir_handle -> unit
  val closedir : Core_unix.dir_handle -> unit
  val pipe : unit -> Core_unix.file_descr * Core_unix.file_descr
  val mkfifo : string -> perm:Core_unix.file_perm -> unit
  module Process_info :
    sig
      type t = {
        pid : int;
        stdin : Core_unix.file_descr;
        stdout : Core_unix.file_descr;
        stderr : Core_unix.file_descr;
      }
    end
  val create_process :
    prog:string -> args:string list -> Core_unix.Process_info.t
  val create_process_env :
    prog:string ->
    args:string list ->
    env:[ `Extend of (string * string) list
        | `Replace of (string * string) list ] ->
    Core_unix.Process_info.t
  val open_process_in : string -> Pervasives.in_channel
  val open_process_out : string -> Pervasives.out_channel
  val open_process : string -> Pervasives.in_channel * Pervasives.out_channel
  module Process_channels :
    sig
      type t = {
        stdin : Pervasives.out_channel;
        stdout : Pervasives.in_channel;
        stderr : Pervasives.in_channel;
      }
    end
  val open_process_full :
    string -> env:string array -> Core_unix.Process_channels.t
  val close_process_in : Pervasives.in_channel -> Core_unix.Process_status.t
  val close_process_out :
    Pervasives.out_channel -> Core_unix.Process_status.t
  val close_process :
    Pervasives.in_channel * Pervasives.out_channel ->
    Core_unix.Process_status.t
  val close_process_full :
    Core_unix.Process_channels.t -> Core_unix.Process_status.t
  val symlink : src:string -> dst:string -> unit
  val readlink : string -> string
  module Select_fds :
    sig
      type t = {
        read : Core_unix.file_descr list;
        write : Core_unix.file_descr list;
        except : Core_unix.file_descr list;
      }
      val empty : Core_unix.Select_fds.t
    end
  val select :
    ?restart:bool ->
    read:Core_unix.file_descr list ->
    write:Core_unix.file_descr list ->
    except:Core_unix.file_descr list ->
    timeout:float -> unit -> Core_unix.Select_fds.t
  val pause : unit -> unit
  type process_times =
    Unix.process_times = {
    tms_utime : float;
    tms_stime : float;
    tms_cutime : float;
    tms_cstime : float;
  }
  type tm =
    Unix.tm = {
    tm_sec : int;
    tm_min : int;
    tm_hour : int;
    tm_mday : int;
    tm_mon : int;
    tm_year : int;
    tm_wday : int;
    tm_yday : int;
    tm_isdst : bool;
  }
  val sexp_of_tm : Core_unix.tm -> Sexplib.Sexp.t
  val tm_of_sexp : Sexplib.Sexp.t -> Core_unix.tm
  val time : unit -> float
  val gettimeofday : unit -> float
  val gmtime : float -> Core_unix.tm
  val timegm : Core_unix.tm -> float
  val localtime : float -> Core_unix.tm
  val mktime : Core_unix.tm -> float * Core_unix.tm
  val strftime : Core_unix.tm -> string -> string
  val alarm : int -> int
  val sleep : int -> unit
  val nanosleep : float -> float
  val times : unit -> Core_unix.process_times
  val utimes : string -> access:float -> modif:float -> unit
  type interval_timer =
    Unix.interval_timer =
      ITIMER_REAL
    | ITIMER_VIRTUAL
    | ITIMER_PROF
  type interval_timer_status =
    Unix.interval_timer_status = {
    it_interval : float;
    it_value : float;
  }
  val getitimer : Core_unix.interval_timer -> Core_unix.interval_timer_status
  val setitimer :
    Core_unix.interval_timer ->
    Core_unix.interval_timer_status -> Core_unix.interval_timer_status
  val getuid : unit -> int
  val geteuid : unit -> int
  val setuid : int -> unit
  val getgid : unit -> int
  val getegid : unit -> int
  val setgid : int -> unit
  val getgroups : unit -> int array
  module Passwd :
    sig
      type t = {
        name : string;
        passwd : string;
        uid : int;
        gid : int;
        gecos : string;
        dir : string;
        shell : string;
      }
      val getbyname : string -> Core_unix.Passwd.t option
      val getbyname_exn : string -> Core_unix.Passwd.t
      val getbyuid : int -> Core_unix.Passwd.t option
      val getbyuid_exn : int -> Core_unix.Passwd.t
      val setpwent : unit -> unit
      val endpwent : unit -> unit
      val getpwent : unit -> Core_unix.Passwd.t option
      val getpwent_exn : unit -> Core_unix.Passwd.t
    end
  module Group :
    sig
      type t = {
        name : string;
        passwd : string;
        gid : int;
        mem : string array;
      }
      val sexp_of_t : Core_unix.Group.t -> Sexplib.Sexp.t
      val getbyname : string -> Core_unix.Group.t option
      val getbyname_exn : string -> Core_unix.Group.t
      val getbygid : int -> Core_unix.Group.t option
      val getbygid_exn : int -> Core_unix.Group.t
    end
  val getlogin : unit -> string
  type inet_addr = Unix.inet_addr
  val bin_size_inet_addr : Core_unix.inet_addr Bin_prot.Size.sizer
  val bin_write_inet_addr : Core_unix.inet_addr Bin_prot.Write_ml.writer
  val bin_write_inet_addr_ :
    Core_unix.inet_addr Bin_prot.Unsafe_write_c.writer
  val bin_writer_inet_addr : Core_unix.inet_addr Bin_prot.Type_class.writer
  val bin_read_inet_addr : Core_unix.inet_addr Bin_prot.Read_ml.reader
  val bin_read_inet_addr_ : Core_unix.inet_addr Bin_prot.Unsafe_read_c.reader
  val bin_read_inet_addr__ :
    (int -> Core_unix.inet_addr) Bin_prot.Unsafe_read_c.reader
  val bin_reader_inet_addr : Core_unix.inet_addr Bin_prot.Type_class.reader
  val bin_inet_addr : Core_unix.inet_addr Bin_prot.Type_class.t
  val sexp_of_inet_addr : Core_unix.inet_addr -> Sexplib.Sexp.t
  val inet_addr_of_sexp : Sexplib.Sexp.t -> Core_unix.inet_addr
  val inet_addr_of_string : string -> Core_unix.inet_addr
  val string_of_inet_addr : Core_unix.inet_addr -> string
  val inet_addr_any : Core_unix.inet_addr
  val inet_addr_loopback : Core_unix.inet_addr
  val inet6_addr_any : Core_unix.inet_addr
  val inet6_addr_loopback : Core_unix.inet_addr
  type socket_domain = Unix.socket_domain = PF_UNIX | PF_INET | PF_INET6
  val bin_size_socket_domain : Core_unix.socket_domain Bin_prot.Size.sizer
  val bin_write_socket_domain :
    Core_unix.socket_domain Bin_prot.Write_ml.writer
  val bin_write_socket_domain_ :
    Core_unix.socket_domain Bin_prot.Unsafe_write_c.writer
  val bin_writer_socket_domain :
    Core_unix.socket_domain Bin_prot.Type_class.writer
  val bin_read_socket_domain :
    Core_unix.socket_domain Bin_prot.Read_ml.reader
  val bin_read_socket_domain_ :
    Core_unix.socket_domain Bin_prot.Unsafe_read_c.reader
  val bin_read_socket_domain__ :
    (int -> Core_unix.socket_domain) Bin_prot.Unsafe_read_c.reader
  val bin_reader_socket_domain :
    Core_unix.socket_domain Bin_prot.Type_class.reader
  val bin_socket_domain : Core_unix.socket_domain Bin_prot.Type_class.t
  val sexp_of_socket_domain : Core_unix.socket_domain -> Sexplib.Sexp.t
  val socket_domain_of_sexp : Sexplib.Sexp.t -> Core_unix.socket_domain
  type socket_type =
    Unix.socket_type =
      SOCK_STREAM
    | SOCK_DGRAM
    | SOCK_RAW
    | SOCK_SEQPACKET
  val bin_size_socket_type : Core_unix.socket_type Bin_prot.Size.sizer
  val bin_write_socket_type : Core_unix.socket_type Bin_prot.Write_ml.writer
  val bin_write_socket_type_ :
    Core_unix.socket_type Bin_prot.Unsafe_write_c.writer
  val bin_writer_socket_type :
    Core_unix.socket_type Bin_prot.Type_class.writer
  val bin_read_socket_type : Core_unix.socket_type Bin_prot.Read_ml.reader
  val bin_read_socket_type_ :
    Core_unix.socket_type Bin_prot.Unsafe_read_c.reader
  val bin_read_socket_type__ :
    (int -> Core_unix.socket_type) Bin_prot.Unsafe_read_c.reader
  val bin_reader_socket_type :
    Core_unix.socket_type Bin_prot.Type_class.reader
  val bin_socket_type : Core_unix.socket_type Bin_prot.Type_class.t
  val sexp_of_socket_type : Core_unix.socket_type -> Sexplib.Sexp.t
  val socket_type_of_sexp : Sexplib.Sexp.t -> Core_unix.socket_type
  type sockaddr =
    Unix.sockaddr =
      ADDR_UNIX of string
    | ADDR_INET of Core_unix.inet_addr * int
  val bin_size_sockaddr : Core_unix.sockaddr Bin_prot.Size.sizer
  val bin_write_sockaddr : Core_unix.sockaddr Bin_prot.Write_ml.writer
  val bin_write_sockaddr_ : Core_unix.sockaddr Bin_prot.Unsafe_write_c.writer
  val bin_writer_sockaddr : Core_unix.sockaddr Bin_prot.Type_class.writer
  val bin_read_sockaddr : Core_unix.sockaddr Bin_prot.Read_ml.reader
  val bin_read_sockaddr_ : Core_unix.sockaddr Bin_prot.Unsafe_read_c.reader
  val bin_read_sockaddr__ :
    (int -> Core_unix.sockaddr) Bin_prot.Unsafe_read_c.reader
  val bin_reader_sockaddr : Core_unix.sockaddr Bin_prot.Type_class.reader
  val bin_sockaddr : Core_unix.sockaddr Bin_prot.Type_class.t
  val sexp_of_sockaddr : Core_unix.sockaddr -> Sexplib.Sexp.t
  val sockaddr_of_sexp : Sexplib.Sexp.t -> Core_unix.sockaddr
  val domain_of_sockaddr : Core_unix.sockaddr -> Core_unix.socket_domain
  val socket :
    domain:Core_unix.socket_domain ->
    kind:Core_unix.socket_type -> protocol:int -> Core_unix.file_descr
  val socketpair :
    domain:Core_unix.socket_domain ->
    kind:Core_unix.socket_type ->
    protocol:int -> Core_unix.file_descr * Core_unix.file_descr
  val accept :
    Core_unix.file_descr -> Core_unix.file_descr * Core_unix.sockaddr
  val bind : Core_unix.file_descr -> addr:Core_unix.sockaddr -> unit
  val connect : Core_unix.file_descr -> addr:Core_unix.sockaddr -> unit
  val listen : Core_unix.file_descr -> max:int -> unit
  type shutdown_command =
    Unix.shutdown_command =
      SHUTDOWN_RECEIVE
    | SHUTDOWN_SEND
    | SHUTDOWN_ALL
  val shutdown :
    Core_unix.file_descr -> mode:Core_unix.shutdown_command -> unit
  val getsockname : Core_unix.file_descr -> Core_unix.sockaddr
  val getpeername : Core_unix.file_descr -> Core_unix.sockaddr
  type msg_flag = Unix.msg_flag = MSG_OOB | MSG_DONTROUTE | MSG_PEEK
  val recv :
    Core_unix.file_descr ->
    buf:string -> pos:int -> len:int -> mode:Core_unix.msg_flag list -> int
  val recvfrom :
    Core_unix.file_descr ->
    buf:string ->
    pos:int ->
    len:int -> mode:Core_unix.msg_flag list -> int * Core_unix.sockaddr
  val send :
    Core_unix.file_descr ->
    buf:string -> pos:int -> len:int -> mode:Core_unix.msg_flag list -> int
  val sendto :
    Core_unix.file_descr ->
    buf:string ->
    pos:int ->
    len:int -> mode:Core_unix.msg_flag list -> addr:Core_unix.sockaddr -> int
  type socket_bool_option =
      SO_DEBUG
    | SO_BROADCAST
    | SO_REUSEADDR
    | SO_KEEPALIVE
    | SO_DONTROUTE
    | SO_OOBINLINE
    | SO_ACCEPTCONN
    | TCP_NODELAY
    | IPV6_ONLY
  type socket_int_option =
      SO_SNDBUF
    | SO_RCVBUF
    | SO_ERROR
    | SO_TYPE
    | SO_RCVLOWAT
    | SO_SNDLOWAT
  type socket_optint_option = SO_LINGER
  type socket_float_option = SO_RCVTIMEO | SO_SNDTIMEO
  val getsockopt :
    Core_unix.file_descr -> Core_unix.socket_bool_option -> bool
  val setsockopt :
    Core_unix.file_descr -> Core_unix.socket_bool_option -> bool -> unit
  val getsockopt_int :
    Core_unix.file_descr -> Core_unix.socket_int_option -> int
  val setsockopt_int :
    Core_unix.file_descr -> Core_unix.socket_int_option -> int -> unit
  val getsockopt_optint :
    Core_unix.file_descr -> Core_unix.socket_optint_option -> int option
  val setsockopt_optint :
    Core_unix.file_descr ->
    Core_unix.socket_optint_option -> int option -> unit
  val getsockopt_float :
    Core_unix.file_descr -> Core_unix.socket_float_option -> float
  val setsockopt_float :
    Core_unix.file_descr -> Core_unix.socket_float_option -> float -> unit
  val open_connection :
    Core_unix.sockaddr -> Pervasives.in_channel * Pervasives.out_channel
  val shutdown_connection : Pervasives.in_channel -> unit
  val establish_server :
    (Pervasives.in_channel -> Pervasives.out_channel -> unit) ->
    addr:Core_unix.sockaddr -> unit
  val gethostname : unit -> string
  module Host :
    sig
      type t = {
        name : string;
        aliases : string array;
        addrtype : Core_unix.socket_domain;
        addrs : Core_unix.inet_addr array;
      }
      val getbyname : string -> Core_unix.Host.t option
      val getbyname_exn : string -> Core_unix.Host.t
      val getbyaddr : Core_unix.inet_addr -> Core_unix.Host.t option
      val getbyaddr_exn : Core_unix.inet_addr -> Core_unix.Host.t
    end
  module Protocol :
    sig
      type t = { name : string; aliases : string array; proto : int; }
      val getbyname : string -> Core_unix.Protocol.t option
      val getbyname_exn : string -> Core_unix.Protocol.t
      val getbynumber : int -> Core_unix.Protocol.t option
      val getbynumber_exn : int -> Core_unix.Protocol.t
    end
  module Service :
    sig
      type t = {
        name : string;
        aliases : string array;
        port : int;
        proto : string;
      }
      val getbyname : string -> protocol:string -> Core_unix.Service.t option
      val getbyname_exn : string -> protocol:string -> Core_unix.Service.t
      val getbyport : int -> protocol:string -> Core_unix.Service.t option
      val getbyport_exn : int -> protocol:string -> Core_unix.Service.t
    end
  type addr_info = {
    ai_family : Core_unix.socket_domain;
    ai_socktype : Core_unix.socket_type;
    ai_protocol : int;
    ai_addr : Core_unix.sockaddr;
    ai_canonname : string;
  }
  type getaddrinfo_option =
      AI_FAMILY of Core_unix.socket_domain
    | AI_SOCKTYPE of Core_unix.socket_type
    | AI_PROTOCOL of int
    | AI_NUMERICHOST
    | AI_CANONNAME
    | AI_PASSIVE
  val getaddrinfo :
    string ->
    string -> Core_unix.getaddrinfo_option list -> Core_unix.addr_info list
  type name_info = { ni_hostname : string; ni_service : string; }
  type getnameinfo_option =
      NI_NOFQDN
    | NI_NUMERICHOST
    | NI_NAMEREQD
    | NI_NUMERICSERV
    | NI_DGRAM
  val getnameinfo :
    Core_unix.sockaddr ->
    Core_unix.getnameinfo_option list -> Core_unix.name_info
  val get_terminal_size : unit -> int * int
  module Terminal_io :
    sig
      type t =
        Unix.terminal_io = {
        mutable c_ignbrk : bool;
        mutable c_brkint : bool;
        mutable c_ignpar : bool;
        mutable c_parmrk : bool;
        mutable c_inpck : bool;
        mutable c_istrip : bool;
        mutable c_inlcr : bool;
        mutable c_igncr : bool;
        mutable c_icrnl : bool;
        mutable c_ixon : bool;
        mutable c_ixoff : bool;
        mutable c_opost : bool;
        mutable c_obaud : int;
        mutable c_ibaud : int;
        mutable c_csize : int;
        mutable c_cstopb : int;
        mutable c_cread : bool;
        mutable c_parenb : bool;
        mutable c_parodd : bool;
        mutable c_hupcl : bool;
        mutable c_clocal : bool;
        mutable c_isig : bool;
        mutable c_icanon : bool;
        mutable c_noflsh : bool;
        mutable c_echo : bool;
        mutable c_echoe : bool;
        mutable c_echok : bool;
        mutable c_echonl : bool;
        mutable c_vintr : char;
        mutable c_vquit : char;
        mutable c_verase : char;
        mutable c_vkill : char;
        mutable c_veof : char;
        mutable c_veol : char;
        mutable c_vmin : int;
        mutable c_vtime : int;
        mutable c_vstart : char;
        mutable c_vstop : char;
      }
      val sexp_of_t : t -> Sexplib.Sexp.t
      type setattr_when = Unix.setattr_when = TCSANOW | TCSADRAIN | TCSAFLUSH
      val sexp_of_setattr_when : setattr_when -> Sexplib.Sexp.t
      val tcgetattr : Core_unix.file_descr -> t
      val tcsetattr : Core_unix.file_descr -> mode:setattr_when -> t -> unit
      val tcsendbreak : Core_unix.file_descr -> duration:int -> unit
      val tcdrain : Core_unix.file_descr -> unit
      type flush_queue = Unix.flush_queue = TCIFLUSH | TCOFLUSH | TCIOFLUSH
      val tcflush :
        Core_unix.file_descr ->
        mode:Core_unix.Terminal_io.flush_queue -> unit
      type flow_action = Unix.flow_action = TCOOFF | TCOON | TCIOFF | TCION
      val tcflow :
        Core_unix.file_descr ->
        mode:Core_unix.Terminal_io.flow_action -> unit
      val setsid : unit -> int
    end
  val get_inet_addr : string -> Core_unix.inet_addr
  val get_sockaddr : string -> int -> Core_unix.sockaddr
  val set_in_channel_timeout : Pervasives.in_channel -> float -> unit
  val set_out_channel_timeout : Pervasives.out_channel -> float -> unit
  external exit_immediately : int -> 'a = "caml_sys_exit"
  val mknod :
    ?file_kind:Core_unix.file_kind ->
    ?perm:int -> ?major:int -> ?minor:int -> string -> unit
  module IOVec :
    sig
      type 'a t = private { buf : 'a; pos : int; len : int; }
      type 'a kind
      type bigstring =
          (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout)
          Bigarray.Array1.t
      val string_kind : string Core_unix.IOVec.kind
      val bigstring_kind : Core_unix.IOVec.bigstring Core_unix.IOVec.kind
      val empty : 'Core_unix.IOVec.kind -> 'Core_unix.IOVec.t
      val of_string :
        ?pos:int -> ?len:int -> string -> string Core_unix.IOVec.t
      val of_bigstring :
        ?pos:int ->
        ?len:int ->
        Core_unix.IOVec.bigstring ->
        Core_unix.IOVec.bigstring Core_unix.IOVec.t
      val drop : 'Core_unix.IOVec.t -> int -> 'Core_unix.IOVec.t
      val max_iovecs : int
    end
  external int_of_file_descr : Core_unix.file_descr -> int = "%identity"
  external file_descr_of_int : int -> Core_unix.file_descr = "%identity"
  external dirfd : Core_unix.dir_handle -> Core_unix.file_descr
    = "unix_dirfd"
  external sync : unit -> unit = "unix_sync"
  external fsync : Core_unix.file_descr -> unit = "unix_fsync"
  external fdatasync : Core_unix.file_descr -> unit = "unix_fdatasync"
  external readdir_ino : Core_unix.dir_handle -> string * nativeint
    = "unix_readdir_ino_stub"
  val read_assume_fd_is_nonblocking :
    Core_unix.file_descr -> ?pos:int -> ?len:int -> string -> int
  val write_assume_fd_is_nonblocking :
    Core_unix.file_descr -> ?pos:int -> ?len:int -> string -> int
  val writev_assume_fd_is_nonblocking :
    Core_unix.file_descr ->
    ?count:int -> string Core_unix.IOVec.t array -> int
  val writev :
    Core_unix.file_descr ->
    ?count:int -> string Core_unix.IOVec.t array -> int
  external pselect :
    Core_unix.file_descr list ->
    Core_unix.file_descr list ->
    Core_unix.file_descr list ->
    float ->
    int list ->
    Core_unix.file_descr list * Core_unix.file_descr list *
    Core_unix.file_descr list = "unix_pselect_stub"
  module RLimit :
    sig
      type limit = Limit of int64 | Infinity
      val sexp_of_limit : Core_unix.RLimit.limit -> Sexplib.Sexp.t
      val limit_of_sexp : Sexplib.Sexp.t -> Core_unix.RLimit.limit
      type t = {
        cur : Core_unix.RLimit.limit;
        max : Core_unix.RLimit.limit;
      }
      val sexp_of_t : Core_unix.RLimit.t -> Sexplib.Sexp.t
      val t_of_sexp : Sexplib.Sexp.t -> Core_unix.RLimit.t
      type resource =
          [ `Core_file_size
          | `Cpu_seconds
          | `Data_segment
          | `File_size
          | `Num_file_descriptors
          | `Stack
          | `Virtual_memory ]
      val sexp_of_resource : Core_unix.RLimit.resource -> Sexplib.Sexp.t
      val resource_of_sexp : Sexplib.Sexp.t -> Core_unix.RLimit.resource
      val resource_of_sexp__ : Sexplib.Sexp.t -> Core_unix.RLimit.resource
      val get : Core_unix.RLimit.resource -> Core_unix.RLimit.t
      val set : Core_unix.RLimit.resource -> Core_unix.RLimit.t -> unit
    end
  module Resource_usage :
    sig
      type who = SELF | CHILDREN
      type t
      val get : Core_unix.Resource_usage.who -> Core_unix.Resource_usage.t
      val utime : Core_unix.Resource_usage.t -> float
      val stime : Core_unix.Resource_usage.t -> float
      val maxrss : Core_unix.Resource_usage.t -> int64
      val ixrss : Core_unix.Resource_usage.t -> int64
      val idrss : Core_unix.Resource_usage.t -> int64
      val isrss : Core_unix.Resource_usage.t -> int64
      val minflt : Core_unix.Resource_usage.t -> int64
      val majflt : Core_unix.Resource_usage.t -> int64
      val nswap : Core_unix.Resource_usage.t -> int64
      val inblock : Core_unix.Resource_usage.t -> int64
      val oublock : Core_unix.Resource_usage.t -> int64
      val msgsnd : Core_unix.Resource_usage.t -> int64
      val msgrcv : Core_unix.Resource_usage.t -> int64
      val nsignals : Core_unix.Resource_usage.t -> int64
      val nvcsw : Core_unix.Resource_usage.t -> int64
      val nivcsw : Core_unix.Resource_usage.t -> int64
      val add :
        Core_unix.Resource_usage.t ->
        Core_unix.Resource_usage.t -> Core_unix.Resource_usage.t
    end
  type sysconf =
      ARG_MAX
    | CHILD_MAX
    | HOST_NAME_MAX
    | LOGIN_NAME_MAX
    | OPEN_MAX
    | PAGESIZE
    | RE_DUP_MAX
    | STREAM_MAX
    | SYMLOOP_MAX
    | TTY_NAME_MAX
    | TZNAME_MAX
    | POSIX_VERSION
    | PHYS_PAGES
    | AVPHYS_PAGES
    | IOV_MAX
  external sysconf : Core_unix.sysconf -> int64 = "unix_sysconf"
  val mkstemp : string -> string * Unix.file_descr
  val mkdtemp : string -> string
  external abort : unit -> 'a = "unix_abort" "noalloc"
  external initgroups : string -> int -> unit = "unix_initgroups"
  val fnmatch :
    ?flags:[ `Casefold
           | `File_name
           | `Leading_dir
           | `No_escape
           | `Pathname
           | `Period ] list ->
    pat:string -> string -> bool
  val wordexp :
    ?flags:[ `No_cmd | `Show_err | `Undef ] list -> string -> string array
  module Utsname :
    sig
      type t
      val sysname : Core_unix.Utsname.t -> string
      val nodename : Core_unix.Utsname.t -> string
      val release : Core_unix.Utsname.t -> string
      val version : Core_unix.Utsname.t -> string
      val machine : Core_unix.Utsname.t -> string
    end
  val uname : unit -> Core_unix.Utsname.t
  external if_indextoname : int -> string = "unix_if_indextoname"
  external mcast_join :
    ?ifname:string -> Core_unix.file_descr -> Core_unix.sockaddr -> unit
    = "unix_mcast_join"
  external mcast_leave :
    ?ifname:string -> Core_unix.file_descr -> Core_unix.sockaddr -> unit
    = "unix_mcast_leave"
  module Scheduler :
    sig
      module Policy :
        sig
          type t = [ `Fifo | `Other | `Round_robin ]
          val sexp_of_t : Core_unix.Scheduler.Policy.t -> Sexplib.Sexp.t
          val t_of_sexp : Sexplib.Sexp.t -> Core_unix.Scheduler.Policy.t
          val t_of_sexp__ : Sexplib.Sexp.t -> Core_unix.Scheduler.Policy.t
        end
      val set :
        pid:int ->
        policy:Core_unix.Scheduler.Policy.t -> priority:int -> unit
    end
  module Priority : sig external nice : int -> int = "unix_nice" end
  val get_num_open_fds : unit -> int
  module Mman :
    sig
      module Mcl_flags :
        sig
          type t = Current | Future
          val sexp_of_t : Core_unix.Mman.Mcl_flags.t -> Sexplib.Sexp.t
          val t_of_sexp : Sexplib.Sexp.t -> Core_unix.Mman.Mcl_flags.t
        end
      val mlockall : Core_unix.Mman.Mcl_flags.t list -> unit
      val munlockall : unit -> unit
    end
end