summaryrefslogtreecommitdiff
path: root/x11/waycheck/files
diff options
context:
space:
mode:
Diffstat (limited to 'x11/waycheck/files')
-rw-r--r--x11/waycheck/files/patch-meson.build15
-rw-r--r--x11/waycheck/files/patch-src_meson.build10
-rw-r--r--x11/waycheck/files/patch-src_window.cpp56
3 files changed, 81 insertions, 0 deletions
diff --git a/x11/waycheck/files/patch-meson.build b/x11/waycheck/files/patch-meson.build
new file mode 100644
index 000000000000..882534abc553
--- /dev/null
+++ b/x11/waycheck/files/patch-meson.build
@@ -0,0 +1,15 @@
+--- meson.build.orig 2025-08-27 20:19:12 UTC
++++ meson.build
+@@ -16,6 +16,12 @@ dep_wayland_client = dependency('wayland-client')
+ )
+ dep_wayland_client = dependency('wayland-client')
+
++cc = meson.get_compiler('cpp')
++dep_libutil = dependency('', required : false)
++if host_machine.system() == 'freebsd'
++ dep_libutil = cc.find_library('util', required : true)
++endif
++
+ datadir = get_option('datadir')
+
+ subdir('src')
diff --git a/x11/waycheck/files/patch-src_meson.build b/x11/waycheck/files/patch-src_meson.build
new file mode 100644
index 000000000000..decf26941ea7
--- /dev/null
+++ b/x11/waycheck/files/patch-src_meson.build
@@ -0,0 +1,10 @@
+--- src/meson.build.orig 2025-08-27 20:18:18 UTC
++++ src/meson.build
+@@ -15,6 +15,6 @@ waycheck = executable(
+ waycheck = executable(
+ 'waycheck',
+ sources: waycheck_sources,
+- dependencies: [dep_qt6, dep_wayland_client],
++ dependencies: [dep_qt6, dep_wayland_client, dep_libutil],
+ install: true,
+ )
diff --git a/x11/waycheck/files/patch-src_window.cpp b/x11/waycheck/files/patch-src_window.cpp
new file mode 100644
index 000000000000..6e976a9c5ffb
--- /dev/null
+++ b/x11/waycheck/files/patch-src_window.cpp
@@ -0,0 +1,56 @@
+--- src/window.cpp.orig 2025-06-27 19:43:51 UTC
++++ src/window.cpp
+@@ -13,7 +13,24 @@
+ #include <unistd.h>
+ #include <wayland-client-protocol.h>
+
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/ucred.h>
++#include <sys/un.h>
++#include <sys/user.h>
++#include <libutil.h>
++#endif
++
+ static pid_t pid_from_fd(const int fd) {
++#if defined(__FreeBSD__)
++ xucred cred{};
++ socklen_t len = sizeof(struct xucred);
++ if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERCRED, &cred, &len) == -1) {
++ perror("getsockopt failed");
++ exit(1);
++ }
++ return cred.cr_pid;
++#else
+ ucred cred{};
+ socklen_t len = sizeof(struct ucred);
+ if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) == -1) {
+@@ -21,9 +38,19 @@ static pid_t pid_from_fd(const int fd) {
+ exit(1);
+ }
+ return cred.pid;
++#endif
+ }
+
+ static std::string process_name_from_pid(const pid_t pid) {
++#if defined(__FreeBSD__)
++ struct kinfo_proc *proc = kinfo_getproc(pid);
++
++ if (proc) {
++ std::string out = proc->ki_comm;
++ free(proc);
++ return out;
++ }
++#else
+ const std::string procpath = QString::asprintf("/proc/%d/comm", pid).toStdString();
+
+ std::ifstream infile(procpath);
+@@ -38,7 +65,7 @@ static std::string process_name_from_pid(const pid_t p
+ // running in a flatpak or a snap, most likely
+ return "Unknown (Sandboxed)";
+ }
+-
++#endif
+ return "Unknown";
+ }
+