All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 3/6] ip: rearrange and prune header files
Date: Thu, 12 Dec 2024 14:24:28 -0800	[thread overview]
Message-ID: <20241212222549.43749-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20241212222549.43749-1-stephen@networkplumber.org>

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@networkplumber.org>
---
 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


  parent reply	other threads:[~2024-12-12 22:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 22:24 [PATCH iproute2 0/6] include file changes for musl libc Stephen Hemminger
2024-12-12 22:24 ` [PATCH iproute2 1/6] libnetlink: add missing endian.h Stephen Hemminger
2024-12-12 22:24 ` [PATCH iproute2 2/6] rdma: add missing header for basename Stephen Hemminger
2024-12-12 22:24 ` Stephen Hemminger [this message]
2024-12-12 22:24 ` [PATCH iproute2 4/6] cg_map: use limits.h Stephen Hemminger
2024-12-12 22:24 ` [PATCH iproute2 5/6] flower: replace XATTR_SIZE_MAX Stephen Hemminger
2024-12-12 22:24 ` [PATCH iproute2 6/6] uapi: remove no longer used linux/limits.h Stephen Hemminger
2024-12-13 19:20 ` [PATCH iproute2 0/6] include file changes for musl libc patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241212222549.43749-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.