gpt4 book ai didi

linux - 几个基本的dbus问题

转载 作者:太空宇宙 更新时间:2023-11-04 09:42:34 28 4
gpt4 key购买 nike

我是 dbus 的新手,我想了解如何使用它,但我似乎找不到我想要的答案。

我是否可以发明自己的服务名称,只要它们是唯一的并且不与任何其他服务名称冲突?

当我调用 dbus_bus_request_name() 请求我自己的服务名称时,我收到一条错误消息,指出由于配置文件中的安全策略,我不允许拥有该服务。查看/etc/dbus-1 配置目录,似乎有一个系统配置文件 (/etc/dbus-1/system.conf),然后是用于各种服务的其他配置文件的子目录 (/etc/dbus-1/system.d 子目录)。

我使用其他 .conf 文件作为示例为我的服务名称添加了一个配置文件。但我没有看到 system.conf 文件读取任何单独的 .conf 文件。我假设各个配置文件将以某种方式被读取是否正确?那么,在编辑 system.d 目录中的单个 .conf 文件后,或者像我一样添加新的服务配置文件后,如何让系统总线重新读取 system.conf 文件?

这是配置系统总线的正确方法吗,这样我就可以有 2 个进程传递消息?我的应用程序是一个由多个进程组成的封闭应用程序,因此我打算通过系统 dbus 进行的唯一通信只会在我自己的进程之间进行,而不是任何其他公共(public)或其他众所周知的服务。

谢谢,

-安德烈斯

最佳答案

Am I correct that I can invent my own service names as long as they are unique and do not conflict with any other service names?

When I call dbus_bus_request_name() requesting my own service name, I get an error that says I am not allowed to own that service due to security policies in the configuration file.

我猜你正在使用 SYSTEM 总线。除非有使用 SYSTEM 总线的理由,否则使用 SESSION 总线更容易,尤其是对于测试而言。 SYSTEM 总线还使用其他安全措施来确保系统的安全性,查看一些服务的配置文件,它们展示了如何允许某些服务在总线上拥有特定的名称。

Am I correct to assume that the individual config files will get read in somehow?

是的,如果您查看 system.conf,您可以看到 <includedir>标签,它将包括该目录中的所有内容。

So how do I get the system bus to re-read the system.conf file after editing one of the individual .conf files in the system.d directory, or after added a new service config file like I did?

发送SIGHUP到 dbus 守护进程。

Is this the proper way to configure the system bus so I can have 2 process pass messages?

这应该有效。

关于linux - 几个基本的dbus问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19969480/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com