pkgsrc/shells/mksh/patches/manual-funcs.c
jperkin 58b578bfb0 mksh: Import unpacked mksh-59b sources.
Two patches have been applied on top, both of which are stored in the
patches directory as manual-Build.sh and manual-funcs.c, to fix issues
on Darwin and SunOS that will be included in the next mksh release.  The
binary mksh.ico file has been manually removed.

This paves the way for  mksh to be used as an alternate bootstrap shell
instead of shells/pdksh, which has been unmaintained for many years and
has some known issues.

Initial bulk build results on Darwin and SunOS look good, and having a
maintained shell which focuses on portability and speed should provide
us with a better long-term option for systems which require a bootstrap
shell.
2020-07-06 10:11:34 +00:00

29 lines
1.2 KiB
C

$NetBSD: manual-funcs.c,v 1.1 2020/07/06 10:11:34 jperkin Exp $
Apple switched from using RLIMIT_RSS (ulimit -m) in 10.3 (xnu-517.12.7) over
to RLIMIT_AS (ulimit -v) in 10.4 (xnu-792), providing a compatibility define
for RLIMIT_RSS. The default bash shell since 10.4 supports both -m and -v.
Because the current design of the ULIMIT_CMD_* variables in mk/platform/*.mk
dictates that we must use a single value, -m is chosen so that all releases
are supported. However, mksh removes -m support by default if it is
identical to -v, thus breaking ULIMIT_CMD_memorysize.
In order to provide maximum compatibility in pkgsrc, we apply the following
patch so that "ulimit -m" continues to work with mksh, acting as an alias
for -v.
For the record, it appears that /bin/zsh also supports -v but not -m,
whereas shells/pdksh supports -m but not -v.
--- files/funcs.c.orig 2020-06-25 09:34:59.000000000 +0000
+++ files/funcs.c
@@ -3240,7 +3240,7 @@ ptest_error(Test_env *te, int ofs, const
#else
#define ULIMIT_M_IS_RSS
#endif
-#if defined(ULIMIT_M_IS_RSS) && defined(RLIMIT_AS) && (RLIMIT_RSS == RLIMIT_AS)
+#if defined(ULIMIT_M_IS_RSS) && defined(RLIMIT_AS) && (RLIMIT_RSS == RLIMIT_AS) && !defined(__APPLE__)
#undef ULIMIT_M_IS_RSS
#endif
#endif