d_Gconvert=''
d_getaddrinfo=''
d_getcwd=''
+d_getenv_preserves_other_thread=''
d_getespwnam=''
d_getfsstat=''
d_getgrent=''
set getcwd d_getcwd
eval $inlibc
+: check for getenv behavior
+case "$d_getenv_preserves_other_thread" in
+'')
+$echo "Checking to see if getenv() preserves a different thread's results" >&4
+$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+# include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#$i_pthread I_PTHREAD
+#ifdef I_PTHREAD
+# include <pthread.h>
+#endif
+
+void *
+thread_start(void * arg)
+{
+ (void *) getenv("HOME");
+}
+
+int main() {
+ char * main_buffer;
+ char save_main_buffer[1000];
+ pthread_t subthread;
+ pthread_attr_t attr;
+
+ main_buffer = getenv("PATH");
+
+ /* If too large for our generous allowance, return we couldn't figure it
+ * out. */
+ if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
+ exit(2);
+ }
+
+ strcpy(save_main_buffer, main_buffer);
+
+ if (pthread_attr_init(&attr) != 0) {
+ exit(2);
+ }
+
+ if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
+ exit(2);
+ }
+
+ if (pthread_join(subthread, NULL) != 0) {
+ exit(2);
+ }
+
+ exit(! strcmp(main_buffer, save_main_buffer) == 0);
+}
+EOCP
+val=
+set try
+if eval $compile_ok; then
+ $run ./try
+ rc=$?
+ case "$rc" in
+ 0) echo "getenv() didn't destroy another thread's buffer" >&4
+ val=$define
+ ;;
+ 1) echo "getenv() does destroy another thread's buffer" >&4
+ val=$undef
+ ;;
+ *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
+ val=$undef
+ ;;
+ esac
+else
+ echo "(I can't seem to compile the test program.)" >&4
+ echo "Assuming that your C library's getenv destroys another thread's return value." >&4
+ val=$undef
+fi
+set d_getenv_preserves_other_thread
+eval $setvar
+$rm_try
+;;
+esac
+
: see if getespwnam exists
set getespwnam d_getespwnam
eval $inlibc
d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
d_getaddrinfo='$d_getaddrinfo'
d_getcwd='$d_getcwd'
+d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
d_getespwnam='$d_getespwnam'
d_getfsstat='$d_getfsstat'
d_getgrent='$d_getgrent'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='define'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='define'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='undef'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='define'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='define'
#$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.
$ vms_cc_type="decc"
$ ENDIF
$ d_faststdio="define"
+$ d_getenv_preserves_other_thread="define"
$ d_locconv="define"
$ d_mblen="define"
$ d_mbstowcs="define"
$ WC "d_nexttoward='" + d_nexttoward + "'"
$ WC "d_nice='define'"
$ WC "d_nl_langinfo='" + d_nl_langinfo + "'"
+$ WC "d_getenv_preserves_other_thread='" + d_getenv_preserves_other_thread + "'"
$ WC "d_nv_preserves_uv='" + d_nv_preserves_uv + "'"
$ WC "nv_overflows_integers_at='" + nv_overflows_integers_at + "'"
$ WC "nv_preserves_uv_bits='" + nv_preserves_uv_bits + "'"
* they should be removed from here.
*
* HAS_WCRTOMB
+ * GETENV_PRESERVES_OTHER_THREAD
+ *
*/
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='define'
/*#define HAS_ENDSERVENT_R / **/
#define ENDSERVENT_R_PROTO 0 /**/
+/* 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.
+ */
+#define GETENV_PRESERVES_OTHER_THREAD /**/
+
/* HAS_GETGRENT_R:
* This symbol, if defined, indicates that the getgrent_r routine
* is available to getgrent re-entrantly.
#endif
/* Generated from:
- * 404722487cbb4753192fd5c9d2e186551220f35fef1347ce39d942abaa90cbf4 config_h.SH
- * 4c3159a6a9875b7811c2a920d7936d5199193afdb163473c313b9531ba2c0648 uconfig.sh
+ * 53ec858c462f9fa2669095834b3d350458c955777a07a0ad7a3a73162ff8ef0e config_h.SH
+ * b53784d20c0f250807f47a3130cdc8e01a92da948e6747af87ebc24f11904722 uconfig.sh
* ex: set ro: */
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='undef'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='undef'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='undef'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='undef'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='undef'
d_gdbmndbm_h_uses_prototypes='undef'
d_getaddrinfo='undef'
d_getcwd='define'
+d_getenv_preserves_other_thread='define'
d_getespwnam='undef'
d_getfsstat='undef'
d_getgrent='undef'