[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241210214408.85761-1-stephen@networkplumber.org>
Date: Tue, 10 Dec 2024 13:43:32 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [RFC iproute2] ip: rearrange and prune header files
The recent report of issues with missing limits.h impacting musl
suggested looking at what files are and are not included in ip code.
The standard practice is to put standard headers first, then system,
then local headers. Used iwyu to get suggestions about missing
and extraneous headers.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
Marked as RFC since still needs checking with musl.
ip/iplink.c | 13 +++++--------
ip/ipnetns.c | 19 +++++++++----------
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index aa2332fc..59e8caf4 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -11,17 +11,14 @@
#include <fcntl.h>
#include <dlfcn.h>
#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <limits.h>
+
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <linux/if.h>
-#include <linux/if_packet.h>
#include <linux/if_ether.h>
-#include <linux/sockios.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <stdbool.h>
-#include <linux/mpls.h>
#include "rt_names.h"
#include "utils.h"
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 5c943400..a20cd8bc 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -1,21 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#define _ATFILE_SOURCE
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/inotify.h>
-#include <sys/mount.h>
-#include <sys/syscall.h>
+
#include <stdio.h>
+#include <stdint.h>
#include <string.h>
-#include <sched.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
-#include <linux/limits.h>
+#include <limits.h>
+
+#include <sys/file.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/inotify.h>
+#include <sys/mount.h>
#include <linux/net_namespace.h>
@@ -23,7 +23,6 @@
#include "list.h"
#include "ip_common.h"
#include "namespace.h"
-#include "json_print.h"
static int usage(void)
{
--
2.45.2
Powered by blists - more mailing lists