Index: src/modules/module-protocol-pulse/utils.c
--- src/modules/module-protocol-pulse/utils.c.orig
+++ src/modules/module-protocol-pulse/utils.c
@@ -78,6 +78,7 @@ int get_runtime_dir(char *buf, size_t buflen)
 
 int check_flatpak(struct client *client, pid_t pid)
 {
+#ifdef __linux__
 	char root_path[2048];
 	int root_fd, info_fd, res;
 	struct stat stat_buf;
@@ -120,13 +121,20 @@ int check_flatpak(struct client *client, pid_t pid)
 	}
 	close(info_fd);
 	return 1;
+#else
+	return 0;
+#endif
 }
 
 pid_t get_client_pid(struct client *client, int client_fd)
 {
 	socklen_t len;
+#if defined(__linux__) || defined(__OpenBSD__)
 #if defined(__linux__)
 	struct ucred ucred;
+#else
+	struct sockpeercred ucred;
+#endif
 	len = sizeof(ucred);
 	if (getsockopt(client_fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) {
 		pw_log_warn("client %p: no peercred: %m", client);
