Working around platform limitations on GetConnectionUnixProcessID?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Sat Apr 19 22:11:48 UTC 2025


On Sat, 19 Apr 2025 17:08:41 +0200, René J.V. Bertin wrote:

> As far as I understand it is impossible to have a working
> GetConnectionUnixProcessID request on Darwin (Mac OS).

Surely, that is built on top of getsockopt(... SO_PEERCRED ...), which
should be supported on the BSDs. From which macOS/Darwin is derived.

The invocation procedure may be slightly different from Linux
<https://forums.freebsd.org/threads/obtaining-user-credentials-through-a-unix-domain-socket.87923/>
<https://unix.stackexchange.com/questions/496577/different-order-for-getsockopt-so-peercred-in-linux-and-openbsd>
(just some random relevant links I found from a quick search).

Seems there was also an issue with lack of socketpair(2) support, but
that has now been fixed
<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=176419>.


More information about the dbus mailing list