首先,dbus是利用了dbus这种机制来实现与进程的交互。
在交互当中,连接时,需要提供busname、object-path、interface.
如何理解,上面这三个东西,是理解dbus应用的关键:
busname是程序的名字,是在service文件当中指定的。
如下面所示:
如下面所示:
[root@proEnv23 ~]# cat /usr/lib/systemd/system/systemd-timedated.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Time & Date Service
Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated
[Service]
ExecStart=/usr/lib/systemd/systemd-timedated
BusName=org.freedesktop.timedate1
CapabilityBoundingSet=CAP_SYS_TIME
WatchdogSec=1min
PrivateTmp=yes
ProtectSystem=yes
ProtectHome=yes
[root@proEnv23 ~]# gdbus introspect --system --dest org.freedesktop.timedate1
Error: Object path is not specified
[root@proEnv23 ~]#
object-path是对象的路径,其实现了下面的interface的接口。
interface是接口。
来源:CSDN
作者:如山石
链接:https://blog.csdn.net/maokexu123/article/details/52850857