| extern int delete_module(const char *, unsigned int); |
| int rmmod_main(int argc, char **argv) |
| /* make sure we've got an argument */ |
| fprintf(stderr, "usage: rmmod <module>\n"); |
| /* if given /foo/bar/blah.ko, make a weak attempt |
| * to convert to "blah", just for convenience |
| modname = strrchr(argv[1], '/'); |
| dot = strchr(argv[1], '.'); |
| /* Replace "-" with "_". This would keep rmmod |
| * compatible with module-init-tools version of |
| for (i = 0; modname[i] != '\0'; i++) { |
| /* pass it to the kernel */ |
| ret = delete_module(modname, O_NONBLOCK | O_EXCL); |
| fprintf(stderr, "rmmod: delete_module '%s' failed (errno %d)\n", |