8000 feat: stub net/if.h by mkroening · Pull Request #155 · hermit-os/newlib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: stub net/if.h #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newlib/libc/sys/hermit/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
22 changes: 22 additions & 0 deletions newlib/libc/sys/hermit/include/net/if.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef _NET_IF_H
#define _NET_IF_H

#include <sys/cdefs.h>

__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 */
18 changes: 18 additions & 0 deletions newlib/libc/sys/hermit/net_if.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <errno.h>
#include <net/if.h>

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;
}
0