diff auto/unix @ 7785:c43a2e8fdf7e

Introduced strerrordesc_np() support. The strerrordesc_np() function, introduced in glibc 2.32, provides an async-signal-safe way to obtain error messages. This makes it possible to avoid copying error messages.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 01 Mar 2021 20:00:45 +0300
parents 8cc5b0365ee5
children e2e9e0fae747
line wrap: on
line diff
--- a/auto/unix
+++ b/auto/unix
@@ -727,19 +727,35 @@ ngx_feature_test="char buf[1]; struct io
 . auto/feature
 
 
-ngx_feature="sys_nerr"
-ngx_feature_name="NGX_SYS_NERR"
-ngx_feature_run=value
-ngx_feature_incs='#include <errno.h>
-                  #include <stdio.h>'
+# strerrordesc_np(), introduced in glibc 2.32
+
+ngx_feature="strerrordesc_np()"
+ngx_feature_name="NGX_HAVE_STRERRORDESC_NP"
+ngx_feature_run=no
+ngx_feature_incs='#include <string.h>'
 ngx_feature_path=
 ngx_feature_libs=
-ngx_feature_test='printf("%d", sys_nerr);'
+ngx_feature_test="char *p; p = strerrordesc_np(0);
+                  if (p == NULL) return 1"
 . auto/feature
 
 
 if [ $ngx_found = no ]; then
 
+    ngx_feature="sys_nerr"
+    ngx_feature_name="NGX_SYS_NERR"
+    ngx_feature_run=value
+    ngx_feature_incs='#include <errno.h>
+                      #include <stdio.h>'
+    ngx_feature_path=
+    ngx_feature_libs=
+    ngx_feature_test='printf("%d", sys_nerr);'
+    . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
     # Cygiwn defines _sys_nerr
     ngx_feature="_sys_nerr"
     ngx_feature_name="NGX_SYS_NERR"