On m=E5n, 2007-04-23 at 12:11 +0100, Dave Shield wrote:
> On 21/04/07, Magnus Fromreide wrote:
> > How comes that dlmod uses deinit_foo to deregister snmp module foo on
> > unload but the master agent uses shutdown_foo?

> =

> Hysterical raisins.
> Both of these date a long way back, so it's unlikely that any of us
> can remember the reasoning involved.

Oh dear, just as usual then.

> I suspect that shutdown_xxx support was probably added before
> the development team had recognised the similarities with the
> dlmod handling (which was a third-party-provided patch).
> And by the time the difference became apparent, it was too
> late to do anything about it.

Thanks for the explanation - it do make sense.

> > Which one should I put in my mib modules?
> >
> > Is this a reasonable deinit_foo?
> >
> > void deinit_foo() { shutdown_foo(); }

> =

> Yes - that seems sensible to me.
> shutdown is probably the more important,
> but this sort of double-wrapping should be OK.

I have another thought - would it be reasonable to change the dlmod code
to do something along the lines of this pseudocode:

if deinit_xxx found
call deinit_xxx
else if shutdown_xxx found
call shutdown_xxx
issue a warning

If we wish we could add a deprecation warning to the deinit_xxx code
path as well in order to make people move away from deinit_xxx.

The warning in the final else branch is due to the fact that we probably
leaked some memory since the module wasn't properly cleaned up.


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Net-snmp-coders mailing list