getrlimit, setrlimit

Matthew Fluet mfluet@intertrust.com
Mon, 9 Jul 2001 16:38:13 -0700 (PDT)


> How about the following?

Bleh...

MLton.Rlimit.set ({hard = MLton.Rlimit.Rlim.infinity, soft = 0wx00},
                  MLton.Rlimit.Resource.numFiles)

(Alright, maybe it's not as much typing as I thought, but it still seems
awfully verbose. Even with local open MLton.Rlimit in ... end you still
need an Rlim and a Resource.)

> > On a style question, what is the argument for the
> >       type t = word
> > Note, it is NOT true that this structure is about operations on type t.  If
> > any thing, it is about operations on type { hart: t, sort: t}, or of type
> > resource.
>
> Agreed.

I agree with Henry that type t = word is a little obscure.  I wouldn't
mind type rlim = word.  Anyways, I's prefered the version with everything
at the same level and resource as an abstract type.  But, I don't forsee
using this anytime in the near future, so I don't really care.  And I
suspect Steve's only motivation for this structure is so he can add three
lines to the benchmark program to set the stack size for running MLkit.

> signature MLTON_RLIMIT =
>    sig
>       structure Rlim:
> 	 sig
> 	    type t = word
>
> 	    val infinity: t
> 	 end
>
>       structure Resource:
> 	 sig
> 	    type t
>
> 	    val cpuTime: t              (* CPU     CPU time in seconds *)
> 	    val coreFileSize: t         (* CORE    max core file size *)
> 	    val dataSize: t             (* DATA    max data size *)
> 	    val fileSize: t             (* FSIZE   Maximum filesize *)
> 	    val lockedInMemorySize: t   (* MEMLOCK max locked-in-memory address space *)
> 	    val numFiles: t             (* NOFILE  max number of open files *)
> 	    val numProcesses: t         (* NPROC   max number of processes *)
> 	    val residentSetSize: t      (* RSS     max resident set size *)
> 	    val stackSize: t            (* STACK   max stack size *)
> 	    val virtualMemorySize: t    (* AS      address space (virtual memory) limit *)
> 	 end
>
>       type t = {hard: Rlim.t,
> 		soft: Rlim.t}
>
>       val get: Resource.t -> t
>       val set: t * Resource.t -> unit
>    end
>