Enable net_get_interfaces on IBM i PASE

On IBM i, getifaddrs is available renamed as Qp2getifaddrs; freeifaddrs
and struct ifaddr follow a similar fate. I assume this is in case AIX
decides to add it (as if). As such, just use the same implementation,
but rename the standard ones to the IBM i definitions and include its
header.
This commit is contained in:
Calvin Buckley 2021-06-10 17:12:13 -03:00 committed by Joe Watkins
parent 21f2ff79de
commit 4f51a11a84
No known key found for this signature in database
GPG key ID: F9BA0ADA31CBD89E
2 changed files with 10 additions and 1 deletions

View file

@ -429,7 +429,9 @@ function getmxrr(string $hostname, &$hosts, &$weights = null): bool {}
/* net.c */
#if defined(PHP_WIN32) || HAVE_GETIFADDRS
function net_get_interfaces(): array|false {}
#endif
/* ftok.c */

View file

@ -27,6 +27,13 @@
#if HAVE_GETIFADDRS
# include <ifaddrs.h>
#elif defined(__PASE__)
/* IBM i implements getifaddrs, but under its own name */
#include <as400_protos.h>
#define getifaddrs Qp2getifaddrs
#define freeifaddrs Qp2freeifaddrs
#define ifaddrs ifaddrs_pase
#define HAVE_GETIFADDRS
#endif
#ifdef PHP_WIN32
@ -126,7 +133,6 @@ static void iface_append_unicast(zval *unicast, zend_long flags,
add_next_index_zval(unicast, &u);
}
#endif
/* {{{ Returns an array in the form:
array(
@ -304,4 +310,5 @@ PHP_FUNCTION(net_get_interfaces) {
ZEND_UNREACHABLE();
#endif
}
#endif
/* }}} */