Closed drivera73 closed 1 year ago
Reading up on this old issue it seems that my problem is the reverse: how to receive FDs from the base DBus process (specifically, systemd-logind).
Ok so using that nativefd library did fix the problem.
Regardless, perhaps you should add a mechanism for the library to check with the selected transport to see if FD passing is supported, and turn it off accordingly.
Still, great work! This has helped me a ton!
Now all I have to do is figure out how to close that FD! But jnr-posix (already pulled in from the dbus-java-nativefd library) solves that problem for me!
Question: why don't you merge the dbus-java-nativefd library into the base code? Seems like it might be a good idea to have it all in one place...
When trying to invoke systemd-logind's Inhibit functionality to keep the system from sleeping while a critical task is completed, it turns out that the library chokes when examining the return value (which is of type "h").
Please see the difference between the screenshot from d-feet (left), and the one from dj-feet (right).
For convenience, here are the method coordinates and signature (for copy+paste):
The issue seems to be that file descriptors aren't ever handled during message construction, and even if they were, the collection is never submitted because it's always given as null:
Specifically, I believe the problem is that the list of file descriptors is expected to be retrieved during message decoding, but no effort is done towards that. Thus, there are no file descriptors received out-of-band, and when the code attempts to access the "n-th" file descriptor as described in the response, everything blows up because all indexes will be out of range (i.e. no FD's to choose from).
For reference, using the below code I was able to correctly listen for, and handle the PrepareForSleep signal as intended, which was nice :).
Here's the Java code for the interface in question:
PS/ I'm well aware that once I have that
FileDescriptor
instance, I'll have a whole other problem in my hands with regards to how toclose()
it ... but I'll cross that bridge when I get to it. I'm desperately trying to avoid native code, but I may not have a choice...Regardless, it's moot until the above issue is fixed!