LibC: Add definition for the NI_NAMEREQD macro

This commit is contained in:
Gunnar Beutner 2021-04-14 04:31:20 +02:00 committed by Andreas Kling
parent ea6d0aa1d4
commit 7d12c08bec
Notes: sideshowbarker 2024-07-18 20:23:22 +09:00
2 changed files with 4 additions and 2 deletions

View file

@ -794,14 +794,15 @@ const char* gai_strerror(int errcode)
int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char* __restrict host, socklen_t hostlen, char* __restrict serv, socklen_t servlen, int flags)
{
(void)flags;
if (addr->sa_family != AF_INET || addrlen < sizeof(sockaddr_in))
return EAI_FAMILY;
const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(addr);
if (host && hostlen > 0) {
if (flags & NI_NAMEREQD)
dbgln("getnameinfo flag NI_NAMEREQD not implemented");
if (!inet_ntop(AF_INET, &sin->sin_addr, host, hostlen)) {
if (errno == ENOSPC)
return EAI_OVERFLOW;

View file

@ -112,6 +112,7 @@ struct addrinfo {
#define NI_NUMERICHOST 1
#define NI_NUMERICSERV 2
#define NI_NAMEREQD 3
int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res);
void freeaddrinfo(struct addrinfo* res);