summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-15 16:07:58 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-15 16:07:58 +0000
commit10bc17b68c7666cd045658934ccb75dd788c8972 (patch)
tree0a97f4e9c6e3aa079acc3ca0c75d94be194c1387 /pp_sys.c
parent6ab308ee9dcbdd9e40dc1aa7ca450e7f854eb8fe (diff)
downloadperl-10bc17b68c7666cd045658934ccb75dd788c8972.tar.gz
Monster _r patch: try to scan for all known _r variants,
and then use them (under ithreads). May fail in HP-UX, and the op/groups is known to be fickle everywhere. Known to work in Solaris, Linux, Tru64, IRIX, AIX. (Some compiler warnings in AIX since the first arguments of getnetbyaddr and getnetbyadd_r are of different types. Thanks, IBM.) In non-Configure platforms deny the existence of any of the _r thingies. (Also add the recently introduced d_tm_* to places it wasn't already in.) TODO: the suggested glibc buffer growth retry loop in case some entries (at least for: gr*, host*) are big. Forgot win32/config.win64. p4raw-id: //depot/perl@15238
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 5955b140b3..b8d7328df1 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -80,7 +80,9 @@ extern int h_errno;
# endif
# endif
# ifdef HAS_GETPWENT
+#ifndef getpwent
struct passwd *getpwent (void);
+#endif
# endif
#endif
@@ -92,7 +94,9 @@ extern int h_errno;
struct group *getgrgid (Gid_t);
# endif
# ifdef HAS_GETGRENT
+#ifndef getgrent
struct group *getgrent (void);
+#endif
# endif
#endif
@@ -4653,8 +4657,14 @@ PP(pp_ghostent)
#endif
#ifdef HOST_NOT_FOUND
- if (!hent)
- STATUS_NATIVE_SET(h_errno);
+ if (!hent) {
+#ifdef USE_REENTRANT_API
+# ifdef USE_GETHOSTENT_ERRNO
+ h_errno = PL_reentrant_buffer->_gethostent_errno;
+# endif
+#endif
+ STATUS_NATIVE_SET(h_errno);
+ }
#endif
if (GIMME != G_ARRAY) {
@@ -4756,6 +4766,17 @@ PP(pp_gnetent)
DIE(aTHX_ PL_no_sock_func, "getnetent");
#endif
+#ifdef HOST_NOT_FOUND
+ if (!nent) {
+#ifdef USE_REENTRANT_API
+# ifdef USE_GETNETENT_ERRNO
+ h_errno = PL_reentrant_buffer->_getnetent_errno;
+# endif
+#endif
+ STATUS_NATIVE_SET(h_errno);
+ }
+#endif
+
EXTEND(SP, 4);
if (GIMME != G_ARRAY) {
PUSHs(sv = sv_newmortal());