Skip to content
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)

Signed-off-by: Paul Sokolovsky <>
  • Loading branch information...
pfalcon authored and jukkar committed May 7, 2019
1 parent bc61865 commit 9ca9e077aa4a5b944c43c9f2d97a0251c4c9bc7f
Showing with 7 additions and 0 deletions.
  1. +7 −0 include/net/socket.h
@@ -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

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

0 comments on commit 9ca9e07

Please sign in to comment.
You can’t perform that action at this time.