ysulsky avatar ysulsky committed 44d0b49

auto export

Comments (0)

Files changed (32)

 mycaml$
 \.DS_Store$
 tmtags$
+\.rnc$
 
 ^\.git/.*$
 ^\.transdeps/.*$

base/async/extra/lib/rpc.ml

 
   val close : t -> unit
   val closed : t -> unit Deferred.t
+  val already_closed : t -> bool
   val bytes_to_write : t -> int
 
   val with_close :

base/async/extra/lib/rpc.mli

 
   val close : t -> unit
   val closed : t -> unit Deferred.t
+  val already_closed : t -> bool
   val bytes_to_write : t -> int
 
 

base/async/extra/lib/tcp.ml

    Writer.create ?buffer_age_limit fd)
 ;;
 
-exception Connection_attempt_aborted of string * int with sexp
+exception Connection_attempt_aborted of string with sexp
 
-let connect_sock ?(interrupt=Clock.after (sec 10.)) ~host ~port () =
+let connect_sock_gen ?(interrupt=Clock.after (sec 10.)) ~sock_type ~sock_addr () =
   Deferred.create (fun result ->
-    Unix.Inet_addr.of_string_or_getbyname host
-    >>> fun inet_addr ->
-    let addr = Socket.Address.inet inet_addr ~port in
-    let s = create_socket Socket.Type.tcp in
+    let s = create_socket sock_type in
     close_sock_on_error s (fun () ->
-      Socket.connect_interruptible s addr ~interrupt)
+      Socket.connect_interruptible s sock_addr ~interrupt)
     >>> function
-      | `Ok s -> Ivar.fill result s
-      | `Interrupted ->
-        whenever (Unix.close (Socket.fd s));
-        raise (Connection_attempt_aborted (host, port)))
+    | `Ok s -> Ivar.fill result s
+    | `Interrupted ->
+      whenever (Unix.close (Socket.fd s));
+      raise (Connection_attempt_aborted (Socket.Address.to_string sock_addr)))
+;;
+
+let connect_sock ?interrupt ~host ~port () =
+  Unix.Inet_addr.of_string_or_getbyname host >>= fun inet_addr ->
+  let sock_addr = Socket.Address.inet inet_addr ~port in
+  connect_sock_gen
+    ?interrupt
+    ~sock_type:Socket.Type.tcp
+    ~sock_addr ()
+;;
+
+let connect_sock_unix ?interrupt ~file () =
+  connect_sock_gen
+    ?interrupt
+    ~sock_type:Socket.Type.unix
+    ~sock_addr:(Socket.Address.unix file) ()
 ;;
 
 let close_connection r w =
   reader_writer_of_sock ?max_buffer_age ?reader_buffer_size s
 ;;
 
