[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/LWIP PATCH] Stub getservbyport_r()
Building lwip breaks when nolibc is selected. getservbyport_r() was relying on definitions which aren't available with nolibc. This commit stubs this function because it seems that it wasn't used and tested so far. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- serv.c | 53 +++++------------------------------------------------ 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/serv.c b/serv.c index b08ffa4..80ae036 100644 --- a/serv.c +++ b/serv.c @@ -51,53 +51,10 @@ struct servent *getservbyport(int port __unused, return NULL; } -int getservbyport_r(int port, const char *prots, struct servent *se, char *buf, size_t buflen, struct servent **res) +int getservbyport_r(int port __unused, const char *prots __unused, + struct servent *se __unused, char *buf __unused, + size_t buflen __unused, struct servent **res __unused) { - int i; - struct sockaddr_in sin = { - .sin_family = AF_INET, - .sin_port = port, - }; - - if (!prots) { - int r = getservbyport_r(port, "tcp", se, buf, buflen, res); - if (r) r = getservbyport_r(port, "udp", se, buf, buflen, res); - return r; - } - *res = 0; - - /* Align buffer */ - i = (uintptr_t)buf & (sizeof(char *)-1); - if (!i) i = sizeof(char *); - if (buflen < 3*sizeof(char *)-i) - return ERANGE; - buf += sizeof(char *)-i; - buflen -= sizeof(char *)-i; - - if (strcmp(prots, "tcp") && strcmp(prots, "udp")) return EINVAL; - - se->s_port = port; - se->s_proto = (char *)prots; - se->s_aliases = (void *)buf; - buf += 2*sizeof(char *); - buflen -= 2*sizeof(char *); - se->s_aliases[1] = 0; - se->s_aliases[0] = se->s_name = buf; - - switch (getnameinfo((void *)&sin, sizeof sin, 0, 0, buf, buflen, - strcmp(prots, "udp") ? 0 : NI_DGRAM)) { - case EAI_MEMORY: - case EAI_SYSTEM: - return ENOMEM; - default: - return ENOENT; - case 0: - break; - } - - /* A numeric port string is not a service record. */ - if (strtol(buf, 0, 10)==ntohs(port)) return ENOENT; - - *res = se; - return 0; + errno = ENOSYS; + return EAI_SYSTEM; } -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |