aboutsummaryrefslogtreecommitdiff
path: root/toys/lsmod.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-08-25 14:25:22 -0500
committerRob Landley <rob@landley.net>2012-08-25 14:25:22 -0500
commit3a9241add947cb6d24b5de7a8927517426a78795 (patch)
treed122ab6570439cd6b17c7d73ed8d4e085e0b8a95 /toys/lsmod.c
parent689f095bc976417bf50810fe59a3b3ac32b21105 (diff)
downloadtoybox-3a9241add947cb6d24b5de7a8927517426a78795.tar.gz
Move commands into "posix", "lsb", and "other" menus/directories.
Diffstat (limited to 'toys/lsmod.c')
-rw-r--r--toys/lsmod.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/toys/lsmod.c b/toys/lsmod.c
deleted file mode 100644
index 82dbb589..00000000
--- a/toys/lsmod.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* vi: set sw=4 ts=4:
- *
- * lsmod.c - Show the status of modules in the kernel
- *
- * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
- *
- * Not in SUSv4.
-
-USE_LSMOD(NEWTOY(lsmod, NULL, TOYFLAG_BIN))
-
-config LSMOD
- bool "lsmod"
- default y
- help
- usage: lsmod
-
- Display the currently loaded modules, their sizes and their
- dependencies.
-*/
-
-#include "toys.h"
-
-void lsmod_main(void)
-{
- char *modfile = "/proc/modules";
- FILE * file = xfopen(modfile, "r");
-
- xprintf("%-23s Size Used by\n", "Module");
-
- while (fgets(toybuf, sizeof(toybuf), file)) {
- char *name = strtok(toybuf, " "), *size = strtok(NULL, " "),
- *refcnt = strtok(NULL, " "), *users = strtok(NULL, " ");
-
- if(users) {
- int len = strlen(users)-1;
- if (users[len] == ',' || users[len] == '-')
- users[len] = 0;
- xprintf("%-19s %8s %s %s\n", name, size, refcnt, users);
- } else perror_exit("bad %s", modfile);
- }
- fclose(file);
-}