Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Add support for Unix FD passing #62

Merged
merged 1 commit into from
Oct 7, 2017
Merged

Conversation

steffen-kiess
Copy link
Contributor

Add support for Unix FD passing

During compilation, this requires Mono.Posix from mono with commit
2225b6a260e1f0d469e37ec0df68a89e832688cd (i.e. mono 4.6 or later).
During runtime it will fall back to an implementation which does not support
Unix FD passing when the Mono.Posix version is too old.

An example showing how to pass file descriptors can be found in
examples/UnixFD*.cs

This fixes #57

During compilation, this requires Mono.Posix from mono with commit
2225b6a260e1f0d469e37ec0df68a89e832688cd (i.e. mono 4.6 or later).
During runtime it will fall back to an implementation which does not support
Unix FD passing when the Mono.Posix version is too old.

An example showing how to pass file descriptors can be found in
examples/UnixFD*.cs
@directhex
Copy link
Contributor

directhex commented Oct 1, 2017

This builds here, and the provided example service works

directhex@bubblegum:~/Projects/dbus-sharp/examples$ mono --debug UnixFDService.exe
Waiting for requests...
Got FD as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Got FD as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Got FDs as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/7 -> /dev/null
Got FDs as variant parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/7 -> /dev/null
Register for GotFD event at :1.129 / /mono_dbus_sharp_test/Signals
Got FD from signal:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Open FDs:
total 0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 0 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 1 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 2 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 3 -> socket:[128045]
lr-x------ 1 directhex directhex 64 Oct  1 07:48 4 -> /dev/urandom
lrwx------ 1 directhex directhex 64 Oct  1 07:48 5 -> socket:[128046]

I seem to recall offering a £100 bug bounty for this issue

@garuma garuma merged commit 5ff480a into mono:master Oct 7, 2017
garuma added a commit that referenced this pull request Oct 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for UNIX_FD
3 participants