summaryrefslogtreecommitdiff
path: root/config_h.SH
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-28 09:20:46 -0700
committerKarl Williamson <khw@cpan.org>2020-12-19 22:00:29 -0700
commit9d228af78ad17dabb51f9059d215cc88c059a22a (patch)
tree861d3ac1bcddf309504abbcae654f2748cbe1a4a /config_h.SH
parent57d4826ad702b8c483b826af1c82f52ce64651ff (diff)
downloadperl-9d228af78ad17dabb51f9059d215cc88c059a22a.tar.gz
Add Configure probe for getenv() buffer race
Most implementations do not have a problem with two getenv()'s running simultaneously in different threads. But Posix doesn't require such good behavior. This adds a simple probe to test the current system.
Diffstat (limited to 'config_h.SH')
-rwxr-xr-xconfig_h.SH13
1 files changed, 13 insertions, 0 deletions
diff --git a/config_h.SH b/config_h.SH
index 19e1824444..dceb480e1f 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -4575,6 +4575,19 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#$d_endservent_r HAS_ENDSERVENT_R /**/
#define ENDSERVENT_R_PROTO $endservent_r_proto /**/
+/* GETENV_PRESERVES_OTHER_THREAD:
+ * This symbol, if defined, indicates that the getenv system call doesn't
+ * zap the static buffer of getenv() in a different thread.
+ *
+ * The typical getenv() implementation will return a pointer to the proper
+ * position in **environ. But some may instead copy them to a static
+ * buffer in getenv(). If there is a per-thread instance of that buffer,
+ * or the return points to **environ, then a many-reader/1-writer mutex
+ * will work; otherwise an exclusive locking mutex is required to prevent
+ * races.
+ */
+#$d_getenv_preserves_other_thread GETENV_PRESERVES_OTHER_THREAD /**/
+
/* HAS_GETGRENT_R:
* This symbol, if defined, indicates that the getgrent_r routine
* is available to getgrent re-entrantly.