[collectd] Proposed patch for the vserver plugin

Sebastian Harl sh at tokkee.org
Wed Oct 4 18:39:31 CEST 2006

Hi Guillaume,

Thanks for the patch.

> // XXX: Without these typedefs, vserver.h does not compile

Did you report this bug upstream?

> +static char *get_vserver_name (char *context_id)

Hum... this function should cache any names that have already been resolved.
Getting the name from the configuration file every time this function is
called is _really_ expensive.

Besides, I do not really like the dependency on libvserver. I think we could
reimplement the small portion we need ourselves without problems and could
even make some of it compile time options. This might remove some more
overhead. I will have a closer look at it during the next days.

> +			len = strlen(vserver_name);
> +			for (i = 0; i < len; i++) {

This could be written as:

    for (i = 0; vserver_name[i] != '\0'; ++i) {

Afaik strlen just looks for the '\0' character anyway and we do not need to
look thru the string twice.


Sebastian "tokkee" Harl
GnuPG-ID: 0x8501C7FC

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061004/c8df4ac2/attachment.pgp

More information about the collectd mailing list