diff options
-rw-r--r-- | Kernel/API/POSIX/ifaddrs.h | 30 | ||||
-rw-r--r-- | Userland/Libraries/LibC/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibC/ifaddrs.cpp | 18 | ||||
-rw-r--r-- | Userland/Libraries/LibC/ifaddrs.h | 17 |
4 files changed, 66 insertions, 0 deletions
diff --git a/Kernel/API/POSIX/ifaddrs.h b/Kernel/API/POSIX/ifaddrs.h new file mode 100644 index 0000000000..f17fee8120 --- /dev/null +++ b/Kernel/API/POSIX/ifaddrs.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> + * + * 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 6281610b51..40cc58fde7 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 0000000000..a42345a6e4 --- /dev/null +++ b/Userland/Libraries/LibC/ifaddrs.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibC/errno.h> +#include <LibC/ifaddrs.h> + +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 0000000000..7a10dd5e5d --- /dev/null +++ b/Userland/Libraries/LibC/ifaddrs.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <Kernel/API/POSIX/ifaddrs.h> +#include <sys/cdefs.h> + +__BEGIN_DECLS + +int getifaddrs(struct ifaddrs** ifap); +void freeifaddrs(struct ifaddrs* ifa); + +__END_DECLS |