+let connect_unix ?max_buffer_age ?interrupt ?reader_buffer_size ~file () =
+  connect_sock_unix ?interrupt ~file ()
+  >>| fun s ->
+  reader_writer_of_sock ?max_buffer_age ?reader_buffer_size s
+;;
+
 let collect_errors writer f =
   let monitor = Writer.monitor writer in
   ignore (Monitor.errors monitor); (* don't propagate errors up, we handle them here *)
 
 exception Tcp_server_negative_max_connections of int with sexp
 
-let serve_gen ?(max_connections=10_000) ?max_pending_connections ?max_buffer_age 
+let serve_gen ?(max_connections=10_000) ?max_pending_connections ?max_buffer_age
     ~sock_type
     ~sock_addr
     ~on_handler_error handler =
 ;;
 
 let serve ?max_connections ?max_pending_connections ?max_buffer_age ~port
-    ~on_handler_error handler = 
+    ~on_handler_error handler =
   serve_gen ?max_connections ?max_pending_connections ?max_buffer_age
     ~sock_type:Socket.Type.tcp
     ~sock_addr:(Socket.Address.inet_addr_any ~port)
     handler
 
 let serve_unix ?max_connections ?max_pending_connections ?max_buffer_age ~file
-    ~on_handler_error handler = 
+    ~on_handler_error handler =
   serve_gen ?max_connections ?max_pending_connections ?max_buffer_age
     ~sock_type:Socket.Type.unix
     ~sock_addr:(Socket.Address.unix file)
     handler
 
 let connect_sock ~host ~port = connect_sock ~host ~port ()
+let connect_sock_unix ~file = connect_sock_unix ~file ()
 ;;

base/async/extra/lib/tcp.mli

 val connect_sock
   : host:string -> port:int -> ([ `Active ], Socket.inet) Socket.t Deferred.t
 
+val connect_sock_unix
+  : file:string -> ([ `Active ], Socket.unix) Socket.t Deferred.t
+
 (** [connect ~host ~port] is a convenience wrapper around [connect_sock] that returns a
     reader and writer on the socket.  The reader and writer share a file descriptor, and
     so closing one will affect the other.  In particular, closing the reader before
   -> unit
   -> (Reader.t * Writer.t) Deferred.t
 
+val connect_unix
+  :  ?max_buffer_age:Time.Span.t
+  -> ?interrupt:unit Deferred.t
+  -> ?reader_buffer_size:int
+  -> file:string
+  -> unit
+  -> (Reader.t * Writer.t) Deferred.t
+
 (** [serve ~port handler] starts a server on the specified port.  The return
     value becomes determined once the socket is ready to accept connections.
     [serve] calls [handler (address, reader, writer)] for each client that

base/async/lib_test/test_runner.ml

 open OUnit;;
 
 let () =
-  Async_scheduler.Inline_tests.run ();
   Async_extra.Inline_tests.run ()

base/async/scheduler/lib/async_unix.ml

 
 let fsync fd = Fd.syscall_in_thread_exn fd Unix.fsync
 
-let fdatasync =
-  Or_error.map Unix.fdatasync ~f:(fun fdatasync fd ->
-    Fd.syscall_in_thread_exn fd fdatasync)
+let fdatasync fd = Fd.syscall_in_thread_exn fd Unix.fdatasync
 ;;
 
 let sync () = syscall_exn Unix.sync

base/async/scheduler/lib/async_unix.mli

 
 val fsync : Fd.t -> unit Deferred.t
 
-val fdatasync : (Fd.t -> unit Deferred.t) Or_error.t
+val fdatasync : Fd.t -> unit Deferred.t
 
 val sync : unit -> unit Deferred.t
 

base/async/scheduler/lib/raw_scheduler.ml

        * to process a toplevel unhandled exception *)
     select_interruptor : Interruptor.t;
 
-    signal_handlers : Signal_handlers.t;
+    signal_handlers : Raw_signal_handlers.t;
 
     (* Finalizers are very much like signals; they can come at any time and in any
        thread.  So, when an OCaml finalizer fires, we stick a closure to do the work
   let finalizer_jobs = Thread_safe_queue.create () in
   let select_interruptor = Interruptor.create fd_by_descr in
   let signal_handlers =
-    Signal_handlers.create
+    Raw_signal_handlers.create
       ~thread_safe_notify_signal_delivered:(fun () ->
         Interruptor.thread_safe_interrupt select_interruptor)
   in
   in
   let handle_delivered_signals () =
     if debug then Debug.log_string "handling delivered signals";
-    Signal_handlers.handle_delivered t.signal_handlers;
+    Raw_signal_handlers.handle_delivered t.signal_handlers;
   in
   let compute_timeout maybe_jobs_remain =
     if debug then Debug.log_string "compute_timeout";
   end else begin
     (* We handle [Signal.pipe] so that write() calls on a closed pipe/socket get EPIPE but
        the process doesn't die due to an unhandled SIGPIPE. *)
-    Signal_handlers.handle_signal t.signal_handlers Signal.pipe;
+    Raw_signal_handlers.handle_signal t.signal_handlers Signal.pipe;
     t.go_has_been_called <- true;
     select_loop t;
   end

base/async/scheduler/lib/raw_signal_handlers.ml

+open Core.Std
+open Import
+
+module Signal = Core.Std.Signal
+
+module Handler = struct
+  type t = Signal.t -> unit
+end
+
+module Handlers = struct
+  type t = { bag : Handler.t sexp_opaque Bag.t } with sexp_of
+
+  let create () = { bag = Bag.create () }
+
+  let deliver t signal = Bag.iter t.bag ~f:(fun f -> f signal)
+
+  let add t handler = Bag.add t.bag handler
+
+  let remove t handler_elt = Bag.remove t.bag handler_elt
+
+  let deliver t signal = Bag.iter t.bag ~f:(fun handler -> handler signal)
+end
+
+type t =
+  { handlers_by_signal : Handlers.t Signal.Table.t;
+    delivered : (Signal.t * Handlers.t) Thread_safe_queue.t sexp_opaque;
+    thread_safe_notify_signal_delivered : unit -> unit;
+  }
+with sexp_of
+
+let create ~thread_safe_notify_signal_delivered =
+  { handlers_by_signal = Signal.Table.create ();
+    delivered = Thread_safe_queue.create ();
+    thread_safe_notify_signal_delivered;
+  }
+;;
+
+type z = (Handlers.t * Handler.t Bag.Elt.t) list
+
+let get_handlers t signal =
+  Hashtbl.find_or_add t.handlers_by_signal signal ~default:(fun () ->
+    let handlers = Handlers.create () in
+    Signal.handle signal (fun _ ->
+      (* Must be thread safe. *)
+      Thread_safe_queue.enqueue t.delivered (signal, handlers);
+      t.thread_safe_notify_signal_delivered ());
+    handlers)
+;;
+
+let handle_signal t signal = ignore (get_handlers t signal : Handlers.t)
+
+let install_handler t signals handler =
+  List.map signals ~f:(fun signal ->
+    let handlers = get_handlers t signal in
+    (handlers, Handlers.add handlers handler))
+;;
+
+let remove_handler _t z = List.iter z ~f:(fun (handlers, handler_elt) ->
+  Handlers.remove handlers handler_elt)
+;;
+
+let handle_delivered t =
+  Thread_safe_queue.dequeue_until_empty t.delivered (fun (signal, handlers) ->
+    Handlers.deliver handlers signal)
+;;

base/async/scheduler/lib/signal.ml

 let handle ?stop ts ~f =
   let scheduler = the_one_and_only () in
   let signal_handlers = scheduler.Scheduler.signal_handlers in
-  let z = Signal_handlers.install_handler signal_handlers ts f in
+  let z = Raw_signal_handlers.install_handler signal_handlers ts f in
   Option.iter stop ~f:(fun stop ->
     upon stop (fun () ->
-      Signal_handlers.remove_handler signal_handlers z));
+      Raw_signal_handlers.remove_handler signal_handlers z));
 ;;
 
 let standard =

base/async/scheduler/lib/signal_handlers.ml

-open Core.Std
-open Import
+(* Although this seems pointless, separating Signal_handlers (whose .mli
+   references the Signal module) from Raw_signal_handlers prevents a
+   dependency cycle when using ocamlbuild. *)
 
-module Signal = Core.Std.Signal
-
-module Handler = struct
-  type t = Signal.t -> unit
-end
-
-module Handlers = struct
-  type t = { bag : Handler.t sexp_opaque Bag.t } with sexp_of
-
-  let create () = { bag = Bag.create () }
-
-  let deliver t signal = Bag.iter t.bag ~f:(fun f -> f signal)
-
-  let add t handler = Bag.add t.bag handler
-
-  let remove t handler_elt = Bag.remove t.bag handler_elt
-
-  let deliver t signal = Bag.iter t.bag ~f:(fun handler -> handler signal)
-end
-
-type t =
-  { handlers_by_signal : Handlers.t Signal.Table.t;
-    delivered : (Signal.t * Handlers.t) Thread_safe_queue.t sexp_opaque;
-    thread_safe_notify_signal_delivered : unit -> unit;
-  }
-with sexp_of
-
-let create ~thread_safe_notify_signal_delivered =
-  { handlers_by_signal = Signal.Table.create ();
-    delivered = Thread_safe_queue.create ();
-    thread_safe_notify_signal_delivered;
-  }
-;;
-
-type z = (Handlers.t * Handler.t Bag.Elt.t) list
-
-let get_handlers t signal =
-  Hashtbl.find_or_add t.handlers_by_signal signal ~default:(fun () ->
-    let handlers = Handlers.create () in
-    Signal.handle signal (fun _ ->
-      (* Must be thread safe. *)
-      Thread_safe_queue.enqueue t.delivered (signal, handlers);
-      t.thread_safe_notify_signal_delivered ());
-    handlers)
-;;
-
-let handle_signal t signal = ignore (get_handlers t signal : Handlers.t)
-
-let install_handler t signals handler =
-  List.map signals ~f:(fun signal ->
-    let handlers = get_handlers t signal in
-    (handlers, Handlers.add handlers handler))
-;;
-
-let remove_handler _t z = List.iter z ~f:(fun (handlers, handler_elt) ->
-  Handlers.remove handlers handler_elt)
-;;
-
-let handle_delivered t =
-  Thread_safe_queue.dequeue_until_empty t.delivered (fun (signal, handlers) ->
-    Handlers.deliver handlers signal)
-;;
+include Raw_signal_handlers

base/async/scheduler/lib/writer.ml

 let flushed_time t = ensure_not_closed t; flushed_time t
 let flushed t = ensure_not_closed t; flushed t
 let fsync t   = ensure_not_closed t; flushed t >>= fun _ -> Unix.fsync t.fd
-let fdatasync =
-  Or_error.map Unix.fdatasync ~f:(fun fdatasync t ->
-    ensure_not_closed t; flushed t >>= fun _ -> fdatasync t.fd)
+let fdatasync t =
+  ensure_not_closed t; flushed t >>= fun _ -> Unix.fdatasync t.fd
 ;;
 let write_bin_prot t sw_arg v = ensure_not_closed t; write_bin_prot t sw_arg v
 let send t s                  = ensure_not_closed t; send t s

base/async/scheduler/lib/writer.mli

 val flushed_time : t -> Time.t Deferred.t
 
 val fsync : t -> unit Deferred.t
-val fdatasync : (t -> unit Deferred.t) Or_error.t
+val fdatasync : t -> unit Deferred.t
 
 (** [send t s] writes a string to the channel that can be read back
     using Reader.recv *)

base/core/extended/examples/core-command/main.ml

         ++ flag "-note" (listed Note.arg_type) ~doc:"NOTE a note"
         (* anonymous arguments *)
         ++ anon ("NAME" %: string)
+        ++ anon ("FOO" %: string)
+        ++ anon (sequence "BAR" string)
       )
-      (fun ~slow loudness date notes song ->
+      (fun ~slow loudness date notes song _ _ ->
         (* ... your code here... *)
         print_endline (if slow then "slow" else "fast");
         printf "loudness = %s\n"

base/core/extended/lib/console.ml

 
 end
 
-INCLUDE "config.mlh"
-IFDEF LINUX_EXT THEN
 let width () =
-  if Unix.isatty Unix.stdout then
-    `Cols (snd (Linux_ext.get_terminal_size ()))
-  else
-    `Not_a_tty
-ELSE
-let width () = `Not_available
-ENDIF
+  match Linux_ext.get_terminal_size with
+  | Error _ -> `Not_available
+  | Ok _ when not (Unix.isatty Unix.stdout) -> `Not_a_tty
+  | Ok get_size -> `Cols (snd (get_size ()))
 
 let print_list oc l =
   match (width () :> [ `Cols of int | `Not_a_tty | `Not_available ]) with

base/core/extended/lib/core_command.mli

 
   val help : (string Lazy.t -> 'm, 'm) t (* the help text for this command *)
   val path : unit -> (string list   -> 'm, 'm) t (* the subcommand path of this command *)
-  val args : (string list   -> 'm, 'm) t (* the arguments passed to this command *)
+  val args : (string list -> 'm, 'm) t (* the arguments passed to this command *)
 
 end
 

base/core/extended/lib/fcommand.ml

   let zero = zero
 end
 
-let cmd ~summary ?readme ?(global_flags = []) t main =
+let cmd ~summary ?readme ?autocomplete ?(global_flags = []) t main =
   let flags = t.flags @ global_flags in
   let flag_names = List.map ~f:Command.Flag.name flags in
   Option.iter (List.find_a_dup ~compare:String.compare flag_names) ~f:(fun dup ->
     failwithf "Duplicate flag name: %S" dup ());
-  Command.create ~summary ?readme
+  Command.create ~summary ?readme ?autocomplete
     ~usage_arg:(Anons_grammar.usage_arg t.anons)
     ~init:Fn.id
     ~flags

base/core/extended/lib/fcommand.mli

 (* [const v] injects the value [v] into main's parameters *)
 val const : 'a -> ('a -> 'm, 'm) t
 
-(* [either name ++ spec1 ++ spec2] ensures that at most one spec is supplied *)
-val either : string -> ('a option -> 'b, 'a option -> 'a option -> 'b) t
-
 (** [spec1 ++ spec2] composes command-line specifications [spec1] and
     [spec2].  Parameters specified by [spec1] will come before those
     specified by [spec2] in the eventual main function. *)
 val cmd :
   summary:string
   -> ?readme:(unit -> string)
+  -> ?autocomplete:Command.Autocomplete.t
   -> ?global_flags:(unit Command.Flag.t list)
   -> ('main, unit) t
   -> 'main

base/core/extended/lib/procfs.ml

       }
       with fields;;
 
+  let eval_mul_comp rx_tx =
+    match rx_tx with
+    | 0 -> false;
+    | 1 -> true;
+    | _ -> failwithf "Proc.Net.Dev error : value is %d, expected 0 or 1." rx_tx ()
+
+  let of_string str =
+    let s = String.strip in
+    let ios str  = Int.of_string str in
+    match String.split ~on:'\t' str with
+    | [ iface; rx_bytes; rx_packets; rx_errs; rx_drop; rx_fifo; rx_frame; rx_compressed;
+    rx_multicast; tx_bytes; tx_packets; tx_errs; tx_drop; tx_fifo; tx_colls; tx_carrier;
+    tx_compressed ] ->
+    Some {
+      iface = s iface;
+      rx_bytes = ios (s rx_bytes);
+      rx_packets = ios (s rx_packets);
+      rx_errs   = ios (s rx_errs);
+      rx_drop   = ios (s rx_drop);
+      rx_fifo   = ios (s rx_fifo);
+      rx_frame  = ios (s rx_frame);
+      rx_compressed = (eval_mul_comp (ios rx_compressed));
+      rx_multicast = (eval_mul_comp (ios rx_multicast));
+      tx_bytes  = ios (s tx_bytes);
+      tx_packets = ios (s tx_packets);
+      tx_errs   = ios (s tx_errs);
+      tx_drop   = ios (s tx_drop);
+      tx_fifo   = ios (s tx_fifo);
+      tx_colls  = ios (s tx_colls);
+      tx_carrier = ios (s tx_carrier);
+      tx_compressed = (eval_mul_comp (ios tx_compressed));
+    }
+    | _ -> failwithf "Net.Dev.of_string: unsupported format: %s" str ()
+
+    (* add interfaces () to get a list of all interfaces on box *)
+
   end
-
   module Route = struct
 
   type t =

base/core/lib/bigstring.ml

 
 ELSE
 
-let really_send_no_sigpipe             = Error.unimplemented "Bigstring.really_send_no_sigpipe"
-let send_nonblocking_no_sigpipe        = Error.unimplemented "Bigstring.send_nonblocking_no_sigpipe"
-let sendto_nonblocking_no_sigpipe      = Error.unimplemented "Bigstring.sendto_nonblocking_no_sigpipe"
-let unsafe_really_send_no_sigpipe      = Error.unimplemented "Bigstring.unsafe_really_send_no_sigpipe"
-let unsafe_send_nonblocking_no_sigpipe = Error.unimplemented "Bigstring.unsafe_send_nonblocking_no_sigpipe"
+let really_send_no_sigpipe             = unimplemented "Bigstring.really_send_no_sigpipe"
+let send_nonblocking_no_sigpipe        = unimplemented "Bigstring.send_nonblocking_no_sigpipe"
+let sendto_nonblocking_no_sigpipe      = unimplemented "Bigstring.sendto_nonblocking_no_sigpipe"
+let unsafe_really_send_no_sigpipe      = unimplemented "Bigstring.unsafe_really_send_no_sigpipe"
+let unsafe_send_nonblocking_no_sigpipe = unimplemented "Bigstring.unsafe_send_nonblocking_no_sigpipe"
 
 ENDIF
 
 ELSE
 
 let sendmsg_nonblocking_no_sigpipe =
-  Error.unimplemented "Bigstring.sendmsg_nonblocking_no_sigpipe"
+  unimplemented "Bigstring.sendmsg_nonblocking_no_sigpipe"
 ;;
 
 let unsafe_sendmsg_nonblocking_no_sigpipe =
-  Error.unimplemented "Bigstring.unsafe_sendmsg_nonblocking_no_sigpipe"
+  unimplemented "Bigstring.unsafe_sendmsg_nonblocking_no_sigpipe"
 ;;
 
 ENDIF

base/core/lib/bigstring_marshal.ml

 
 ELSE
 
+open Std_internal
+
 let marshal             = unimplemented "Bigstring_marshal.marshal"
 let marshal_blit        = unimplemented "Bigstring_marshal.marshal_blit"
 let marshal_data_size   = unimplemented "Bigstring_marshal.marshal_data_size"

base/core/lib/common.ml

 type passfail = Pass | Fail of string
 
 exception Unimplemented of string with sexp
+let unimplemented = Or_error.unimplemented
+
 exception Bug of string with sexp

base/core/lib/common.mli

 exception Finally of exn * exn
 
 exception Unimplemented of string
+val unimplemented : string -> _ Or_error.t
 
 (* The sexps of this type only have 12 digits after the decimal. Therefore they're less
    annoying to look at than the sexps of floats. The input sexps disallow nan and inf. *)

base/core/lib/core_map.ml

 open No_polymorphic_compare
 
 let (= ) (x : int) y = Polymorphic_compare.(= ) x y
-let (<>) (x : int) y = Polymorphic_compare.(< ) x y
+let (<>) (x : int) y = Polymorphic_compare.(<>) x y
 let (< ) (x : int) y = Polymorphic_compare.(< ) x y
 let (> ) (x : int) y = Polymorphic_compare.(> ) x y
 let (>=) (x : int) y = Polymorphic_compare.(>=) x y

base/core/lib/core_mutex.ml

 
 ELSE
 
-let timedlock = Error.unimplemented "Mutex.timedlock"
+let timedlock = Or_error.unimplemented "Mutex.timedlock"
 
 ENDIF

base/core/lib/core_unix.ml

 
 external sync : unit -> unit = "unix_sync"
 external fsync : Unix.file_descr -> unit = "unix_fsync"
-IFDEF FDATASYNC THEN
 external fdatasync : Unix.file_descr -> unit = "unix_fdatasync"
 
-let fdatasync = Ok fdatasync
-
-ELSE
-
-let fdatasync = Error.unimplemented "Unix.fdatasync"
-
-ENDIF
-
 external dirfd : Unix.dir_handle -> File_descr.t = "unix_dirfd"
 
 external readdir_ino :

base/core/lib/core_unix.mli

 (** Synchronize all filesystem buffers with disk. *)
 
 external fsync : File_descr.t -> unit = "unix_fsync"
-(** Synchronize the kernel buffers of a given file descriptor with disk. *)
 
 (** Synchronize the kernel buffers of a given file descriptor with disk,
     but do not necessarily write file attributes. *)
-val fdatasync : (File_descr.t -> unit) Or_error.t
+external fdatasync : File_descr.t -> unit = "unix_fdatasync"
 
 external readdir_ino :
   dir_handle -> string * nativeint = "unix_readdir_ino_stub"

base/core/lib/linux_ext.ml

 
   external raw_sysinfo : unit -> Raw_sysinfo.t = "linux_sysinfo"
 
-  let sysinfo () =
+  let sysinfo = Ok (fun () ->
     let raw = raw_sysinfo () in
     {
       uptime = Span.of_int_sec raw.Raw_sysinfo.uptime;
       totalhigh = raw.Raw_sysinfo.totalhigh;
       freehigh = raw.Raw_sysinfo.freehigh;
       mem_unit = raw.Raw_sysinfo.mem_unit;
-    }
+    })
 end
 
 external gettcpopt_bool :
   )
 ;;
 
+external get_terminal_size : unit -> int * int = "linux_get_terminal_size"
+
+external get_ipv4_address_for_interface : string -> string =
+  "linux_get_ipv4_address_for_interface" ;;
+
 let cores                          = Ok cores
 let file_descr_realpath            = Ok file_descr_realpath
+let get_ipv4_address_for_interface = Ok get_ipv4_address_for_interface
+let get_terminal_size              = Ok get_terminal_size
 let gettcpopt_bool                 = Ok gettcpopt_bool
+let gettid                         = Ok gettid
 let in_channel_realpath            = Ok in_channel_realpath
 let out_channel_realpath           = Ok out_channel_realpath
 let pr_get_name                    = Ok pr_get_name
 module Sysinfo = struct
   include Sysinfo0
 
-  let sysinfo = Error.unimplemented "Linux_ext.Sysinfo.sysinfo"
+  let sysinfo = unimplemented "Linux_ext.Sysinfo.sysinfo"
 end
 
 module Clock = struct
   include Clock0
-  let get               = Error.unimplemented "Linux_ext.Clock.get"
-  let get_time          = Error.unimplemented "Linux_ext.Clock.get_time"
-  let set_time          = Error.unimplemented "Linux_ext.Clock.set_time"
-  let get_resolution    = Error.unimplemented "Linux_ext.Clock.get_resolution"
-  let get_process_clock = Error.unimplemented "Linux_ext.Clock.get_process_clock"
-  let get_thread_clock  = Error.unimplemented "Linux_ext.Clock.get_thread_clock"
+  let get               = unimplemented "Linux_ext.Clock.get"
+  let get_time          = unimplemented "Linux_ext.Clock.get_time"
+  let set_time          = unimplemented "Linux_ext.Clock.set_time"
+  let get_resolution    = unimplemented "Linux_ext.Clock.get_resolution"
+  let get_process_clock = unimplemented "Linux_ext.Clock.get_process_clock"
+  let get_thread_clock  = unimplemented "Linux_ext.Clock.get_thread_clock"
 end
 
-let cores                          = Error.unimplemented "Linux_ext.cores"
-let file_descr_realpath            = Error.unimplemented "Linux_ext.file_descr_realpath"
-let gettcpopt_bool                 = Error.unimplemented "Linux_ext.gettcpopt_bool"
-let in_channel_realpath            = Error.unimplemented "Linux_ext.in_channel_realpath"
-let out_channel_realpath           = Error.unimplemented "Linux_ext.out_channel_realpath"
-let pr_get_name                    = Error.unimplemented "Linux_ext.pr_get_name"
-let pr_get_pdeathsig               = Error.unimplemented "Linux_ext.pr_get_pdeathsig"
-let pr_set_name_first16            = Error.unimplemented "Linux_ext.pr_set_name_first16"
-let pr_set_pdeathsig               = Error.unimplemented "Linux_ext.pr_set_pdeathsig"
-let sched_setaffinity              = Error.unimplemented "Linux_ext.sched_setaffinity"
-let sched_setaffinity_this_thread  = Error.unimplemented "Linux_ext.sched_setaffinity_this_thread"
-let send_no_sigpipe                = Error.unimplemented "Linux_ext.send_no_sigpipe"
-let send_nonblocking_no_sigpipe    = Error.unimplemented "Linux_ext.send_nonblocking_no_sigpipe"
-let sendfile                       = Error.unimplemented "Linux_ext.sendfile"
-let sendmsg_nonblocking_no_sigpipe = Error.unimplemented "Linux_ext.sendmsg_nonblocking_no_sigpipe"
-let settcpopt_bool                 = Error.unimplemented "Linux_ext.settcpopt_bool"
+let cores                          = unimplemented "Linux_ext.cores"
+let file_descr_realpath            = unimplemented "Linux_ext.file_descr_realpath"
+let get_ipv4_address_for_interface = unimplemented "Linux_ext.get_ipv4_address_for_interface"
+let get_terminal_size              = unimplemented "Linux_ext.get_terminal_size"
+let gettcpopt_bool                 = unimplemented "Linux_ext.gettcpopt_bool"
+let gettid                         = unimplemented "Linux_ext.gettid"
+let in_channel_realpath            = unimplemented "Linux_ext.in_channel_realpath"
+let out_channel_realpath           = unimplemented "Linux_ext.out_channel_realpath"
+let pr_get_name                    = unimplemented "Linux_ext.pr_get_name"
+let pr_get_pdeathsig               = unimplemented "Linux_ext.pr_get_pdeathsig"
+let pr_set_name_first16            = unimplemented "Linux_ext.pr_set_name_first16"
+let pr_set_pdeathsig               = unimplemented "Linux_ext.pr_set_pdeathsig"
+let sched_setaffinity              = unimplemented "Linux_ext.sched_setaffinity"
+let sched_setaffinity_this_thread  = unimplemented "Linux_ext.sched_setaffinity_this_thread"
+let send_no_sigpipe                = unimplemented "Linux_ext.send_no_sigpipe"
+let send_nonblocking_no_sigpipe    = unimplemented "Linux_ext.send_nonblocking_no_sigpipe"
+let sendfile                       = unimplemented "Linux_ext.sendfile"
+let sendmsg_nonblocking_no_sigpipe = unimplemented "Linux_ext.sendmsg_nonblocking_no_sigpipe"
+let settcpopt_bool                 = unimplemented "Linux_ext.settcpopt_bool"
 
 ENDIF
-
-external get_terminal_size : unit -> int * int = "linux_get_terminal_size"
-
-external get_ipv4_address_for_interface : string -> string =
-  "linux_get_ipv4_address_for_interface" ;;

base/core/lib/linux_ext.mli

       mem_unit : int;  (** Memory unit size in bytes *)
     } with sexp, bin_io
 
-  val sysinfo : unit -> t
+  val sysinfo : (unit -> t) Or_error.t
 end
 
 (** {2 Filesystem functions} *)
 
 (** {2 Clock functions} *)
 
-IFDEF POSIX_TIMERS THEN
 module Clock : sig
   type t
 
   (** [get_thread_clock] the clock measuring the CPU-time of the current thread. *)
   val get_thread_clock : (unit -> t) Or_error.t
 end
-ENDIF
 
 (** {2 Parent death notifications} *)
 
 
 (** [get_terminal_size ()] @return [(rows, cols)], the number of rows and
     columns of the terminal. *)
-val get_terminal_size : unit -> int * int
+val get_terminal_size : (unit -> int * int) Or_error.t
 
 (* Get the thread ID of the current thread (see gettid(2)). *)
-val gettid : unit -> int
+val gettid : (unit -> int) Or_error.t
 
 (* [get_ipv4_address_for_interface "eth0"] returns the IP address
    assigned to eth0, or throws an exception if no IP address
    is configured. *)
-val get_ipv4_address_for_interface : string -> string ;;
+val get_ipv4_address_for_interface : (string -> string) Or_error.t ;;

base/core/lib/linux_ext_stubs.c

     uerror("pr_get_name", Nothing);
   return caml_copy_string(buf);
 }
-#endif /* JSC_LINUX_EXT */
 
 /* copy of the ocaml's stdlib wrapper for getpid */
 CAMLprim value linux_ext_gettid(value v_unit __unused)
   close(fd);
   CAMLreturn(caml_copy_string(inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)));
 }
+
+#endif /* JSC_LINUX_EXT */

base/core/lib/std.ml

 end
 
 
-IFDEF LINUX_EXT THEN
 module Linux_ext = Linux_ext
 module Bigstring_marshal = Bigstring_marshal
-ENDIF
 module Binary_packing = Binary_packing
 module Blang = Blang
 module Bounded_int_table = Bounded_int_table
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.