LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
331 stars 75 forks source link

Support for passing and receiving Unix file descriptors #86

Open molobrakos opened 5 years ago

molobrakos commented 5 years ago

Closes https://github.com/LEW21/pydbus/issues/42, https://github.com/LEW21/pydbus/issues/54

(Maybe of interest to anyone: the branch https://github.com/molobrakos/pydbus/tree/master%2Basync%2Bunixfd contains support for both unix file descriptors as well as the support for asynchronous calls by @poncova in (https://github.com/poncovka/pydbus/commit/5e2b4d2e32db8b8842188d8915f3932bae594cd5 - merging these two were a little bit messy since they are touching the same code)

Semantics for file descriptor ownership should probably be described in the documentation. Any file descriptor as out parameter will be closed by the dbus interface and should not be closed by the sender (just passed as return). Any file desciptor as in-parameter is only valid for the duration of the call and will be closed by the dbus interface. If the receiver wants to keep it, it should be duplicated using os.dup.

phillebaba commented 5 years ago

Any possibility for this to be merged and included into a new release @LEW21?

ppareit commented 4 years ago

pydbus is a nice library, unfortunately I'm unable to use it. I need to call some dbus function that returns a file discriptor. This patch could fix this! Hope you look into this @LEW21 ?

mpflanzer commented 1 year ago

Is there anything which prevents this from being merged? Would be really nice to have this in a release.

poncovka commented 1 year ago

Is there anything which prevents this from being merged? Would be really nice to have this in a release.

Hi! Our team stopped using pydbus some time ago due to some issues and missing features and wrote the dasbus library. Recently, we have added support for Unix file descriptors (https://dasbus.readthedocs.io/en/latest/examples.html#support-for-unix-file-descriptors). It might help you with your use case as well.