[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
*alloc-gnu on Solaris 11
From: |
Bruno Haible |
Subject: |
*alloc-gnu on Solaris 11 |
Date: |
Fri, 14 May 2021 19:04:55 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; ) |
On Solaris 11.3 (the machine gcc211.fsffrance.org, in 64-bit mode), there
are test failures:
FAIL: test-calloc-gnu
FAIL: test-malloc-gnu
FAIL: test-realloc-gnu
FAIL: test-reallocarray
Each of these tests takes about 30 seconds before failing, and is not
immediately reactive to Ctrl-C.
$ time ./test-malloc-gnu
errno=11=EAGAIN
../../tests/test-malloc-gnu.c:42: assertion 'errno == ENOMEM' failed
Abort (Speicherabzug geschrieben)
real 0m28,908s
user 0m0,001s
sys 0m0,012s
$ truss ./test-malloc-gnu
...
brk(0x00000000) = 0x100102248
brk(0x100102250) = 0x00000000
brk(0x100106250) = 0x00000000
brk(0x100106250) = 0x00000000
brk(0x8000000100106240) Err#11 EAGAIN ; <== this takes
30 sec
brk(0x100106250) = 0x00000000
...
So, two things are wrong here:
* We should enforce an errno ENOMEM, not EAGAIN.
1. for compliance with POSIX.
2. for a reasonable error message.
3. so that programs don't attempt to repeat the call and thus bring the
system to its knees.
* We should avoid running such a resource-consuming test as part of
"make check".
This patch fixes the first issue and, as a side effect, the second issue as
well.
2021-05-14 Bruno Haible <bruno@clisp.org>
malloc-gnu, realloc-gnu, calloc-gnu: Ensure errno gets set to ENOMEM.
* m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Set gl_cv_func_malloc_posix to
'no' also on Solaris.
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index 6fcd4ad..972e808 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,4 +1,4 @@
-# malloc.m4 serial 26
+# malloc.m4 serial 27
dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -113,7 +113,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
fi
])
-# Test whether malloc, realloc, calloc set errno on failure.
+# Test whether malloc, realloc, calloc set errno to ENOMEM on failure.
# Set gl_cv_func_malloc_posix to yes or no accordingly.
AC_DEFUN([gl_CHECK_MALLOC_POSIX],
[
@@ -129,9 +129,13 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
case "$host_os" in
mingw*)
gl_cv_func_malloc_posix=no ;;
- irix*)
- dnl The three functions return NULL with errno unset when the
- dnl argument is larger than PTRDIFF_MAX. Here is a test program:
+ irix* | solaris*)
+ dnl On IRIX 6.5, the three functions return NULL with errno unset
+ dnl when the argument is larger than PTRDIFF_MAX.
+ dnl On Solaris 11.3, the three functions return NULL with errno set
+ dnl to EAGAIN, not ENOMEM, when the argument is larger than
+ dnl PTRDIFF_MAX.
+ dnl Here is a test program:
m4_divert_push([KILL])
#include <errno.h>
#include <stdio.h>
- *alloc-gnu on Solaris 11,
Bruno Haible <=