aboutsummaryrefslogtreecommitdiffstats
path: root/init.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'init.cfg')
-rw-r--r--init.cfg20
1 files changed, 18 insertions, 2 deletions
diff --git a/init.cfg b/init.cfg
index ae158c7a3..7e21f96c6 100644
--- a/init.cfg
+++ b/init.cfg
@@ -178,6 +178,8 @@ ulimit_supported_()
v="$1"
shift
+ local ulimit_start_=$(date +%s) || skip_ 'ulimit: date error'
+
(
# Try to disable core dumps which may
# occur with memory constraints
@@ -185,6 +187,16 @@ ulimit_supported_()
ulimit -v $v && "$@"
) >/dev/null 2>&1
+
+ ret=$?
+
+ local ulimit_end_=$(date +%s) || skip_ 'ulimit: date error'
+
+ # This can happen on Solaris 11 at least where fork() can give EAGAIN
+ # and bash will retry for at least 16 seconds
+ test $(($ulimit_end_ - $ulimit_start_)) -ge 10 && skip_ 'ulimit too slow'
+
+ return $ret
}
# Determine the minimum required VM limit to run the given command.
@@ -200,11 +212,15 @@ get_min_ulimit_v_()
page_size=$(($page_size / 1024))
for v in $( seq 5000 5000 50000 ); do
- if ulimit_supported_ $v "$@"; then
+ ulimit_supported_ $v "$@"; ret=$?
+ test $ret = 77 && break;
+ if test $ret = 0; then
local prev_v
prev_v=$v
for v in $( seq $(($prev_v-1000)) -1000 1000 ); do
- ulimit_supported_ $v "$@" ||
+ ulimit_supported_ $v "$@"; ret=$?
+ test $ret = 77 && break 2;
+ test $ret = 0 ||
{
ret_v=$((prev_v + $page_size))
echo $ret_v