[Nut-upsdev] Common Power Management with UPS support (was: NUT-NG)

Niklas Edmundsson nikke at acc.umu.se
Wed Mar 15 10:14:00 UTC 2006

On Wed, 15 Mar 2006, Arnaud Quette wrote:

> 3) create a addon-ups.c:
> - this one replaces the above "empty" upsd and load the probed or
> manually configured (in nut.conf or ups.conf) driver for the UPS.
> Loading the driver means dlopen <driver>.so, and call upsdrv_main(...)
> - the driver move toward shared object is not that hard, and remains
> compatible with the NUT standard compilation. I mean that it would
> simply be a set of compilation rules.
> - this would however need to change the dstate layer [4] (driver state
> is the driver API that implement socket communication with upsd) to
> make it dbus (or hal-dbus) compatible.

The problem I see with the shared-library-idea is debugging. If things 
go severely bad (ie. overwriting memory wildly) you can drag more than 
the faulty driver down into the mess. Also, debugging/developing means 
restarting all drivers since they're shared libraries (unless you 
successfully is able to unload the library, but in a devel/debug 
situation you can't count on it). I've heard a lot of foul words from 
my colleagues about debugging shared library messes, so I'd prefer to 
avoid that frustration if at all possible.

So, I personally prefer standalone drivers for this reason, small and 
simple with built in fault isolation (aren't buzzwords nice? ;).

There's also a small portability issue, but those problems are fixable 
in most cases (I don't know about cygwin for example).

Currently, I don't see any gain in doing it the shared-library-way, I 
only see drawbacks.

  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke at acc.umu.se
  Shin - Device for finding furniture in the dark

More information about the Nut-upsdev mailing list