22f0b188 | 12-Dec-2024 |
Jayanth Othayoth <ojayanth@gmail.com> |
boost version 1.86 support
Added fix for boost::asio::spawn overload issue reported similar to chriskohlhoff/asio#1524. This error reported by CI build during boost version bump.
Error details
'''
boost version 1.86 support
Added fix for boost::asio::spawn overload issue reported similar to chriskohlhoff/asio#1524. This error reported by CI build during boost version bump.
Error details
''' ../example/asio-example.cpp:375:23: error: call of overloaded ‘spawn(boost::asio::io_context&, client()::<lambda(boost::asio::yield_context)>)’ is ambiguous 375 | boost::asio::spawn(io, [conn](boost::asio::yield_context yield) { | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | do_start_async_method_call_one(conn, yield); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | }); | ~~ In file included from /usr/local/include/boost/asio/spawn.hpp:871, from ../example/asio-example.cpp:2: '''
Proposed fix is to explicitly specify the completion token.
Tested: verified build
Change-Id: I5ec16f8f33c617a6abc823abf75b765c0d031141 Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
show more ...
|
dfbd9ddf | 11-Sep-2024 |
Lei YU <yulei.sh@bytedance.com> |
asio: connection: Return unpacked value directly
`yield_method_call()` shall return the values of DBus methods, and it was using constexpr if to check `sizeof...(RetTypes)` to get the return type an
asio: connection: Return unpacked value directly
`yield_method_call()` shall return the values of DBus methods, and it was using constexpr if to check `sizeof...(RetTypes)` to get the return type and construct default return values.
`message::unpack()` does the same thing so it is possible to return directly.
In case of error occurs, it still need to return the default-constructed value, so a helper function `default_ret_types()` is introduced for default return in such case.
Change-Id: Iac7501dc03c1cfaf16f59f7ae742168c6be5886d Signed-off-by: Lei YU <yulei.sh@bytedance.com>
show more ...
|
cd3bf08a | 12-Oct-2024 |
Ed Tanous <etanous@nvidia.com> |
Handle timeouts in asio connections
It was reported in #98 that timeouts weren't working in some simple cases. This appears to be because we've broken some of the assumptions used by sd-bus around
Handle timeouts in asio connections
It was reported in #98 that timeouts weren't working in some simple cases. This appears to be because we've broken some of the assumptions used by sd-bus around manually handling polling loops, and ignoring sd_bus_get_timeout and sd_bus_get_events, as well as not calling sd_bus_get_fd before every invocation. [1]
This commit: Adds a steady_timer class to the asio object, which indirectly allows expiring the underlying epoll loop early, based on the result of sd_bus_get_timeout.
Changes the flow such that sd_bus_get_events is called and obeyed when adding poll events to the reactor. While this wasn't seen in practice, in theory we have the potential to miss events during heavy write loads where the socket might block. This should resolve it.
Re-calls sd_bus_get_fd on each invocation of the poll loop, as directed by the sd_bus documentation. Further testing is needed to see if this resolves some of the match_t issues we've seen.
Tested: asio-example functions and prints expected content. More in-system testing needed.
[1] https://www.freedesktop.org/software/systemd/man/249/sd_bus_get_fd.html#
Change-Id: I9abe99c95eb5395753dde33f92c831bd828238f3 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
9737e15f | 12-Oct-2024 |
Ed Tanous <etanous@nvidia.com> |
Add get_events and get_timeout
These two functions are required for handling external io loops properly, per the sd-bus documentation. Add them to the interface, and mocks.
Change-Id: Ic2d20607585
Add get_events and get_timeout
These two functions are required for handling external io loops properly, per the sd-bus documentation. Add them to the interface, and mocks.
Change-Id: Ic2d20607585ddf669d1cf6e7acc3e5970489489b Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
2a12ae12 | 23-Oct-2024 |
Jagpal Singh Gill <paligill@gmail.com> |
add async fd sender receiver for coroutines
Add async sender receiver for file descriptor based events. The user of the async file descriptor needs to initialize a fdio instance and then call next()
add async fd sender receiver for coroutines
Add async sender receiver for file descriptor based events. The user of the async file descriptor needs to initialize a fdio instance and then call next() to get each new event for the fd.
Tested: ``` > meson test -C builddir test_async_fdio ninja: Entering directory `/host/repos/sdbusplus/builddir' ninja: no work to do. 1/1 test_async_fdio OK 6.01s
Ok: 1 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Full log written to /host/repos/sdbusplus/builddir/meson-logs/testlog.txt ```
Change-Id: I1b4f16963e6096f30484c4a6df471e64ed24448b Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
show more ...
|
956e87a2 | 11-Nov-2024 |
Jayanth Othayoth <ojayanth@gmail.com> |
boost version 1.86 support
Added fix for boost::asio::spawn overload issue reported similar to chriskohlhoff/asio#1524. This error is reported by telemetry recipe during Boost 1.86 migration build.
boost version 1.86 support
Added fix for boost::asio::spawn overload issue reported similar to chriskohlhoff/asio#1524. This error is reported by telemetry recipe during Boost 1.86 migration build.
Error details
''' tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/telemetry/1.0+git/ recipe-sysroot/usr/include/sdbusplus/asio/object_server.hpp:238:27: error: call of overloaded 'spawn '''
Proposed fix is to use default completion token.
Tested: verified build
Change-Id: I4c24869c1467a04ac40027bc4c50aebd1f3acb78 Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
show more ...
|
ae0a8384 | 17-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of '
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of 'std::bad_optional_access' ```
Improve this by using the sdbusplus `InvalidEnumString` exception: ``` terminate called after throwing an instance of 'sdbusplus::exception::InvalidEnumString' ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I746f7265c8cf97e9a123915a123a4749d31e560c
show more ...
|
fe1ebd43 | 09-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia3da51483d25c6f65e6bcf977d47f65d59a37748
show more ...
|
17e54abc | 06-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those wil
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those will still be generated as SNAKE_CASE.
SNAKE_CASE is a lossy format. Consider `BMC_ADDRESS`; it cannot be identified if BMC is an acronym or a word. Our conversion functions will convert this to `bmcaddress` when becoming a camelCase format since there is special handling for acronyms and this will appear equivalent to an acronym.
All of the generators for events are explicit to use `foo.camelCase` or `foo.SNAKE_CASE` as appropriate, so switching to CamelCase has little effect. The primary thing it does is make the event class member variables named sanely: `numberOfLogs` rather than `numberoflogs`.
This will require a minor edit to the few events that are defined in phosphor-dbus-interfaces already, which will be done at the same time.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10310986b9214aec99a3c7eabecf55f7054cdad0
show more ...
|
b08d14dd | 05-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f3f0374968609328a44587b655a9141c1
show more ...
|
1800045e | 01-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accident
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accidentally add 'severity' on events, which should only be specified on errors. Adding it to the schema to prohibit makes it clearer what the expectations are.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I3decce5cddce2ce7215f7351339157a2597fdb0b
show more ...
|
7ffcdaac | 30-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iefaab6becc13292e1cd7835d97c6b3cc61a52776
show more ...
|
3b54a8e5 | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a sp
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a special case for empty parameter lists in multiple places.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7ca8d962ab1c7a65e0ad6d80ece1cd7e3847f2c6
show more ...
|
7377a0bf | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr aut
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr auto sdbusplus::message::types::type_id() [with Args = {}]’: example/gen/net/poettering/Calculator/aserver.hpp:372:58: required from here ../include/sdbusplus/message/types.hpp:302:72: error: no matching function for call to ‘type_id_multiple<>()’ ```
Fix this by reusing logic from the non-async code to special case zero parameter length signals.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0cde8810dfaf15afa2033a4c6699fb264facb9e8
show more ...
|
578b9733 | 11-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
bus: add error handling for bus-open calls
sd-bus can return ENOMEDIUM in some cases for bus-open calls, so we need to detect this condition rather than blindly ignoring the return value. Add appro
bus: add error handling for bus-open calls
sd-bus can return ENOMEDIUM in some cases for bus-open calls, so we need to detect this condition rather than blindly ignoring the return value. Add appropriate error handling.
Tested: ``` $ sudo builddir/example/calculator-server Password: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError' what(): sdbusplus::bus::bus sdbusplus::bus::new_default(): System.Error.ENOMEDIUM: No medium found zsh: IOT instruction sudo builddir/example/calculator-server ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7b82a9e182f21a1cbbb80fc3dbfeaaa0174a369d
show more ...
|
fc0bb996 | 11-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
bus: un-inline functions
Due to additional upstream error results, the bus creation functions need better error handling. This will result in larger functions that are no longer a direct sd-bus cal
bus: un-inline functions
Due to additional upstream error results, the bus creation functions need better error handling. This will result in larger functions that are no longer a direct sd-bus call and probably shouldn't be inlined. Move the functions to the `bus.cpp` file.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: If141ef74a62fd04b3bbf58b0720da2a9410481a7
show more ...
|
4b3720f8 | 10-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: use new_bus by default
There are two primary methods for creating a generic bus: * new_default * new_bus
The "default" methods use TLS to get a shared bus for the thread. Thi
async: context: use new_bus by default
There are two primary methods for creating a generic bus: * new_default * new_bus
The "default" methods use TLS to get a shared bus for the thread. This is likely not the desired bus to use for async operations because:
1. Currently a separate thread is used for the message processing. 2. Some existing synchronous code throughout openbmc uses `new_default` instead of referencing an existing bus, which could interfere with the async context.
Switch to using `new_bus` by default to ensure we get a fresh, unused and unshared bus in the typical case.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1fd27de7bce9a8737294a5ab8e63e0dbe1afc8c3
show more ...
|
c012fde4 | 07-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I82bb8482c0f95435275fb3a1fcdcb37bd29fc7ec
show more ...
|
760adffd | 05-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base class. Add the `to_json` there for use by phosphor-logging.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ibed2c7c4fc0e23f1c82c4c003e16a6f438f7e68f
show more ...
|
f5b39215 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xy
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I88f994a6004583bef586c86091dfff0c18d2bddf
show more ...
|
9213e158 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs even
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs event).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4fef5bd7b70b13e56682dce758a07f548005f549
show more ...
|
00fd0a8b | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwc
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I61e0cbed239a44842c6ea598904ac4411e195588
show more ...
|
14c4797c | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message on a client side back to the original exception.
Tested: ``` $ busctl --user call net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator Divide xx 5 0 Call failed: {"net.poettering.Calculator.DivisionByZero":{"FOO":"unused"}} ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4edd76d983267f28e51c4aa41902d45f5d6da793
show more ...
|
a4bfefde | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Mo
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Move the sd_bus_error_set calls to exception as a virtual function so this can be accomplished.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6e6947e4977701a8e7e27fef119bd35e837d866b
show more ...
|
ebe01794 | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e53381
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e5338113a4b38a0f80
show more ...
|