mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Add support for MidnightBSD
Fix build issue Fix build issue
This commit is contained in:
		
							parent
							
								
									4922aed6c6
								
							
						
					
					
						commit
						6a15a02ec2
					
				
					 20 changed files with 35 additions and 35 deletions
				
			
		| 
						 | 
				
			
			@ -38,7 +38,7 @@
 | 
			
		|||
#ifdef HAVE_PWD_H
 | 
			
		||||
#include <pwd.h>
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(__FreeBSD__)
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
#include <sys/ucred.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -534,7 +534,7 @@ static struct client_data *client_new(struct server *s, int fd)
 | 
			
		|||
	struct pw_impl_client *client;
 | 
			
		||||
	struct pw_protocol *protocol = s->this.protocol;
 | 
			
		||||
	socklen_t len;
 | 
			
		||||
#if defined(__FreeBSD__)
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
	struct xucred xucred;
 | 
			
		||||
#else
 | 
			
		||||
	struct ucred ucred;
 | 
			
		||||
| 
						 | 
				
			
			@ -583,7 +583,7 @@ static struct client_data *client_new(struct server *s, int fd)
 | 
			
		|||
					(int)len, buffer);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#elif defined(__FreeBSD__)
 | 
			
		||||
#elif defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
	len = sizeof(xucred);
 | 
			
		||||
	if (getsockopt(fd, 0, LOCAL_PEERCRED, &xucred, &len) < 0) {
 | 
			
		||||
		pw_log_warn("server %p: no peercred: %m", s);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,7 +152,7 @@ pid_t get_client_pid(struct client *client, int client_fd)
 | 
			
		|||
		pw_log_warn("client %p: no peercred: %m", client);
 | 
			
		||||
	} else
 | 
			
		||||
		return ucred.pid;
 | 
			
		||||
#elif defined(__FreeBSD__)
 | 
			
		||||
#elif defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
	struct xucred xucred;
 | 
			
		||||
	len = sizeof(xucred);
 | 
			
		||||
	if (getsockopt(client_fd, 0, LOCAL_PEERCRED, &xucred, &len) < 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,7 @@
 | 
			
		|||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
#include <sys/thr.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -205,7 +205,7 @@ static pid_t _gettid(void)
 | 
			
		|||
	return (pid_t) gettid();
 | 
			
		||||
#elif defined(__linux__)
 | 
			
		||||
	return syscall(SYS_gettid);
 | 
			
		||||
#elif defined(__FreeBSD__)
 | 
			
		||||
#elif defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
	long pid;
 | 
			
		||||
	thr_self(&pid);
 | 
			
		||||
	return (pid_t)pid;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@
 | 
			
		|||
#ifdef HAVE_PWD_H
 | 
			
		||||
#include <pwd.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
#define O_PATH 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@
 | 
			
		|||
PW_LOG_TOPIC_EXTERN(log_mem);
 | 
			
		||||
#define PW_LOG_TOPIC_DEFAULT log_mem
 | 
			
		||||
 | 
			
		||||
#if !defined(__FreeBSD__) && !defined(HAVE_MEMFD_CREATE)
 | 
			
		||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(HAVE_MEMFD_CREATE)
 | 
			
		||||
/*
 | 
			
		||||
 * No glibc wrappers exist for memfd_create(2), so provide our own.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ static inline int memfd_create(const char *name, unsigned int flags)
 | 
			
		|||
#define HAVE_MEMFD_CREATE 1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
#define MAP_LOCKED 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -491,7 +491,7 @@ struct pw_memblock * pw_mempool_alloc(struct pw_mempool *pool, enum pw_memblock_
 | 
			
		|||
		pw_log_error("%p: Failed to create memfd: %m", pool);
 | 
			
		||||
		goto error_free;
 | 
			
		||||
	}
 | 
			
		||||
#elif defined(__FreeBSD__)
 | 
			
		||||
#elif defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
	b->this.fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0);
 | 
			
		||||
	if (b->this.fd == -1) {
 | 
			
		||||
		res = -errno;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ libpipewire_c_args = [
 | 
			
		|||
  '-DOLD_MEDIA_SESSION_WORKAROUND=1'
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
if build_machine.system() != 'freebsd'
 | 
			
		||||
if build_machine.system() != 'freebsd' and build_machine.system() != 'midnightbsd'
 | 
			
		||||
  libpipewire_c_args += [
 | 
			
		||||
    '-D_POSIX_C_SOURCE'
 | 
			
		||||
  ]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@
 | 
			
		|||
#include <unistd.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#ifndef __FreeBSD__
 | 
			
		||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
 | 
			
		||||
#include <sys/prctl.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <pwd.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -746,7 +746,7 @@ static void init_prgname(void)
 | 
			
		|||
	static char name[PATH_MAX];
 | 
			
		||||
 | 
			
		||||
	spa_memzero(name, sizeof(name));
 | 
			
		||||
#if defined(__linux__) || defined(__FreeBSD_kernel__)
 | 
			
		||||
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__MidnightBSD_kernel__)
 | 
			
		||||
	{
 | 
			
		||||
		if (readlink("/proc/self/exe", name, sizeof(name)-1) > 0) {
 | 
			
		||||
			prgname = strrchr(name, '/') + 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -754,7 +754,7 @@ static void init_prgname(void)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#if defined __FreeBSD__
 | 
			
		||||
#if defined __FreeBSD__ || defined(__MidnightBSD__)
 | 
			
		||||
	{
 | 
			
		||||
		ssize_t len;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -764,7 +764,7 @@ static void init_prgname(void)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef __FreeBSD__
 | 
			
		||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
 | 
			
		||||
	{
 | 
			
		||||
		if (prctl(PR_GET_NAME, (unsigned long) name, 0, 0, 0) == 0) {
 | 
			
		||||
			prgname = name;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ extern "C" {
 | 
			
		|||
#include <spa/utils/result.h>
 | 
			
		||||
#include <spa/utils/type-info.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
struct ucred {
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,9 +62,9 @@ error:
 | 
			
		|||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#if __FreeBSD_version < 1202000
 | 
			
		||||
#if __FreeBSD_version < 1202000 || defined(__MidnightBSD__)
 | 
			
		||||
int pthread_setname_np(pthread_t thread, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	pthread_set_name_np(thread, name);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
#include <signal.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#ifndef __FreeBSD__
 | 
			
		||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
 | 
			
		||||
#include <alloca.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <getopt.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue