getrlimit, setrlimit

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


> I  very  much  like  the  idea of having the resource limits available, but I
> really don't like the names of the resource  datatype  constructors.   I  see
> that  they are taken exactly from the getrlimit/setrlimit, and that is enough
> of an advantage that it is best, but, as an example, the NO prefix of  NOFILE
> and the N prefix of NPROC both stand for the same thing.

I don't feel so strongly about sticking with the Unix names.  I found it kind of
painful to use all caps instead of the usual SML constructor capitalization
convention.  I'm not sure it's so bad to make up our own name and put the Unix
name in a comment.  What about the following?

      datatype resource =
         CPUTime              (* CPU *)
       | CoreFileSize         (* CORE *)
       | DataSize             (* DATA *)
       | FileSize             (* FSIZE *)
       | LockedInMemorySize   (* MEMLOCK *)
       | NumFiles             (* NOFILE *)
       | NumProcesses         (* NPROC *)
       | ResidentSetSize      (* RSS *)
       | StackSize            (* STACK *)
       | VirtualMemorySize    (* AS *)
 
> Along  the  same  lines, perhaps the hard and soft should be called `cur' and
> `max'? 

Those are the Unix names, but they make no sense to me, since they are hard and
soft limits.

Anyways, I guess if we stick with the Unix names for resource, we should use the
Unix cur and max.  But I think I like the new names I made up and hard and soft
better.

> Also, you need to have RLIM_INFINITY.

Added.