[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 3/3] Implement gethostname
Hi, This patch was superseeded by '[UNIKRAFT/LWIP PATCH v2] Provide gethostbyname and gethostbyname_r' which was sent by Mihai. Cheers, Costin On 6/11/19 10:59 AM, Felipe Huici wrote: > Hi, > > Looks good, thanks. > > — Felipe > > Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx> > > On 11.06.19, 08:32, "Vlad-Andrei BĂDOIU (78692)" > <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> wrote: > > Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> > --- > network.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/network.c b/network.c > index 5d7823b..3a57b19 100644 > --- a/network.c > +++ b/network.c > @@ -1,9 +1,22 @@ > #include <string.h> > #include <unistd.h> > #include <netdb.h> > +#include <errno.h> > +#include <sys/utsname.h> > > int gethostname(char *name, size_t len) > { > + struct utsname buf; > + size_t node_len; > + > + if (uname(&buf)) > + return -1; > + node_len = strlen(buf.nodename) + 1; > + memcpy(name, buf.nodename, len < node_len ? len : node_len); > + if (node_len > len) { > + errno = ENAMETOOLONG; > + return -1; > + } > return 0; > } > > -- > 2.21.0 > > > > _______________________________________________ > Minios-devel mailing list > Minios-devel@xxxxxxxxxxxxxxxxxxxx > https://lists.xenproject.org/mailman/listinfo/minios-devel > _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |