Hi,

currently libcgroup does not print anything to stdout/stderr when
something bad happens. We use only simple int as return code. And IMHO
this is not enough. One of Fedora user stumbled upon a bug [1], which
needs to transport more than simple error code from deep of
cgroup_config_mount_fs() up to cgconfig.c's main().

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=695528

Current return code tells the cgconfigparser tool that some mount
failed. But the user is interested in *what* mount failed and *why*.
Both is available in cgroup_config_mount_fs(), but it should not print
anything, it's library function, and I need a way how to pass this
information up to the application (=cgconfig.c).

/me wishes for c++ exceptions here

So, there are few ways how to get out of this:
1) return something else than plain int - API/ABI breaker

2) store better error messages internally and return them on
cgroup_strerror() - problematic in multithread environment

3) extended logging - functions of the library would be able to log
their errors/warnings to a callback function provided by the
application. Application then decides what to do with the message, based
on its 'log level'. And by default, i.e. if application does not provide
it's own logger callback, libcgroup will write its errors e.g. to stderr
and ignore warnings. Do you have any favorite logging library? Or shall
we re-invent a new one? (It's not that difficult...)

Jan

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to