1570af302Sopenharmony_ci#define _GNU_SOURCE 2570af302Sopenharmony_ci#include <netdb.h> 3570af302Sopenharmony_ci 4570af302Sopenharmony_cistruct servent *getservbyname(const char *name, const char *prots) 5570af302Sopenharmony_ci{ 6570af302Sopenharmony_ci static struct servent se; 7570af302Sopenharmony_ci static char *buf[2]; 8570af302Sopenharmony_ci struct servent *res; 9570af302Sopenharmony_ci if (getservbyname_r(name, prots, &se, (void *)buf, sizeof buf, &res)) 10570af302Sopenharmony_ci return 0; 11570af302Sopenharmony_ci return &se; 12570af302Sopenharmony_ci} 13