summaryrefslogtreecommitdiffstats
path: root/src/nl-list-sockets.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nl-list-sockets.c')
-rw-r--r--src/nl-list-sockets.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/nl-list-sockets.c b/src/nl-list-sockets.c
index 9a1333c..868006e 100644
--- a/src/nl-list-sockets.c
+++ b/src/nl-list-sockets.c
@@ -6,35 +6,26 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch>
*/
-#include "utils.h"
+#include <netlink/cli/utils.h>
#define PROC_NETLINK "/proc/net/netlink"
-static void print_usage(void)
-{
- fprintf(stderr, "Usage: nl-list-sockets [<file>]\n");
- exit(1);
-}
-
int main(int argc, char *argv[])
{
FILE *fd;
char buf[2048], p[64];
- if (argc > 1 && !strcasecmp(argv[1], "-h"))
- print_usage();
-
fd = fopen(PROC_NETLINK, "r");
if (fd == NULL) {
perror("fopen");
return -1;
}
- printf("Address Family PID Groups rmem wmem " \
- "CB refcnt\n");
+ printf("Address Family PID Groups rmem "
+ "wmem CB refcnt\n");
while (fgets(buf, sizeof(buf), fd)) {
unsigned long sk, cb;
@@ -47,7 +38,7 @@ int main(int argc, char *argv[])
if (ret != 8)
continue;
- printf("0x%08lx %-16s %-6d %08x %-6d %-6d 0x%08lx %d\n",
+ printf("0x%016lx %-16s %-6d %08x %-6d %-6d 0x%08lx %d\n",
sk, nl_nlfamily2str(proto, p, sizeof(p)), pid,
groups, rmem, wmem, cb, refcnt);
}