RE: syscall from kernel thread?

From: Dunlap, Randy (
Date: Mon May 08 2000 - 10:25:06 EST

If you know or can find the module's name (#2), you can
do #1 via linux/kernel/kmod.c:exec_usermodehelper()
to load & run "/sbin/rmmod module_name". (in 2.3.x)


> -----Original Message-----
> From: Peter T. Breuer []
> Sent: Monday, May 08, 2000 2:52 AM
> To: linux kernel
> Subject: syscall from kernel thread?
> I didn't get any response when I asked about changes designed to help
> a module unload _itself_. I have the code working, but lets see if I
> can phrase a question that would enable me to avoid changing kernel
> interfaces ...
> 1) how can kernel code make use of a syscall? In particular I
> want to call
> sys_delete_module. But module.c only has a userspace interface and is
> linked with asmlinkage, so I've hacked out the code fragments I
> needed. Can I avoid doing this?
> 2) How can init_module get hold of its own name? I changed
> mod->init() to pass struct module *mod as an argument to init, but can
> I avoid this? Is there a call from within init_module that
> would deliver
> the modules registered name? Then I could pass it to delete_module.
> Thanks for any pointers. Incidentally, a module that unloads itself,
> or part of itself, is kinda cute. It works nicely.
> Peter

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:11 EST