From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/sysdeps/managarm/generic/net.cpp | 57 ------------------------------ 1 file changed, 57 deletions(-) delete mode 100644 lib/mlibc/sysdeps/managarm/generic/net.cpp (limited to 'lib/mlibc/sysdeps/managarm/generic/net.cpp') diff --git a/lib/mlibc/sysdeps/managarm/generic/net.cpp b/lib/mlibc/sysdeps/managarm/generic/net.cpp deleted file mode 100644 index 63f2d0c..0000000 --- a/lib/mlibc/sysdeps/managarm/generic/net.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include -#include -#include -#include - -namespace mlibc { - -int sys_if_indextoname(unsigned int index, char *name) { - int fd = 0; - int r = sys_socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, AF_UNSPEC, &fd); - - if(r) - return r; - - struct ifreq ifr; - ifr.ifr_ifindex = index; - - int res = 0; - int ret = sys_ioctl(fd, SIOCGIFNAME, &ifr, &res); - close(fd); - - if(ret) { - if(ret == ENODEV) - return ENXIO; - return ret; - } - - strncpy(name, ifr.ifr_name, IF_NAMESIZE); - - return 0; -} - -int sys_if_nametoindex(const char *name, unsigned int *ret) { - int fd = 0; - int r = sys_socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, AF_UNSPEC, &fd); - - if(r) - return r; - - struct ifreq ifr; - strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); - - int res = 0; - r = sys_ioctl(fd, SIOCGIFINDEX, &ifr, &res); - close(fd); - - if(r) - return r; - - *ret = ifr.ifr_ifindex; - - return 0; -} - -} //namespace mlibc -- cgit v1.2.3