| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
Now that we are utilizing c++17, we can move to using the standard
variant type instead of a custom third-party one.
Tested:
Ran through a unit test run.
Change-Id: Idd9854a6d958ea5a191e9a72d6116fd767dff4d3
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
| |
Set the language in the build to C++.
Change-Id: I997d6a697bc6c98ab208518a81e66ac2aa7945c1
Signed-off-by: Patrick Venture <venture@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding the server-side of the coroutine path allows yielding
asynchronous method handling via coroutines. This means that a method
handler can call a yielding dbus call (or other asio-based asynchronous
call) without blocking the rest of the process.
The call path might look something like this:
service.thing/object/path/interface.my-method()
- do something
- yield_method_call(other.service, /other/path,
other.interface, other-method)
<yields to other coroutine>
execute other code in another context
<returns some time later with dbus call's response>
- use response from other method
<- return my-method response
This also changes the asio-example, pulling it apart into a
client/server model so it is more clear about how to use the yielding
async method handling and yielding async method calls.
Change-Id: I23ccf7a9a8dff787be78929959c1f018280a0392
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
| |
Solves issue #21 on github.
Change-Id: I71ef2be8b2a2fc8ff82410b6aed12c76140b5606
Signed-off-by: Waqar Hameed <waqarh@axis.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Setting the same value causes egregious properties changed
events. Return 0 if the user attempts to do this.
Tested-by: used dbus-monitor and noticed reduced traffic
when using set_property
Change-Id: I2643a01fd0e1cc1e0c0ed407056f0e3cd898865b
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some of the code in the openbmc project uses their own ad-hoc get_if
style interface. We need to provide one on the mapbox side to ease the
transition.
Tested:
Built code against the get_if implementation to make sure it
conforms to the same behavior as std::get_if.
Change-Id: I8560a2d13110ab7fd82a21835a5e233682003fa8
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Few examples provided as a part of the repository are dependent on the
sdbus++ code generation tool, and the compilation will fail trying to
build the examples even in cases where the user disables sdbusapp during
configuration using --disable-sdbuspp option.
- Made a change in example/Makefile.am to build the examples which are
dependent on sdbus++ tool(which is dependent on few python packages)
only when the sdbuspp is enabled during configuration.
Resolves openbmc/sdbusplus#19
Change-Id: I1453536fd4c7df35e66f2ccfe7a890cced0d155d
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mapbox used to require that we use the apply_visitor interface. The new
std::variant std::visit() interface is more generic and a superset of the
functionality provided by apply_visitor. We just need to provide an
alias.
Tested:
Used this in phosphor-host-ipmid with a work in progress commit to
make sure the compat layer is working fully.
Change-Id: I6ca9747e4f0825220e47bb9b2965a249466b3593
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
| |
This was never added when the test was made
Change-Id: I15655cdf131d8baef02c3856c53c79e014b9cf24
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our message hashes used to generate transaction id's for dbus services
have been relying on an invalid cookie when messages don't have cookies
present. This was exposed by 20adbc2d459123772ecd2d17009e1db0dd6314f2
which enabled error handling for message.get_cookie().
In order to generate a hash of the message, we need to consider the type
of message we have. In the context of an sdbusplus server, METHOD_CALL
type messages will always be incoming and sealed. They will always
provide a valid .get_cookie(). Messages of METHOD_RETURN or METHOD_ERROR
will not be sealed, but will always be generated from an incoming
METHOD_CALL. Therefore they will always have a valid
.get_reply_cookie(). SIGNAL type messages will always be outgoing so
they will not have a cookie yet. We will just use a monotonic source for
generating a transaction id for those.
Tested:
Run through the unit test suite and booted in a romulus virtual
machine. Ensured that none of the daemons were ABRTing like they
were with just 20adbc2d459123772ecd2d17009e1db0dd6314f2 applied.
Change-Id: Ic54ae3b3cfa75d2f419579e1cb02f57eacb87c57
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
sd-bus messages of a reply type (return,error) contain the cookie
associated with the incoming request. Lets expose the reply cookie
of the message on the public interface.
Tested:
Builds and unit tests still pass
Change-Id: I7dddae1d2c4b961987e6526ce2dcb16107f40bed
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
sd-bus messages are typed and we are going to need this information to
support a future commit. Lets expose the type of the message on the
public interface.
Tested:
Builds and unit tests still pass
Change-Id: I9c259af09b367d580dc14762d28cf77c129e2906
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is some confusion, likely created by me, that call() might not
throw an exception in the case of a method call returning a
METHOD_ERROR.
This commit clarifies that all errors are thrown, and that we do not
need redundant is_method_error() checks on the reesulting message.
Change-Id: Ic2b962961cf671bd562bce7ba47135ad89bf9371
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using a coroutine to asynchronously execute method calls gives the best
of both worlds:
1) better readability because the code reads like synchronous code
2) better throughput because it is actually asynchronous
When passed in a boost::asio::yield_context, the sdbusplus::asio dbus
connection members async_send and async_method_call will execute
asynchronously using coroutines.
This also adds an example of how this works in the
example/asio-example.cpp file.
Change-Id: Ifb71b2c757ecbfd16b3be95bdefc45a701ca0d51
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
| |
The return value from sd_bus_error_set is always a negative error value
mapping to the provided name. We should use this value instead of always
returning -EINVAL.
Change-Id: I102c7a0b306db873d44e9c1b7cbd9cc146ffe29c
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sd_bus_error_set_const takes pointers to c-style strings as arguments
which populate its name and message. This function does not take any
ownership of the name or message, requiring the to live beyond the
lifetime of the error. Since we are destroying the error object as soon
as we leave the catch blocks, we are destroying the strings passed to
the sd_bus_error. This violates the lifetime guarantee.
Instead, use the sd_bus_error_set method which copies the strings. We
know that the callers of these callbacks free the errors by inspecting
the libsystemd code.
Tested:
Run through unit tests which still pass
Change-Id: Ifa1533fc4c41db070f5bf2901581e9f5680cabfc
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This is not used by anyone yet with this patch, but will be used by a
future fix.
Tested:
Tests still build and pass
Change-Id: Ia90e4eee6cb1bf3e5c5e7ac6daa86e0f22b1d929
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This makes our use of the mapbox variant consistent with std::variant.
We need this cleanup for the conversion to std::variant.
Tested:
Ran unit tests to make sure they still pass.
Change-Id: I990013eaaa2ec27f2fda71bfadd9a5369d50c187
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
| |
Tested:
Builds and unit tests still pass. Manually tested that
has_alternative works as expected.
Change-Id: Iae8309c09a6aac6b9b12164d5fe7ae4e484cb905
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Some of the methods that can return errors are not being checked for
errors. Check all of the return values where necessary.
Tested:
Ran through a build and unit test run
Change-Id: I3f8469cbe80a0c58032407f2ba184d913df6e2f1
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
| |
In order to properly return an sdbus error in an async execution path,
the low-level interface and message classes need to expose the
underlying sdbus set errno api.
Change-Id: I893ef587ecf8ae3936198375931e6747d71ad451
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
| |
C++17 is available with the current compiler. Changing to this standard
will allow sdbusplus to use some more advanced language features that
can reduce code size and improve readability.
Change-Id: Ia9a1af615bd5b3bc0868677308a8dd269a4bf5db
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change enables copies and assignments of messages, specifically,
copy constructors and copy assignment operators and the default empty
constructor. A boost::asio::yield_context needs to be able to store the
result of the async operation (a message::message) in a helper struct,
which results in a default construction (with a null msg_t) and later an
assignment to replace it when the result is ready. But adding the
appropriate sd_bus_message_ref/unref calls makes this possible.
While the default-constructed object does not sit around for long, this
change also adds in some asserts to catch any invalid accesses of the
object in that state.
Change-Id: I2059cb677fc5a30a3c7e3c2b81ed4199e5460dde
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
William has been hacking on sdbusplus a lot recently. Enough so
that he is now the top contribtor in both commit count and LOC count
(not counting the original sdbusplus author).
William has demonstrated solid code and design principles, maintains
a presence in #openbmc and is very responsive to questions and feedback.
All of these make William the most qualified for sdbusplus maintainership.
Change-Id: I3bab20dbefa1bed5e076f1b021605a2f998690c0
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The installation of sdbusplus bindings on custom distributions requires
few basic packages which are not clearly mentioned in the current
documentation.
This commit is used to improve the documentation of the sdbusplus to
include the necessary packages that are required to install it on
Ubuntu and Fedora. This will help beginners in the Ubuntu/Fedora
community to leverage the sdbusplus bindings for their applications
outside OpenBMC space.
Change-Id: I62ee774e8cf2cf9b03751496cfbb1d40858eaed9
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
|
|
|
|
|
|
|
|
| |
If the handler throws in its error path, then this would cause a memory
leak (assuming that the executer is catching exceptions).
Change-Id: I44f0feaa7d317a7d8a23bc65a3d9cf6078539f44
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the .get_errno() method to provide the errno value from SdBusError.
Closes openbmc/sdbusplus#22
Tested: Added check for the new method to the exception
unit test suite. Also verified external callers get the right
errno value with:
catch (const SdBusError& e)
{
int errno = e.get_errno());
}
Change-Id: Idddfa7f1bd9cfabfaf89e4d6c83146b4b9af211f
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
|
|
|
|
|
|
|
|
| |
This helper wraps the noreply case to make it trivial for callers to
ignore all errors associated with a call.
Change-Id: I9ddd639633694b315384f71e49f0760ada6de6ce
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If requested, add in an asynchronous sd_event servicing mechanism so
sd_events can be used in conjunction with boost::asio events. Code
throughout the openbmc repositories use sd_events, especially for
timers. In some cases, we may want to add boost::asio event handling for
superior asynchronous eventing, but not want to rewrite all the existing
sd_event code. This gives us the best of both worlds, with a
low-overhead mechanism to handle the sd_events.
Change-Id: I3f8e2aafa3f733439e1494253698d17c2f3a2321
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
| |
Add unit tests for timer.hpp class. These are the unit tests copied from
the phosphor-host-ipmid/softoff/test directory.
Change-Id: I9d74c6eb528f652965f43a3a4b973368ed782bf0
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
timer.hpp and timer.cpp are used throughout the project by copying them
into whatever git repo they are needed. This puts a header-only
implementation into sdbusplus, which is also used by every project.
Then, if you want a timer, you include sdbusplus/timer.hpp and you are
good to go.
Change-Id: Ica7543ecb66128b645f609e790fa7183eeb34ac1
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function convertForMessage() takes an enum class as input, and it
assume the enum value is valid and does not check the return value of
std::find_if().
If user deliberately passes an invalid enum value, it causes undefined
behavior.
Handle this case by checking the return value and throw
std::invalid_argument if the input argument is invalid.
Tested: Verify the unit test in phosphor-time-manager passed; without
the fix, the test fails when -flto is enabled.
Change-Id: I3874eaeb44b8e89469690a21090005d299d0f4b1
Signed-off-by: Lei YU <mine260309@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Callbacks with no arguments failed to build due to an error in the
utility::get_first_arg template. It failed to provide a type member for
the void specialization. With this fix, it is possible to have a handler
that has no arguments.
Tested by: Added a new callback to the asio-example.cpp. Without the
template change, this caused the build to fail as expected.
After adding the template change, the build succeeds and the
example runs as expected.
Change-Id: Ib09b58c76df8cba57dc093ab37a4c1b68ea11ad3
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
| |
Oenbmc documentation specifies a left alignment for pointers. Our
current format tries to left align if neither alignment is strictly
followed, but will allow right aligned files to exist. Lets make this
more strict so that all of our files are consistent.
Change-Id: I3a50043d28a9c25d0cf1ffb752800d05eb7615e1
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
| |
Make using order consistent where used. There aren't any in this
project, but this should be used more widely by openbmc projects.
Change-Id: I22b16c9d57415e3df7e36a5be66aec1fa86b6a53
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
| |
To better match the defined openbmc style.
Change-Id: I68cda43857768bae4c904c367942cb1f0efa3e0c
Signed-off-by: Patrick Venture <venture@google.com>
|
|
|
|
|
|
|
|
| |
Added the header inclusion order to the .clang-format file generated
these changes.
Change-Id: Ia31b21d7ea451cac0309828006bc17c27cbd5bd5
Signed-off-by: Patrick Venture <venture@google.com>
|
|
|
|
|
|
|
| |
The bump to use clang-format-6.0 now reports these issues.
Change-Id: Ice27766e161356f08c98923a256a98af787ac8a2
Signed-off-by: Patrick Venture <venture@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases, the callback may care where the message came from. Allow
the callback to receive the raw sdbusplus::message along with the
automatically extracted arguments.
This means that the registration mechanism as well as the callback
mechanism need to be aware of a 'message as a first parameter' situation
and behave accordingly. The registration needs to strip the message
parameter off in order to expose a correct DBus signature. The callback
mechanism needs to strip of the message parameter in order to properly
unpack the message, but add it back in before calling apply to execute
the function.
Tested: Added an example to example/asio-example.cpp and checked to see
that it builds. Was able to extract sender from message passed
into the IPMI handler.
Change-Id: I520e494d3baad34271e748465f30274353554728
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, we encounter errors when passing `--disable-tests` because
variables used for automake never get defined when you wrap
AX_CODE_COVERAGE and AX_VALGRIND in AS_IF statements. We can fix this by
ensuring that valgrind and code coverage are disabled when tests are
disabled but the autoconf macros are still present.
Tested:
Unit testing still works as expected and builds with --disable-tests
now succeed.
Change-Id: Iddf2db4625d6760455982f1a6fc136f57becd162
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is already support for setting a property as const
(see vtable.hpp and corresponding test cases).
Implement this in the generated code by adding support
for a new yaml flag.
Closes openbmc/openbmc#2028
Tested: Added the const flag to the Software Priority property,
and changing the value via REST and busctl would fail with
"org.freedesktop.DBus.Error.PropertyReadOnly", but the code
update app was able to set its value.
Change-Id: I8534753233080366503fd4f1a0c224c2946e8764
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
|
|
|
|
|
|
|
|
|
| |
Spelling errors found using github.com/lucasdemarchi/codespell
A tool to fix common misspellings.
This tool is licensed under GNU General Public License, version 2.
Change-Id: I99921bb9541fb37cb8999337a72d540494fbb4d7
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
| |
SdBusError now has a direct line of inheritance down to std::exception
and will behave better when trying to catch it as a std::exception.
Add test cases to check that SdBusError is actually caught by
std::exception and all its other base classes.
Change-Id: I83e614219a1c47ec874ee0b4f14096a5e69ac17d
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From the docs, sd_bus_process should be called until no progress
can be made. When progress is made, a positive integer is returned.
Add read_immediate to bypass setting up the fd watch when process_discard
returns a positive value.
Tested-by: Had C++ Mapper and Entity-Manager call each-other at the same
time and noticed no longer timed out.
Change-Id: Icab11743c6c5e1486b353fce1d5e3898f2d3f533
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we don't have test cases enabled we can't possibly need code coverage
or valgrind support since that is only used by our test cases.
Tested:
Builds still work as expected and the autodetection of tests still
enables valgrind if it is available. Code coverage is only available
if `--disable-tests` is not passed and `--enable-code-coverage` is
passed.
Change-Id: I8bc786f2d64944ff8939b66055b3f850f6be7f6f
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Make get_mocked_new() inline so different tests can be linked together.
Otherwise, the build gets multiple definition of this function, if
different cases are linked together.
Tested: Link test cases using this function OK.
Change-Id: Ifa1c62f9615ba0847b49eb73e9b977a865909bb2
Signed-off-by: Lei YU <mine260309@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Asio was missing these signals, this was discovered while writing
the CPP mapper.
Tested: Restarted the fru device and watched using dbus-mointor.
Also devices were able to be found by the mapper after boot.
Change-Id: I9d6e9c6087e36a3b79853432f46cc3942d317340
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the ability to build sdbusplus test cases and run them through
valgrind using the build system.
Simply run:
`make check-valgrind`
and the test cases will be run through valgrind
NOTE: This leaves out drd, helgrind, and sgcheck support as they would
requires extensive test refactoring. We don't really use threading in
the library code anyway so they are really only useful for proving the
test cases don't have any races.
Tested:
sdbusplus can still be built without valgrind and tests will still
execute normally. If `./configure --enable-valgrind` is passed the
configure script fails if valgrind is not present. Even with
valgrind, tests are only run through valgrind with `make
check-valgrind`. This succeeds as expected.
Change-Id: I08972feef2f32cf3ef912da4658e2d8920fb0275
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PTHREAD_{CFLAGS,LIBS} are no longer directly required by our test
files so we don't need to explicitly depend on it. Instead, pull in the
macro so that googletest is configured correctly.
Tested:
Builds and run through the unit-test scripts. Pthread support is
still detected when it is needed.
Change-Id: I4c24177f930ea6c104c69a06ac3fdf0b5ae1535a
Signed-off-by: William A. Kennington III <wak@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change 9ff25f7365d4d590fcb5349328a46a8cd2093f34 exposed the sdbus_impl
globally from the sdbus.hpp file. Remove this leftover declaration
since it is no longer needed.
Tested:
Built and run through the unit test suite.
Change-Id: I39484959978b07dd27aa3b3f3c0f046c5aa9b515
Signed-off-by: William A. Kennington III <wak@google.com>
|