getrlimit, setrlimit
Stephen Weeks
MLton@sourcelight.com
Mon, 9 Jul 2001 16:21:14 -0700
> I guess I don't see any big advantage of hiding the datatype. I suppose it
> is slightly more opaque, which is good.
Yeah, that's about it. It also means we don't have to convert from the datatype
to the int.
> 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 would like this much better if you just use word instead of t.
> Doesn't this make it more readable?
How about the following?
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