glib - DBus,未能获得系统范围的名称

标签 glib dbus

我正在使用 gio,以及这个 DBus 实现来注册某个守护进程的内部对象。我使用 SESSION 范围的 Dbus 进行了所有测试,一切正常,但我尝试使用系统范围的注册,因为我的名称注册失败。

我正在使用 g_bus_own_name 获取名称,我的错误案例响应 bus_acquired_handler 然后 name_lost_handler 场景。

任何想法,我该如何解决这个问题,或者我如何获得有关错误的更多信息?

GIO:https://developer.gnome.org/gio/2.38/gio-Owning-Bus-Names.html#g-bus-own-name

这是 dbus-monitor 跟踪:

signal sender=org.freedesktop.DBus -> dest=:1.96 serial=2 path=/org/freedesktop/DBus;接口(interface)=org.freedesktop.DBus; member=NameAcquired
字符串 ":1.96"


signal sender=:1.95 -> dest=(null destination) serial=3 path=/org/ast/AstCore;接口(interface)=org.freedesktop.DBus.Properties;成员=属性更改
字符串“org.ast.AstCore”
数组 [
字典条目(
字符串“状态”
变体 int32 3
)
]
数组 [
]


signal sender=:1.95 -> dest=(null destination) serial=5 path=/org/ast/AstCore;接口(interface)=org.freedesktop.DBus.Properties;成员=属性更改
字符串“org.ast.AstCore”
数组 [
字典条目(
字符串“状态”
变体 int32 4
)
]
数组 [
]


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=173 path=/org/freedesktop/DBus;接口(interface)=org.freedesktop.DBus;成员=NameOwnerChanged
字符串 ":1.95"
字符串 ":1.95"
字符串 ""


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=174 path=/org/freedesktop/DBus;接口(interface)=org.freedesktop.DBus;成员=NameOwnerChanged
字符串“:1.97”
字符串""
字符串 ":1.97"


最佳答案

如/etc/dbus-1/system.conf 中所述

<!-- Holes must be punched in service configuration files for
     name ownership and sending method calls -->
<deny own="*"/>
...

在/etc/dbus-1/system.d/中添加您自己的配置文件(例如 astcore.conf),以允许您的应用拥有特定的总线名称。

关于glib - DBus,未能获得系统范围的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20298962/

相关文章:

linux - 系统 D-Bus 不允许使用 conf 文件取消所有权

python - GLib.idle_add(function) 对不同的函数有不同的策略

c - GList 行为错误 - 下一个大小无效(正常)

java - java 中的 g_ascii_strcasecmp 等效项

linux - 如何通过 gdbus 发送字典数据类型( a{ias} )?

dbus - 如何使用 dbus-send 设置变体数组?

c - 在不调用 g_main_loop_run 的情况下使用 glib?

c - 为什么 GLib 会重新定义类型?

gnome - gnome-desktop docker镜像可用于Linux Mint Host,但不能与CentOS一起使用?

javascript - 如何使用 npm dbus-network-manager 更改以太网接口(interface)的 IP 地址?