From 3b21c18439e40768ea743e2c867115da441350d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Sat, 21 Jun 2025 11:27:55 +0200 Subject: [PATCH] feat: stub net/if.h --- newlib/libc/sys/hermit/Makefile.inc | 1 + newlib/libc/sys/hermit/include/net/if.h | 22 ++++++++++++++++++++++ newlib/libc/sys/hermit/net_if.c | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 newlib/libc/sys/hermit/include/net/if.h create mode 100644 newlib/libc/sys/hermit/net_if.c diff --git a/newlib/libc/sys/hermit/Makefile.inc b/newlib/libc/sys/hermit/Makefile.inc index 36425fa5b..b2c0e6855 100644 --- a/newlib/libc/sys/hermit/Makefile.inc +++ b/newlib/libc/sys/hermit/Makefile.inc @@ -13,6 +13,7 @@ libc_a_SOURCES += \ %D%/ioctl.c \ %D%/makecontext.c \ %D%/mman.c \ + %D%/net_if.c \ %D%/netdb.c \ %D%/netinet_in.c \ %D%/pwd.c \ diff --git a/newlib/libc/sys/hermit/include/net/if.h b/newlib/libc/sys/hermit/include/net/if.h new file mode 100644 index 000000000..e339aacba --- /dev/null +++ b/newlib/libc/sys/hermit/include/net/if.h @@ -0,0 +1,22 @@ +#ifndef _NET_IF_H +#define _NET_IF_H + +#include + +__BEGIN_DECLS + +struct if_nameindex { + unsigned if_index; + char *if_name; +}; + +#define IF_NAMESIZE 16 + +void if_freenameindex(struct if_nameindex *ptr); +char *if_indextoname(unsigned ifindex, char *ifname); +struct if_nameindex *if_nameindex(void); +unsigned if_nametoindex(const char *ifname); + +__END_DECLS + +#endif /* _NET_IF_H */ diff --git a/newlib/libc/sys/hermit/net_if.c b/newlib/libc/sys/hermit/net_if.c new file mode 100644 index 000000000..f1ca06950 --- /dev/null +++ b/newlib/libc/sys/hermit/net_if.c @@ -0,0 +1,18 @@ +#include +#include + +void if_freenameindex(struct if_nameindex *ptr) {} + +char *if_indextoname(unsigned ifindex, char *ifname) { + errno = ENXIO; + return NULL; +} + +struct if_nameindex *if_nameindex(void) { + errno = ENOSYS; + return NULL; +} + +unsigned if_nametoindex(const char *ifname) { + return 0; +}