From: Phil Sutter Date: Fri, 2 Dec 2016 10:39:52 +0000 (+0100) Subject: ss: Turn generic_proc_open() wrappers into macros X-Git-Tag: v4.10.0~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cb74a8610239a37738b0be7a93b27786f4f9e45;p=thirdparty%2Fiproute2.git ss: Turn generic_proc_open() wrappers into macros Signed-off-by: Phil Sutter --- diff --git a/misc/ss.c b/misc/ss.c index 54b82cc82..2e18be203 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -327,76 +327,25 @@ static FILE *generic_proc_open(const char *env, const char *name) return fopen(p, "r"); } - -static FILE *net_tcp_open(void) -{ - return generic_proc_open("PROC_NET_TCP", "net/tcp"); -} - -static FILE *net_tcp6_open(void) -{ - return generic_proc_open("PROC_NET_TCP6", "net/tcp6"); -} - -static FILE *net_udp_open(void) -{ - return generic_proc_open("PROC_NET_UDP", "net/udp"); -} - -static FILE *net_udp6_open(void) -{ - return generic_proc_open("PROC_NET_UDP6", "net/udp6"); -} - -static FILE *net_raw_open(void) -{ - return generic_proc_open("PROC_NET_RAW", "net/raw"); -} - -static FILE *net_raw6_open(void) -{ - return generic_proc_open("PROC_NET_RAW6", "net/raw6"); -} - -static FILE *net_unix_open(void) -{ - return generic_proc_open("PROC_NET_UNIX", "net/unix"); -} - -static FILE *net_packet_open(void) -{ - return generic_proc_open("PROC_NET_PACKET", "net/packet"); -} - -static FILE *net_netlink_open(void) -{ - return generic_proc_open("PROC_NET_NETLINK", "net/netlink"); -} - -static FILE *slabinfo_open(void) -{ - return generic_proc_open("PROC_SLABINFO", "slabinfo"); -} - -static FILE *net_sockstat_open(void) -{ - return generic_proc_open("PROC_NET_SOCKSTAT", "net/sockstat"); -} - -static FILE *net_sockstat6_open(void) -{ - return generic_proc_open("PROC_NET_SOCKSTAT6", "net/sockstat6"); -} - -static FILE *net_snmp_open(void) -{ - return generic_proc_open("PROC_NET_SNMP", "net/snmp"); -} - -static FILE *ephemeral_ports_open(void) -{ - return generic_proc_open("PROC_IP_LOCAL_PORT_RANGE", "sys/net/ipv4/ip_local_port_range"); -} +#define net_tcp_open() generic_proc_open("PROC_NET_TCP", "net/tcp") +#define net_tcp6_open() generic_proc_open("PROC_NET_TCP6", "net/tcp6") +#define net_udp_open() generic_proc_open("PROC_NET_UDP", "net/udp") +#define net_udp6_open() generic_proc_open("PROC_NET_UDP6", "net/udp6") +#define net_raw_open() generic_proc_open("PROC_NET_RAW", "net/raw") +#define net_raw6_open() generic_proc_open("PROC_NET_RAW6", "net/raw6") +#define net_unix_open() generic_proc_open("PROC_NET_UNIX", "net/unix") +#define net_packet_open() generic_proc_open("PROC_NET_PACKET", \ + "net/packet") +#define net_netlink_open() generic_proc_open("PROC_NET_NETLINK", \ + "net/netlink") +#define slabinfo_open() generic_proc_open("PROC_SLABINFO", "slabinfo") +#define net_sockstat_open() generic_proc_open("PROC_NET_SOCKSTAT", \ + "net/sockstat") +#define net_sockstat6_open() generic_proc_open("PROC_NET_SOCKSTAT6", \ + "net/sockstat6") +#define net_snmp_open() generic_proc_open("PROC_NET_SNMP", "net/snmp") +#define ephemeral_ports_open() generic_proc_open("PROC_IP_LOCAL_PORT_RANGE", \ + "sys/net/ipv4/ip_local_port_range") struct user_ent { struct user_ent *next;