A question about bmcweb code

Lei YU mine260309 at gmail.com
Tue Apr 30 15:59:42 AEST 2019


This email is to ask a question about the code in bmcweb.

When I started to review/read some code in bmcweb, some code concerns me.

1. There is a static systemBus in `include/dbus_singleton.hpp`, which is
   included by multiple header files;
   In case this is included by multiple cpp files, there will be different
   instances of `systemBus` in different compile units, which makes it not
   singleton at all.
2. There are static variables in multiple header files in `includes/`, e.g.
   `include/obmc_console.hpp`
   In case these are included by multiple cpp files, we got different instances,
   and some of the variables are large and thus consume memory.

Luckily, current bmcweb only includes all the header files
src/webserver_main.cpp, so it does not have issues mentioned above.

So my question is, is it a design to enforce all implementation in headers and
only included by `webserver_main.cpp`?
If yes, I would expect some description in README or some document;
If no, how do we avoid the issues described above?

Thanks!


More information about the openbmc mailing list