[systemd-devel] Antw: [EXT] D-bus connection Unknown error

2021-03-02 Thread Ulrich Windl
>>> Shiju Email <994...@gmail.com> schrieb am 02.03.2021 um 22:27 in Nachricht
:
> Hi, I am getting an error when any systemctl commands are issued.
> 
> Failed to get D-bus connection: Unknown error -1

I have no idea, but I think "unknown error" is bad programming style; it's
like "something went wrong; go and figure...".

> 
> OS Debian 8.8
> 
> I couldn’t find much traction on this in web. Appreciate your help.
> 
> Thanks
> Joe



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] D-bus connection Unknown error

2021-03-02 Thread Shiju Email
Hi, I am getting an error when any systemctl commands are issued.

Failed to get D-bus connection: Unknown error -1

OS Debian 8.8

I couldn’t find much traction on this in web. Appreciate your help.

Thanks
Joe
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Debugging sd_notify / tracing notifications?

2021-03-02 Thread Simon McVittie
On Mon, 01 Mar 2021 at 10:20:31 -0500, John Ioannidis wrote:
> I occasionally need to send a SIGINT to the process

Have you tried this?

systemctl kill --signal=SIGINT foo.service

(Perhaps with --kill-who=main if you just want to kill its top-level
process and not its child processes, if any)

smcv
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] sdbus errors and their underlaying int value: unique?

2021-03-02 Thread Carlo Wood
On Tue, 2 Mar 2021 10:40:25 +0100
Carlo Wood  wrote:

> I'm not writing my own C++ wrappers around sbus.

I'm now* writing my own C++ wrappers around sbus.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] sdbus errors and their underlaying int value: unique?

2021-03-02 Thread Carlo Wood
Hello,

thank you for you previous help; I made a lot of progress.

I'm not writing my own C++ wrappers around sbus.

I have the following question:

A sd_bus_error has a name (and a message). The name is usually something
like "org.freedesktop.DBus.Error.InvalidArgs" or
"com.alinoe.DBus.Error.test_error" - in other words it contains a
domain, "org.freedesktop.DBus.Error" and "com.alinoe.DBus.Error"
respectively.

In C++ we have std::error_code which stores both a (unique) domain
and an int that is defined within that domain. The integer values
do not have to be globally unique.

For example, org.freedesktop.DBus.Error.InvalidArgs is mapped to
EINVAL which is 22. But can I use 22 too for
com.alinoe.DBus.Error.test_error? This would be fine with
std::error_code; and I'm trying to support conversion from
DBus errors to std::error_code.

For example,

I have a class dbus::Error that simply wraps a sd_bus_error struct.
I can do:

dbus::Error error = function_returning_an_error();

std::error_code code = error;   // Convert sd_bus_error to 
std::error_code.
std::cout << code << " [" << code.message() << "]" << std::endl;

(Can also do std::cout << error, of course, but this is for demonstration)

which could print something like:

com.alinoe.dbus.Error:22 [test_error]

or

org.freedesktop.DBus.Error:22 [Invalid argument]

Adding "com.alinoe.DBus.Error.test_error" to sdbus must be done
as follows:

enum alinoe_dbus_errors {
  test_error = 22   // Is this value allowed?
};

const sd_bus_error_map alinoe_com_errors[] = {
  SD_BUS_ERROR_MAP("com.alinoe.dbus.Error.test_error", test_error),
  SD_BUS_ERROR_MAP_END
};

sd_bus_error_add_map(alinoe_com_errors);

I don't think I can reasonably know which codes (int values) are already
in use: many libraries could add their own errors and I don't know what
that is, or what will be added in the future (ie, to sdbus).

This is why std::error_code doesn't demand the numeric values to be
unique except inside their own domain.

Does sdbus require me to use globally unique integer values?


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel