diff --git a/Kernel/API/POSIX/ifaddrs.h b/Kernel/API/POSIX/ifaddrs.h new file mode 100644 index 00000000000000..f17fee81200796 --- /dev/null +++ b/Kernel/API/POSIX/ifaddrs.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021, Idan Horowitz + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +struct ifaddrs { + struct ifaddrs* ifa_next; + char* ifa_name; + unsigned int ifa_flags; + struct sockaddr* ifa_addr; + struct sockaddr* ifa_netmask; + union { + struct sockaddr* ifu_broadaddr; + struct sockaddr* ifu_dstaddr; + } ifa_ifu; +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + void* ifa_data; +}; + +#ifdef __cplusplus +} +#endif diff --git a/Userland/Libraries/LibC/CMakeLists.txt b/Userland/Libraries/LibC/CMakeLists.txt index 6281610b51aa76..40cc58fde78847 100644 --- a/Userland/Libraries/LibC/CMakeLists.txt +++ b/Userland/Libraries/LibC/CMakeLists.txt @@ -8,6 +8,7 @@ set(LIBC_SOURCES fcntl.cpp fenv.cpp fnmatch.cpp + ifaddrs.cpp getopt.cpp grp.cpp inttypes.cpp diff --git a/Userland/Libraries/LibC/ifaddrs.cpp b/Userland/Libraries/LibC/ifaddrs.cpp new file mode 100644 index 00000000000000..a42345a6e43a20 --- /dev/null +++ b/Userland/Libraries/LibC/ifaddrs.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2021, Idan Horowitz + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +int getifaddrs(struct ifaddrs**) +{ + errno = ENOSYS; + return -1; +} + +void freeifaddrs(struct ifaddrs*) +{ +} diff --git a/Userland/Libraries/LibC/ifaddrs.h b/Userland/Libraries/LibC/ifaddrs.h new file mode 100644 index 00000000000000..7a10dd5e5d31aa --- /dev/null +++ b/Userland/Libraries/LibC/ifaddrs.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021, Idan Horowitz + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +__BEGIN_DECLS + +int getifaddrs(struct ifaddrs** ifap); +void freeifaddrs(struct ifaddrs* ifa); + +__END_DECLS