Hi, I'm new to Freebsd and interested in system programming. So I'have picked up a task from the project ideas list to start with. (part of) the subject is : "This task is to define and implement a general mechanism for tracking these references and use them in handling module unload requests." So, to do that, I've added an "int dynrefs" in struct module (kern_module.c), and functions to increase or decrease this count (module_add/remove_dynrefs(const char * modname) and module_updatedynrefs(const char * modname, int action) ) in kern_module.c. To avoid unload of a module which has a dynrefs count != 0 , I have modified module_unload(), so that unload is process only if dynrefs=0 or flag=LINKER_UNLOAD_FORCE. module_unload(module_t mod, int flags) { int error; - error = MOD_EVENT(mod, MOD_QUIESCE); + MOD_SLOCK; + (mod->dynrefs == 0) ? (error = MOD_EVENT(mod, MOD_QUIESCE)) : (error = EPERM); + MOD_SUNLOCK; I have compiled and tested. with a 6-2 RELEASE. For the test I'have used two dummy module, one adding a dynrefs on the other. Any comment are welcome David chosrova Fix: Patch attached with submission follows:
Hello, It is quite a long time. What was in fact needed ? Regards. david Chosrova
Responsible Changed From-To: freebsd-bugs->kmacy Need to see if this is something that we in fact want.
Responsible Changed From-To: kmacy->freebsd-bugs kmacy has asked for all of his PRs to be reassigned, put back into the pool. To submitter: I'm afraid that I don't know the status of this idea - it may be worth posting to freebsd-hackers to give your patch a larger audience.
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>