Skip to content

Add FreeBSD support for peer process identification#25

Merged
vaxerski merged 2 commits into
hyprwm:mainfrom
tagattie:freebsd-peercred
Apr 28, 2026
Merged

Add FreeBSD support for peer process identification#25
vaxerski merged 2 commits into
hyprwm:mainfrom
tagattie:freebsd-peercred

Conversation

@tagattie

Copy link
Copy Markdown
Contributor

This PR enables CServerClient to correctly retrieve the peer's PID on FreeBSD.

SO_PEERCRED is not available on FreeBSD. Instead, it uses LOCAL_PEERCRED with struct xucred to obtain socket peer credentials. The changes include:

  • Includes necessary headers (<sys/ucred.h> and <sys/un.h>)
  • Implements the credential retrieval logic using LOCAL_PEERCRED
  • Correctly maps cr_pid to m_pid

Also this PR adds a missing include in tests/Fork.cpp.

SO_PEERCRED is not available on FreeBSD. Instead it uses LOCAL_PEERCRED with struct xucred to obtain socket peer credentials.

@vaxerski vaxerski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@vaxerski vaxerski merged commit 04be289 into hyprwm:main Apr 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants