DragonFly kernel List (threaded) for 2007-11
DragonFly BSD
DragonFly kernel List (threaded) for 2007-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Kernel panic on module unload


From: Dmitry Komissaroff <dxi@xxxxxxx>
Date: Thu, 08 Nov 2007 10:07:01 +0300

В письме Wed, 07 Nov 2007 09:59:45 -0800, Matthew Dillon
написал:

> 
> :Hi all!
> :
>     If you want to paste the code you are using to register and unregister
>     the protosw/domain structs I can take a look at that.
> 
> 

Code is very simple and I used atm_proto.c as example.
There is:

struct domain btdomain;

const struct protosw btsw[] = {
	{ /* raw HCI commands */
		.pr_type = SOCK_RAW,
		.pr_domain = &btdomain,
		.pr_protocol = BTPROTO_HCI,
		.pr_flags = (PR_ADDR | PR_ATOMIC),
		.pr_input = 0,
		.pr_output = 0,
		.pr_ctlinput = 0,
		.pr_ctloutput = hci_ctloutput,
		.pr_mport = cpu0_soport,
		.pr_init = 0,
		.pr_fasttimo = 0,
		.pr_slowtimo = 0,
		.pr_drain = 0,
		.pr_usrreqs = &hci_usrreqs
	},
};

struct domain btdomain = {
              .dom_family = AF_BLUETOOTH,
              .dom_name = "bluetooth",
              .dom_init = netbt_init,
              .dom_externalize = NULL,
              .dom_dispose = netbt_dispose,
              .dom_protosw = btsw,
              .dom_protoswNPROTOSW = &btsw[sizeof(btsw)/sizeof(btsw[0])],
	       .dom_next = SLIST_ENTRY_INITIALIZER,
              .dom_rtattach = 0,
              .dom_rtoffset = 32,
              .dom_maxrtkey = sizeof(struct sockaddr_bt),
              .dom_ifattach = 0,
              .dom_ifdetach = 0,
};

DOMAIN_SET(bt);

BTW, I dig in kernel srcs and I found in uipc_domain.c this
commant for net_add_domain():

/*                                                                             
 * Add a new protocol domain to the list of supported domains                  
 * Note: you cant unload it again because a socket may be using it.            
 * XXX can't fail at this time.                                                
 */ 

There is no legal way to unload module, which register new protocol. :)




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]