getrlimit, setrlimit

Stephen Weeks MLton@sourcelight.com
Mon, 9 Jul 2001 11:33:44 -0700


I am going to add analogues of gerlimit and setrlimit to MLton.  Any comments on
the following approach?

signature RLIMIT =
   sig
      type rlimit = int

      datatype resource =
         AS      (* address space (virtual memory) limit *)
       | CORE    (* max core file size *)
       | CPU     (* CPU time in seconds *)
       | DATA    (* max data size *)
       | FSIZE   (* Maximum filesize *)
       | MEMLOCK (* max locked-in-memory address space *)
       | NOFILE  (* max number of open files *)
       | NPROC   (* max number of processes *)
       | RSS     (* max resident set size *)
       | STACK   (* max stack size *)

      val get: resource -> {hard: rlimit, soft: rlimit}
      val set: resource * {hard: rlimit, soft: rlimit} -> unit
   end