dbus as the IPC sync method
yinxiaobiao at gmail.com
Mon Dec 26 18:04:42 PST 2011
These days,I wanted to use dbus as the IPC sync method between
two machines(or two virtue machines,or two IPC namespace such as lxc).
Semaphore and signal can not be used anymore(can not go throuth os & cpu).
The attached file is from the dbus-example,and I did a little
modify to enable sync between send and receive.and the compile cmd is
gcc -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include/ -ldbus-1
dbus-example.c -o dbus-example
The primary thought is to write a loop to listen(read and write)
the connection at the sender site after send a signal.
In the receive site will give a reply to sender.When the sender
receives the reply from receiver,just breaks the loop and goes on left
Actually,I am using the lxc(new PID/IPC namespace) for
isolation,and is required to execute as root(imexplicity calls
clone()).When I execute
root at yinxb:/home/yinxb/Downloads/dbus_test/dbus-example2#
and unluckly gets the following message:
Connection Error (Did not receive a reply. Possible causes include:
the remote application did not send a reply, the message bus security
policy blocked the reply, the reply timeout expired, or the network
connection was broken.)
I also tried the DBUS_BUS_SYSTEM,and the get following message
Connection Error (Failed to connect to socket
/var/run/dbus/system_bus_socket: No such file or directory)
I also search the maillist ,and cannot find any information.
Can anyone give me a hint and how to fix this?
Thanks in advance
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15946 bytes
Desc: not available
More information about the dbus