Created attachment 214123 [details] libwayland-creds.patch 1) who wrote getsockopt(fd, SOL_SOCKET, LOCAL_PEERCRED)? that's wrong! with SOL_SOCKET, the value of LOCAL_PEERCRED (1) is interpreted as SO_DEBUG (1). 2) we do have the pid in xucred since r348419, let's use it.
cr_pid is no longer a macro, it was changed (in head) in base r348847. It does not exist at all in FreeBSD 11 or 12.
Created attachment 214128 [details] libwayland-creds.patch v2 oh. __FreeBSD_version it is, then.
Comment on attachment 214128 [details] libwayland-creds.patch v2 > +#if __FreeBSD_version >= 1300030 Can be simplified to defined(__FreeBSD__) && __FreeBSD__ >= 13 to drop <sys/param.h>. Checking __FreeBSD_version is only useful on /stable branches. On -CURRENT only the tip is supported. Some folks try to smooth the ride for week/months old snapshots but... base r348419 is almost 1 year old. Curiously, that commit was also tagged for MFC which didn't happen.
FWIW, the patch fixes pid reporting for Wayland clients in x11-wm/sway e.g., $ mpv /path/to/file.mp4 $ MOZ_ENABLE_WAYLAND=1 firefox example.com # Before $ swaymsg -t get_tree | jq 'recurse(.nodes[]) | select(.shell == "xdg_shell") | .pid' 0 0 # After $ swaymsg -t get_tree | jq 'recurse(.nodes[]) | select(.shell == "xdg_shell") | .pid' 15582 58058
(In reply to Jan Beich from comment #3) > Can be simplified to defined(__FreeBSD__) && __FreeBSD__ >= 13 tbh, maybe the whole HAVE_SYS_UCRED_H thing should just be __FreeBSD__. There's no guarantee that other systems don't have a sys/ucred.h that contains completely different stuff. We've had that with Linux capabilities vs Capsicum..
Isn't it better to have a proper configure (or meson) check for ucred and for cr_pid? I've also asked why the base changes weren't merged to 12, they look like they're useful (in this context).
Build info is available at https://gitlab.com/swills/freebsd-ports/pipelines/147746188
(In reply to Niclas Zeising from comment #6) > I've also asked why the base changes weren't merged to 12 So what was the response? Looking at bug 215202 no one else asked.
Ping. See also sysutils/seatd/files/patch-pid and https://github.com/rust-lang/rust/pull/75148
Ping. I've filed bug 246189 due to current maintainer being too passive.
(In reply to Jan Beich from comment #10) I guess you meant to paste another number? bug 246189 is *this* bug :)
Looks ok to me but untested.
A commit references this bug: Author: jbeich Date: Fri Jan 29 11:02:59 UTC 2021 New revision: 563194 URL: https://svnweb.freebsd.org/changeset/ports/563194 Log: graphics/wayland: update to 1.19.0 - Fix wl_client_get_credentials [1] Changes: https://gitlab.freedesktop.org/wayland/wayland/compare/1.18.0...1.19.0 PR: 246189 [1] Submitted by: Greg V [1] Approved by: manu Differential Revision: https://reviews.freebsd.org/D28399 Changes: head/graphics/wayland/Makefile head/graphics/wayland/distinfo head/graphics/wayland/files/patch-src_meson.build head/graphics/wayland/files/patch-src_wayland-server.c