diff --git a/port/unix/omrsock.c b/port/unix/omrsock.c index c710371c06c..c34ca6c9a99 100644 --- a/port/unix/omrsock.c +++ b/port/unix/omrsock.c @@ -82,25 +82,50 @@ omrsock_getaddrinfo(struct OMRPortLibrary *portLibrary, char *node, char *servic int32_t omrsock_getaddrinfo_length(struct OMRPortLibrary *portLibrary, omrsock_addrinfo_t handle, uint32_t *length) { - return OMRPORT_ERROR_NOT_SUPPORTED_ON_THIS_PLATFORM; + *length = handle->length; + return 0; } int32_t omrsock_getaddrinfo_family(struct OMRPortLibrary *portLibrary, omrsock_addrinfo_t handle, int32_t *family, int32_t index) { - return OMRPORT_ERROR_NOT_SUPPORTED_ON_THIS_PLATFORM; + omr_os_addrinfo *info = handle->addrInfo; + int32_t i = 0; + + for(i = 0; i < index; i++) { + info = info->ai_next; + } + + *family = info->ai_family; + return 0; } int32_t omrsock_getaddrinfo_socktype(struct OMRPortLibrary *portLibrary, omrsock_addrinfo_t handle, int32_t *socktype, int32_t index) { - return OMRPORT_ERROR_NOT_SUPPORTED_ON_THIS_PLATFORM; + omr_os_addrinfo *info = handle->addrInfo; + int32_t i = 0; + + for(i = 0; i < index; i++) { + info = info->ai_next; + } + + *socktype = info->ai_socktype; + return 0; } int32_t omrsock_getaddrinfo_protocol(struct OMRPortLibrary *portLibrary, omrsock_addrinfo_t handle, int32_t *protocol, int32_t index) { - return OMRPORT_ERROR_NOT_SUPPORTED_ON_THIS_PLATFORM; + omr_os_addrinfo *info = handle->addrInfo; + int32_t i = 0; + + for(i = 0; i < index; i++) { + info = info->ai_next; + } + + *protocol = info->ai_protocol; + return 0; } int32_t