summaryrefslogtreecommitdiff
path: root/auto
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2021-03-01 20:00:43 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2021-03-01 20:00:43 +0300
commit71eb19da43e3382ce97a14b6d3cd564881da37e7 (patch)
treed76356c1b62fa4a12f1a714dfba12bd0920097a8 /auto
parent0f5d0c5798eacb60407bcf0a76fc0b2c39e356bb (diff)
downloadnginx-71eb19da43e3382ce97a14b6d3cd564881da37e7.tar.gz
Improved maximum errno detection.
Previously, systems without sys_nerr (or _sys_nerr) were handled with an assumption that errors start at 0 and continuous. This is, however, not something POSIX requires, and not true on some platforms. Notably, on Linux, where sys_nerr is no longer available for newly linked binaries starting with glibc 2.32, there are gaps in error list, which used to stop us from properly detecting maximum errno. Further, on GNU/Hurd errors start at 0x40000001. With this change, maximum errno detection is moved to the runtime code, now able to ignore gaps, and also detects the first error if needed. This fixes observed "Unknown error" messages as seen on Linux with glibc 2.32 and on GNU/Hurd.
Diffstat (limited to 'auto')
-rw-r--r--auto/unix28
1 files changed, 0 insertions, 28 deletions
diff --git a/auto/unix b/auto/unix
index ff9697a4e..845e41fc6 100644
--- a/auto/unix
+++ b/auto/unix
@@ -753,34 +753,6 @@ if [ $ngx_found = no ]; then
fi
-if [ $ngx_found = no ]; then
-
- # Solaris has no sys_nerr
- ngx_feature='maximum errno'
- ngx_feature_name=NGX_SYS_NERR
- ngx_feature_run=value
- ngx_feature_incs='#include <errno.h>
- #include <string.h>
- #include <stdio.h>'
- ngx_feature_path=
- ngx_feature_libs=
- ngx_feature_test='int n;
- char *p;
- for (n = 1; n < 1000; n++) {
- errno = 0;
- p = strerror(n);
- if (errno == EINVAL
- || p == NULL
- || strncmp(p, "Unknown error", 13) == 0)
- {
- break;
- }
- }
- printf("%d", n);'
- . auto/feature
-fi
-
-
ngx_feature="localtime_r()"
ngx_feature_name="NGX_HAVE_LOCALTIME_R"
ngx_feature_run=no