summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-12-05 02:09:47 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-22 00:02:36 -0800
commit7b24fc6fb891294da4d54294fc6bccee7262992c (patch)
tree6cf58e52f27c8967bedd0e08ea94c33a6cb4af48
parent468ae105d87ff7f381565958444030a4f55729fc (diff)
downloadserenity-7b24fc6fb891294da4d54294fc6bccee7262992c.zip
Kernel+LibC: Stub out getifaddrs() and freeifaddrs()
These are required for some ports.
-rw-r--r--Kernel/API/POSIX/ifaddrs.h30
-rw-r--r--Userland/Libraries/LibC/CMakeLists.txt1
-rw-r--r--Userland/Libraries/LibC/ifaddrs.cpp18
-rw-r--r--Userland/Libraries/LibC/ifaddrs.h17
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