Commit 9ca9e077 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Jukka Rissanen
Browse files

net: socket: Define NI_MAXHOST for compatibility



Not in POSIX. Linux man getnameinfo says about it:

"In order to assist the programmer in choosing reasonable sizes for
the supplied buffers, <netdb.h> defines the constants

           #define NI_MAXHOST      1025
           #define NI_MAXSERV      32

Since glibc 2.8, these definitions are exposed only if suitable
feature test macros are defined, namely: _GNU_SOURCE, _DEFAULT_SOURCE
(since glibc 2.19), or (in glibc versions up to and including 2.19)
_BSD_SOURCE or _SVID_SOURCE."

Signed-off-by: default avatarPaul Sokolovsky <paul.sokolovsky@linaro.org>
parent bc618657
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -498,6 +498,13 @@ const char *zsock_gai_strerror(int errcode);
/** zsock_getnameinfo(): Dummy option for compatibility */
#define NI_DGRAM 16

/* POSIX extensions */

/** zsock_getnameinfo(): Max supported hostname length */
#ifndef NI_MAXHOST
#define NI_MAXHOST 64
#endif

/**
 * @brief Resolve a network address to a domain name or ASCII address
 *