tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Testing mksh as bootstrap shell

On my OSX 10.11.6 machine, ulimit accepts either -v or -m and sets both with either.
Thanks,  - Tim

On Thu, Jun 25, 2020 at 4:32 AM Jonathan Perkin <> wrote:
* On 2020-06-25 at 10:09 BST, Jonathan Perkin wrote:

> * On 2020-06-25 at 09:53 BST, Jonathan Perkin wrote:
> > FWIW this is on macOS, not Solaris.  On Solaris mksh appears to do the
> > right thing, supporting -v but not -m which matches the native shells.
> > However on macOS both -m and -v are supported by native shells, but
> > only -v by mksh.
> The "fix" is:
>   --- a/shells/mksh/files/funcs.c
>   +++ b/shells/mksh/files/funcs.c
>   @@ -3240,9 +3240,6 @@ ptest_error(Test_env *te, int ofs, const char *msg)
>    #else
>    #define ULIMIT_M_IS_RSS
>    #endif
>   -#if defined(ULIMIT_M_IS_RSS) && defined(RLIMIT_AS) && (RLIMIT_RSS == RLIMIT_AS)
>   -#undef ULIMIT_M_IS_RSS
>   -#endif
>    #endif
>    #if !defined(RLIMIT_AS) && !defined(ULIMIT_M_IS_VMEM) && defined(RLIMIT_VMEM)
> i.e. just because macOS has "#define RLIMIT_RSS RLIMIT_AS" in its
> sys/resource.h for compatibility, don't remove -m support.

Sorry, one of those threads where I should have just waited for a
while to send everything in one go as I found more information...

I went digging into the xnu archives to see if it is possible we could
switch mk/platform/ over to using "ulimit -v" as that appears
to be the correct option now.  Apple switched over from RLIMIT_RSS in
10.3.9 (xnu-517.12.7) to RLIMIT_AS in 10.4 (xnu-792), where RLIMIT_RSS
was redefined to be a compat alias for RLIMIT_AS.

As expected, on 10.4 or newer, setting either ulimit "-m" or "-v"
individually changes both values.

So, just in case we still want to support 10.3 or older, I'd prefer to
go with a compatibility patch for mksh rather than adjusting our
Darwin platform file to use "-v", though if anyone happens to have a
running 10.3 or older system and can check if there is a -v option
anyway that would be interesting.

Jonathan Perkin  -  Joyent, Inc.  -

Home | Main Index | Thread Index | Old Index