Abstract UNIX domain socket support
First of all, thank you for this library!
I have a question/potential issue with systemd version 208
It seems my platform exposes notify socket like so:
u_dgr UNCONN 0 0 @/org/freedesktop/systemd1/notify 7815 * 0 users:(("systemd",1,7))
Which means that this is abstract UNIX domain socket
In my app: SystemdNotify.ready("some info") fails with (stack edited):
com.sun.jna.LastErrorException: [107] Transport endpoint is not connected
at info.faljse.SDNotify.jna.CLibrary.send(Native Method)
at info.faljse.SDNotify.io.NativeDomainSocket.send(NativeDomainSocket.java:58)
at info.faljse.SDNotify.SDNotify.sendString(SDNotify.java:193)
at info.faljse.SDNotify.SDNotify.sendNotify(SDNotify.java:70)
I have a suspicion that the @ character should by manually swapped into NULL byte before using here:
CLibrary.SockAddr sockAddr = new CLibrary.SockAddr(socketName);
sd = new NativeDomainSocket();
sd.connect(sockAddr);
Could you confirm it is indeed an issue?
If not, could you help me understand the problem with [107] Transport endpoint is not connected?
Hi, thanks for reporting - i will have a look at it at the weekend.
What Platform does this happen on? Is it newer systemd in general or a specific distribution?
Thank you
I've reproduced this using following platform
Vagrant.configure("2") do |config|
config.vm.box = "mrlesmithjr/trusty64"
config.vm.hostname = "clean"
end
Old Ubuntu Trusty64 (I had to install systemd), which uses abstract unix socket
import info.faljse.SDNotify.SDNotify
object Main {
def main(args: Array[String]): Unit = {
val s = System.getenv("NOTIFY_SOCKET")
println(s"socket: $s")
SDNotify.sendStatus("hi")
println("end")
}
}
I think that swapping @ with NULL byte will solve this
fixed in 1.5