getrlimit, setrlimit

Stephen Weeks MLton@sourcelight.com
Mon, 9 Jul 2001 12:06:49 -0700


> I trace rlim_t back to an unsigned long (or an unsigned quad long, if
> __USE_FILE_OFFSET64 is defined), so maybe Word32.word is a better choice.
> 
> Also, you might include
>         val infinity : rlimit
> and
>         val infinity = _prim "RLIM_INFINITY";

Here is the new sig.


signature RLIMIT =
   sig
      type t = word

      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: t, soft: t}
      val infinity: t
      val set: resource * {hard: t, soft: t} -> unit
   end