From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 512 invoked from network); 17 Dec 1998 08:19:12 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 17 Dec 1998 08:19:12 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id DAA27953; Thu, 17 Dec 1998 03:07:08 -0500 (EST) Resent-Date: Thu, 17 Dec 1998 03:07:08 -0500 (EST) Date: Thu, 17 Dec 1998 09:05:30 +0100 (MET) Message-Id: <199812170805.JAA05667@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-reply-to: "Bart Schaefer"'s message of Wed, 16 Dec 1998 08:46:39 -0800 Subject: Re: PATCH: wrappers, unloading, and dependencies Resent-Message-ID: <"f36Pf.0.iq6.ikBUs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4827 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: > > On Dec 16, 11:39am, Sven Wischnowsky wrote: > } Subject: PATCH: wrappers, unloading, and dependencies > } > } With the patch I send modules on which modules whose unloading is > } currently delayed [depend] may be unloaded immediatly. This means > } that if the wrapper function uses data or functions of the module > } depended upon may fail if the access appears after the execution of > } the shell function and the lower level module was unloaded (and could > } be unloaded immediately). > > As I said before, I think you're going to end up delaying unloading of > all modules until all wrappers are finished. Now that you've split the > boot_/setup_ and cleanup_/finish_ parts, there's no reason to unload a > module instantly, so why even try? > > Following the dependency chains around is much more complicated than > necessary, I think. Yes, using one static variable in module.c to count all wrappers and unloading all modules with MOD_UNLOAD when it reaches zero would be simpler, but only if we don't care about the order the finish functions are called. If we want them to be called from depending to base modules we would end up with a loop like the one we have now in unload_module(). Alternatively we could keep a list of modules in the order their unloading was requested, but then we would need the code to keep this list up-to-date. > > } But of course that wouldn't be fully secure either, we would also have > } to enforce that modules initialize/finalize all data other modules > } might be interested in in the setup and finish functions, *not* in the > } boot/cleanup functions. And that, of course, can't be guarenteed since > } module writers are free to do what they want. > } > } Making the implementation of setup/finish mandatory might help here > } but doesn't ensure the right behavior either. > > There's no way to prevent people from writing buggy modules, period. You > tell them the rules and they get to fix the module if it does something > bad. Thanks, that's what I wanted to hear. (And I will send a cleanup patch for the module stuff today that will change the documentation.) > > } So we can either make find_module() be accessible from modules and add > } a comment in the documentation the this can be used in the wrapper to > } test if the modules needed are still loaded or we use the patch below > } to delay unloading of modules depended upon and to change the > } documentation. > > If find_module() were accessible from modules, then a module could auto- > load any others on which it depends; that'd be pretty nice. But I would > not require modules to test again when unloading, as that's something the > shell should be able to make work. Making it accessible is simple, maybe with a little wrapper so that we return the module itself (not the node). > > Now, should I apply this patch, or wait for some other one? Refering to my comment above, I'd say yes. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de