9688ed68 | 06-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add override keyword everywhere it's required
Clang catches some of these. Add override keywords where we override functions, per cpp core guidelines.
Change-Id: I66f9e6dff53e07f0057d86a806701593b
Add override keyword everywhere it's required
Clang catches some of these. Add override keywords where we override functions, per cpp core guidelines.
Change-Id: I66f9e6dff53e07f0057d86a806701593be16b188 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
640a7d56 | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add support for appending std::string_view
std::string_view is used more in the project now that c++17 is available. It should be allowed as a base type in serialization of dbus interfaces.
To avo
Add support for appending std::string_view
std::string_view is used more in the project now that c++17 is available. It should be allowed as a base type in serialization of dbus interfaces.
To avoid an extra string copy, this function makes use of sd_bus_message_append_string_iovec, which allows appending in string pieces that might not be null terminated. This function is piped through the test framework, and interfaces to match.
Change-Id: Iee3e2cea9759fa9759cec98ab30c12c822aa3b73 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
2e3f79b3 | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add missing override keyword on mock
This mock method is missing an override keyword. Looks like an unintentional omission. Add it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia1c2
Add missing override keyword on mock
This mock method is missing an override keyword. Looks like an unintentional omission. Add it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia1c2ee09ddbb5add0485b2e3f66347823bf959af
show more ...
|
87ce9630 | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Remove static keyword from template
Clang warns on these templates not being used, each of which use a static modifier in a header file. Given we're in a header, this likely means that this static
Remove static keyword from template
Clang warns on these templates not being used, each of which use a static modifier in a header file. Given we're in a header, this likely means that this static modifier isn't really doing anything, given that every compile unit will include the header.
Remove static to shut clang up.
Change-Id: I50c33738e4567150eeddf9e6ded0dc24db14c78d Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
ddc57bdf | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Fix a bunch of docstrings
Clang correctly notes that a bunch of our docstrings are wrong. We don't really use doxygen, but it's useful to be able to run a compiler without warnings. The failures f
Fix a bunch of docstrings
Clang correctly notes that a bunch of our docstrings are wrong. We don't really use doxygen, but it's useful to be able to run a compiler without warnings. The failures fall into a couple categories.
First, when using variadic templates, the type is the variable name (ie T), not including variadic expansion. (ie T...). In these cases, the ... is removed from the definition.
Templatized structs should not use the @struct keyword. They are a template as far as doxygen is concerned, so remove the keyword.
A number of functions docstrings are just wrong in terms of argument names, or whether or not they have return types.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iab6f76b422a9568b7ad19d3f725a9c1b870784d9
show more ...
|
ed4a5a64 | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Fix variable shadow warnings in sdbusplus
-Wshadow is useful for subprojects to enable, because it can find bugs in common variable names (err, r, i, etc). With these changes, projects can now buil
Fix variable shadow warnings in sdbusplus
-Wshadow is useful for subprojects to enable, because it can find bugs in common variable names (err, r, i, etc). With these changes, projects can now build sdbusplus with -Wshadow enabled.
The changes fall into a couple buckets. The first is for constructor variables that match the member variable name. In these cases, "_in" is appended to the end of the constructor variable name.
The second is a case where the variable "r" was used for return codes twice. One instance is changed to "ret".
With these changes, projects can compile with -Wshadow enabled without warnings.
Change-Id: Ia33a6f8306473c616f6278bb848460167e5463ef Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
5e7ef083 | 05-Jan-2023 |
Patrick Williams <patrick@stwcx.xyz> |
stdexec: update to later commit
The upstream code has done some namespace changes. Point to a commit in that timeframe and fix up the local usages in order to compile successfully.
Signed-off-by:
stdexec: update to later commit
The upstream code has done some namespace changes. Point to a commit in that timeframe and fix up the local usages in order to compile successfully.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5a21ccd0774ee5cd22d45c9a425e43560734a571
show more ...
|
b8be599f | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Remove extra semi-colons
A couple functions had extra semi-colons, which clang -Weverything flags. Remove them.
Change-Id: I2b44444c3184817dd0035c62b5ae114254457398 Signed-off-by: Ed Tanous <edtan
Remove extra semi-colons
A couple functions had extra semi-colons, which clang -Weverything flags. Remove them.
Change-Id: I2b44444c3184817dd0035c62b5ae114254457398 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
ae47928b | 03-Jun-2022 |
Jonathan Doman <jonathan.doman@intel.com> |
Clean up ASIO set-property callback code
This reverts commit ce62764d6c0a72ec88eb433e1afd05b751225971, which introduced inconsistent semantics for the underlying ASIO set handler functions. The "ext
Clean up ASIO set-property callback code
This reverts commit ce62764d6c0a72ec88eb433e1afd05b751225971, which introduced inconsistent semantics for the underlying ASIO set handler functions. The "external" `call` case expected the handler to return an integer error code, while the "internal" `set` case expected the handler to return a boolean status.
This also does a small refactor on the two similar `call` and `set` functions to deduplicate, and adds ASIO.md to document the expected semantics of the ASIO handlers.
The vast majority of user code in OpenBMC is still returning integers from the callbacks (0/1/-1), but in most cases 0 was used to mean failure, and 1 was used to mean success, so formalizing that the callback should return a boolean value will not break things.
Tested: With accompanying dbus-sensors change I05c41318954d5d1549752c5ef2c227f3f22a45d3, using steps in that commit msg.
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: Ic3a36027fa95a77469439b296a1497634cfe030f
show more ...
|
5d81ca2b | 22-Nov-2022 |
William A. Kennington III <wak@google.com> |
bus: Add function for checking open status
We have a workaround in sdevent for dealing with match expressions that leak memory. If we keep trying to process bus events after sd_bus_close(), we will
bus: Add function for checking open status
We have a workaround in sdevent for dealing with match expressions that leak memory. If we keep trying to process bus events after sd_bus_close(), we will encounter errors. This allows us to stop processing when the bus should be closed.
Change-Id: I0bda95e76db8e81b56527cd1d5687a5d0b14f259 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
94865b3d | 21-Nov-2022 |
William A. Kennington III <wak@google.com> |
bus: Return the value of wait
Knowing the number of events being >0 is important if a timeout is set, otherwise you can't know if processing is safe to perform.
Change-Id: Ifc3b8a01666422b4f2e057f0
bus: Return the value of wait
Knowing the number of events being >0 is important if a timeout is set, otherwise you can't know if processing is safe to perform.
Change-Id: Ifc3b8a01666422b4f2e057f0b162d7588c0ab446 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
a8a092c0 | 17-Oct-2022 |
Willy Tu <wltu@google.com> |
remove potential memory leak with getAllProperties
Wrap handler in a lambda to remove the trigger potential memory leak with clang-tidy. Only getAllProperties have this std::move to async_method_cal
remove potential memory leak with getAllProperties
Wrap handler in a lambda to remove the trigger potential memory leak with clang-tidy. Only getAllProperties have this std::move to async_method_call and is hitting the issue.
The issue only happens if the handler captures some variabls
Example code that hit the issue. ```
void handler(const std::string& /*unused*/, const boost::system::error_code /*unused*/, const std::vector< std::pair<std::string, std::variant<std::string>>>& /*unused*/) {}
void test(sdbusplus::asio::connection* conn) { std::string test = "test"; sdbusplus::asio::getAllProperties<std::variant<std::string>>( *conn, "xyz.openbmc_project.EntityManager", "path", "xyz.openbmc_project.Inventory.Decorator.Asset", std::bind_front(handler, test)); } ``` Tested: clang-tidy is happy now
Signed-off-by: Willy Tu <wltu@google.com> Change-Id: I0a3a5ed016aed664c650d811e253d54a4eb2b0b1
show more ...
|
115e9b3d | 23-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: allow many exceptions
Allow many spawned tasks to throw exceptions and queue them up, re-throwing them one-by-one from `context::run` calls. Similarly enhance `context::scope` so th
async: context: allow many exceptions
Allow many spawned tasks to throw exceptions and queue them up, re-throwing them one-by-one from `context::run` calls. Similarly enhance `context::scope` so that many `context::empty` completions can complete with error.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8744e0a3b8b0663ebd5ca26db0f5943688afe62a
show more ...
|
10483c94 | 23-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: allow run re-entrance
Switch the context call so that it can be re-entrant. A single call to `run` will either:
1. Process until the context is successfully stopped. 2. An
async: context: allow run re-entrance
Switch the context call so that it can be re-entrant. A single call to `run` will either:
1. Process until the context is successfully stopped. 2. An exception is raised from a spawned task.
If an exception is raised, it could be caught outside the run call and then run called again.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Icd05df421a1f0592bd2390fbe8e21a16252eafed
show more ...
|
3c242ba4 | 23-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: simplify run function
Since we already have a `spawn` function to add async tasks, get rid of the special "startup" task send to run. Instead users should pass the start up work to
async: context: simplify run function
Since we already have a `spawn` function to add async tasks, get rid of the special "startup" task send to run. Instead users should pass the start up work to spawn and call run with no parameters.
Eventually this will allow us to exit the run-loop for any and all exceptions from the async context and potentially allow a caller to re-enter the `run` loop after handling the child exception.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia0e09a2493f0554538315d1d0c238aa11cb44e39
show more ...
|
dfa9be58 | 23-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: spawn on worker thread
We always want to do async work on the worker thread. Use the `execution::on` sender to ensure that tasks are done on that thread no matter which thread they
async: context: spawn on worker thread
We always want to do async work on the worker thread. Use the `execution::on` sender to ensure that tasks are done on that thread no matter which thread they were spawned from.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2b4e3a69bbd64786c2480df9396d65f12dd46cc3
show more ...
|
095eff81 | 22-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: scope: allow blocks before started
In some cases it may be helpful to be able to block on a scope before work has begun on that scope. Add state tracking to know when the scope has first sta
async: scope: allow blocks before started
In some cases it may be helpful to be able to block on a scope before work has begun on that scope. Add state tracking to know when the scope has first started.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9ee48aa19344b80124aa9409a4a7e368eb025882
show more ...
|
4cfc284d | 22-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: handle exceptions and stops
Add support in `context` and `scope` to handle exceptions and stop conditions:
* When an unhandled_stop occurs, turn it into an UnhandledStop exception. *
async: handle exceptions and stops
Add support in `context` and `scope` to handle exceptions and stop conditions:
* When an unhandled_stop occurs, turn it into an UnhandledStop exception. * When a `scope`-spawned task throws an exception, save it and cause `set_error` on the `scope::empty()`'s Receiver. * When anything in the `context` completes with `set_error` propagate that out to the caller of `context::run`. * If multiple exceptions occur within a `scope`, terminate.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I25285f7ece5c0675864489bbe1345fa8e7afa70c
show more ...
|
1b7b54ca | 21-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: match: stop pending sender on dtor
If the match is destructed with a pending Sender completion, we need to 'stop' that Sender. We cannot 'complete' the Sender because we do not have a messag
async: match: stop pending sender on dtor
If the match is destructed with a pending Sender completion, we need to 'stop' that Sender. We cannot 'complete' the Sender because we do not have a message (dbus signal) associated with the match, but if we do nothing then the Sender is hung (and leaked).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia6e465d46f0f7da08a385cf7c875bbda88a5ab61
show more ...
|
78e436fe | 21-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: handle shutdown better
When the context has been requested to stop we don't actually want to stop it until all work has completed. Work that is pending could require the dbus/event
async: context: handle shutdown better
When the context has been requested to stop we don't actually want to stop it until all work has completed. Work that is pending could require the dbus/event to function properly so we need to keep that running until that time. If we shutdown those too early, we can end up with a spawned task which never completes because it is relying on an event which is never processed.
In order to keep all of these straight, split the scope/stop_tokens into two: pending and internal. Pending tasks are for those 'spawned' due to the user requests and internal tasks are those maintained by the context itself to aid in processing. Defer shutting down the dbus/event handlers until all 'pending' work is completed.
Add a test-case which use to hang and now completes.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I399d065ae15b24ad3971c526c27b73757af14b34
show more ...
|
c5b5ff57 | 21-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: scope: add completion sender
Add a mechanism to await the completion of an async::scope, equivalent to a 'join' on the spawned tasks it contains.
Signed-off-by: Patrick Williams <patrick@stw
async: scope: add completion sender
Add a mechanism to await the completion of an async::scope, equivalent to a 'join' on the spawned tasks it contains.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I669680441704cdb59aa982d97bed610178c498b9
show more ...
|
0139cac7 | 20-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: add scope
In order to be able to create multiple subtasks as a collection and in order to make sure we keep good track of any tasks that are created by the context, add a `scope` as a contain
async: add scope
In order to be able to create multiple subtasks as a collection and in order to make sure we keep good track of any tasks that are created by the context, add a `scope` as a container of subtasks. This is partially modelled after the C++ P2519 proposal.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6e99b2fa2829d80c320491991f7e038f122963a9
show more ...
|
435eb1bd | 16-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: add sleep_for sender
Sometimes it is useful to do the equivalent of `std::this_thread::sleep_for` in a co-routine context. Add a sender-based implementation to async.
Signed-off-by: Patrick
async: add sleep_for sender
Sometimes it is useful to do the equivalent of `std::this_thread::sleep_for` in a co-routine context. Add a sender-based implementation to async.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9991eb40b7a1b12e61511f1200bc99fdcdbccf0a
show more ...
|
3ce3159b | 16-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
event: add oneshot timer support
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9785fa52e38202821258ad162e6f9168c71e53f7 |
73e278b5 | 16-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: support stopping the context
Up until this point, the async::context would run forever and have no way of exiting the process, which isn't very useful. Add some support for stop con
async: context: support stopping the context
Up until this point, the async::context would run forever and have no way of exiting the process, which isn't very useful. Add some support for stop conditions so that we can ask the context to stop and cleanly exit.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia5967162fb103d4b4b0490d8cbbef12bdb361bac
show more ...
|