Haiku-related ulimit overhaul:

• print ulimit -a with the flag, like most other shells do
• move ulimit-1 regression test to ulimit-2 and exclude on Haiku:
  it can only set the -n and -V limits AFAICT
• document that some OSes (here: Haiku) can only set the soft limits
  (so “ulimit -nS 1024” is okay but -S is required)
• check “ulimit -c 0”, which dot.mkshrc uses, everywhere
  (if it errors out, hack around it or stub it out with MKSH_NO_LIMITS)
This commit is contained in:
tg 2017-03-19 18:05:29 +00:00
parent c98c8e9f5f
commit c3fe9d5fb5
3 changed files with 13 additions and 6 deletions

11
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.760 2017/03/17 22:45:48 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.761 2017/03/19 18:05:25 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -10224,9 +10224,16 @@ expected-stdout:
16#61 16#0 16#62 16#20AC 16#63 .
---
name: ulimit-1
description:
Check that ulimit as used in dot.mksh works or is stubbed
stdin:
ulimit -c 0
---
name: ulimit-2
description:
Check if we can use a specific syntax idiom for ulimit
category: !os:syllable
XXX Haiku works, but only for -n and -V
category: !os:haiku,!os:syllable
stdin:
if ! x=$(ulimit -d) || [[ $x = unknown ]]; then
#echo expected to fail on this OS

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.328 2017/03/17 22:45:50 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.329 2017/03/19 18:05:28 tg Exp $");
#if HAVE_KILLPG
/*
@ -3655,7 +3655,7 @@ c_ulimit(const char **wp)
if (!all)
print_ulimit(rlimits[i], how);
else for (i = 0; i < NELEM(rlimits); ++i) {
shprintf("%-20s ", rlimits[i]->name);
shprintf("-%c: %-20s ", rlimits[i]->optchar, rlimits[i]->name);
print_ulimit(rlimits[i], how);
}
return (0);

4
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.430 2017/03/19 16:48:51 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.431 2017/03/19 18:05:29 tg Exp $
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -5030,7 +5030,7 @@ once they are set.
Also note that the types of limits available are system
dependent \*(en some systems have only the
.Fl f
limit.
limit, or not even that, or can set only the soft limits
.Bl -tag -width 5n
.It Fl a
Display all limits; unless