From 2318be71e96021613b1077acca66bba4fce0a71c Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Fri, 25 Jan 2019 10:36:58 -0500 Subject: Don't use gethostbyname_r on AIX Patch adapated from Bull's R15 SRPM. --- lib/erl_interface/src/connect/ei_resolve.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/erl_interface/src') diff --git a/lib/erl_interface/src/connect/ei_resolve.c b/lib/erl_interface/src/connect/ei_resolve.c index 225fddc784..5a8ca0c567 100644 --- a/lib/erl_interface/src/connect/ei_resolve.c +++ b/lib/erl_interface/src/connect/ei_resolve.c @@ -55,6 +55,16 @@ #include "ei_resolve.h" #include "ei_locking.h" +/* AIX has a totally different signature (allegedly shared with some other + * Unices) that isn't compatible. It turns out that the _r version isn't + * thread-safe according to curl - but bizarrely, since AIX 4.3, libc + * is thread-safe in a manner that makes the normal gethostbyname OK + * for re-entrant use. + */ +#ifdef _AIX +#undef HAVE_GETHOSTBYNAME_R +#endif + #ifdef HAVE_GETHOSTBYNAME_R int ei_init_resolve(void) @@ -75,7 +85,7 @@ int ei_init_resolve(void) static ei_mutex_t *ei_gethost_sem = NULL; #endif /* _REENTRANT */ static int ei_resolve_initialized = 0; -#ifndef __WIN32__ +#if !defined(__WIN32__) && !defined(_AIX) int h_errno; #endif -- cgit v1.2.3 From 8a0c0ae7defd1e9f5d41a88de8c3dc8a544a7c73 Mon Sep 17 00:00:00 2001 From: Calvin Date: Thu, 21 Mar 2019 08:29:08 -0400 Subject: fix names conflicting with AIX system names quick and dirty renaming. the reason why is because AIX has some network function names prefixed with "n" for spec compliant versions, and the unprefixed versions are just redfined or are wrappers. as such, rename the erts/ei functions with these names. fixes compile on IBM i 7.3 --- lib/erl_interface/src/misc/ei_portio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/erl_interface/src') diff --git a/lib/erl_interface/src/misc/ei_portio.c b/lib/erl_interface/src/misc/ei_portio.c index bccc86c1b1..caa3d270a8 100644 --- a/lib/erl_interface/src/misc/ei_portio.c +++ b/lib/erl_interface/src/misc/ei_portio.c @@ -622,7 +622,7 @@ int ei_accept_ctx_t__(ei_socket_callbacks *cbs, void **ctx, } while (error == EINTR); } do { - error = cbs->accept(ctx, addr, len, ms); + error = cbs->accept_ei(ctx, addr, len, ms); } while (error == EINTR); return error; } -- cgit v1.2.3 From e414c818360911ab759cef6a08b3ed133f3208ae Mon Sep 17 00:00:00 2001 From: Calvin Date: Wed, 29 May 2019 07:43:26 -0400 Subject: Attempt at fixing AIX while keeping API compatibility erl_interface has a function in a struct, and AIX headers, when you use C instead of C++, pollute the global namespace with definitions that override socket functions, and end up clobbering names of things Erlang/OTP uses. The new socket interface of R22 was one of the victims. I had previously tied to fix it for erl_interface, but the change broke API public surface. What this does is replace the name with a define, that defines to the same name on non-AIX, but uses a "mangled" name on AIX instead. This means internal uses of this function in the struct need to use the preprocessor define instead of the "normal" name, and likewise external users too, but those can be dealt with one-at-a-time on AIX instead of breaking everyone else. --- lib/erl_interface/src/misc/ei_portio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/erl_interface/src') diff --git a/lib/erl_interface/src/misc/ei_portio.c b/lib/erl_interface/src/misc/ei_portio.c index caa3d270a8..bfe67a732c 100644 --- a/lib/erl_interface/src/misc/ei_portio.c +++ b/lib/erl_interface/src/misc/ei_portio.c @@ -622,7 +622,7 @@ int ei_accept_ctx_t__(ei_socket_callbacks *cbs, void **ctx, } while (error == EINTR); } do { - error = cbs->accept_ei(ctx, addr, len, ms); + error = cbs->EI_ACCEPT_NAME(ctx, addr, len, ms); } while (error == EINTR); return error; } -- cgit v1.2.3