Mats Erik Andersson <[email protected]> writes:
> tisdag den 28 september 2010 klockan 23:50 skrev Simon Josefsson detta:
>> Mats Erik Andersson <[email protected]> writes:
>>
>> > My other suggested patching of the TFTP client presently adds
>> >
>> > NI_MAXSERV
>> > struct addrinfo
>> > getaddrinfo(3)
>> > gai_strerror(3)
>> > freeaddrinfo(3)
>> > strrchr(3)
>> >
>> > All these are fulfilled by any decent OS as far as I understand.
>>
>> And if they aren't, gnulib fixes that for us.
>>
>> However, why do you need NI_MAXSERV? I can't find it in POSIX nor in
>> the Glibc manual. I'm not sure it is portable.
>
> See getnameinfo(3). The constant ought to be present in <netdb.h>
> for every decent OS.
Interesting, it is documented in RFC 2133/2553/4038 and from the man
page it appears to be intended as a GNU-extension, but it is not
mentioned in POSIX or the Glibc manual. I wonder how portable it is?
An old Solaris host I looked at had it. Maybe something for the Austin
group...
NOTES
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 one of the fea‐
ture test macros _BSD_SOURCE, _SVID_SOURCE, or _GNU_SOURCE is defined.
The former is the constant MAXDNAME in recent versions of BIND's
<arpa/nameser.h> header file. The latter is a guess based on the ser‐
vices listed in the current Assigned Numbers RFC.
/Simon