Valgrind complains that sockaddr_qrtr isn't properly initialized, even
though all fields are initialized. So explicitly clear the
sockaddr_qrtrs.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Currently, offsetof produces an unsigned long, while qmi_elem_info's
offset member is a uint32_t. Since this is not the same type on all
platforms, this change uses a size_t for both. stddef.h is also
included for the standard offsetof definition, which also produces a
size_t.
This change also makes similar modifications to list.h.
With the introduction of the in-kernel nameserver launching the user
space qrtr-ns will fail, but typically other services depends on its
presence. As such, go dormant instead of failing when noticed that the
name service is already present.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add qrtr-ns.service template and install this into /lib/systemd/system
after modifying it according to $(DESTDIR) and $(prefix)
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Removing entries from an open addressed hash table creates holes in the
collision chains, preventing previous colliding entries to be found. By
inserting tombstones, rather than clearing deleted entries makes it
possible to distinguish the end of a chain from a hole.
Reviewed-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The dprintf macro shadows a real libc symbol which is called
differently, so we should change it to something else (in this
case LOGD) and change it to use the libqrtr logging facilities.
This also means we should add a minimum priority to the logging
library so we don't log DEBUG-level messages by default.
Additionally there were some warn/warnx calls left over that
have been changed to PLOGW/LOGW respectively.
The DIAG service has its own encoding for the instance number which
is unrelated to the version. This means that the information we
show to the user in the version and instance columns of the table is
parsed incorrectly and often useless. Instead, treat the instance
number as special if the service is a DIAG service and print out a
more meaningful interpretation.
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
The "instance" id of a service is a composition of the instance id and
the version. In some plaeces in the library I made this two half words
instead of the actually expected 8 bits version + 24 bit instance. Fix
this in the library.
This was not spotted previously because all prior work has dealt with
instance id 0, but with the QRTR support in Diag this is now an issue.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Similar to qmi_decode_message(), qmi_decode_header() doesn't modify the
`struct qrtr_packet' argument. This patch makes qmi_decode_header() to
take a `const struct qrtr_packet' argument like qmi_decode_message()
does.
Contributed by Jacob Rutherford <jruthe@chromium.org>
waiter_wait_timeout() doesn't initialize the 'callback' and 'updated'
fields of the waiter_ticket struct. The 'updated' field may contain some
garbage value, which is later read in waiter_ticket_check().
Signed-off-by: Ben Chan <benchan@chromium.org>
This patch adds an extern "C" guard in libqrtr.h, so that it can be
included in both C and C++ projects.
Signed-off-by: Ben Chan <benchan@chromium.org>
This function in qrtr-ns was largely copied from the main
function of qrtr-cfg. We should just factor it out so there is
one implementation instead.
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The __progname symbol is a GNU extension and thus not portable,
but basename (from libgen.h) and argv[0] can be used portably
instead.
(qrtr-lookup already used argv[0] but did not apply basename, so
do that for consisntency.)
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>