mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-02 22:25:17 +00:00
Add GNU/Hurd support
This commit is contained in:
parent
f9559d2e83
commit
8b807ded35
|
@ -11,10 +11,11 @@
|
|||
#define ARRAY_SIZE 63
|
||||
#define MAX_VALUE 0x10000
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined (__GNU__)
|
||||
#include <sys/param.h>
|
||||
#if (__FreeBSD_version >= 1400000 && __FreeBSD_version < 1400043) \
|
||||
|| (__FreeBSD_version < 1300523) || defined(__MidnightBSD__)
|
||||
|| (__FreeBSD_version < 1300523) || defined(__MidnightBSD__) \
|
||||
|| defined (__GNU__)
|
||||
static int sched_getcpu(void) { return -1; };
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -143,7 +143,7 @@ static int get_exe_name(int pid, char *buf, size_t buf_size)
|
|||
* (in the current namespace).
|
||||
*/
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__GNU__)
|
||||
spa_scnprintf(path, sizeof(path), "/proc/%u/exe", pid);
|
||||
#elif defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
spa_scnprintf(path, sizeof(path), "/proc/%u/file", pid);
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
#include <sys/thr.h>
|
||||
#endif
|
||||
#if defined(__GNU__)
|
||||
#include <mach.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
@ -221,6 +224,9 @@ static pid_t _gettid(void)
|
|||
long pid;
|
||||
thr_self(&pid);
|
||||
return (pid_t)pid;
|
||||
#elif defined(__GNU__)
|
||||
mach_port_t thread = mach_thread_self();
|
||||
return (pid_t)thread;
|
||||
#else
|
||||
#error "No gettid impl"
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__)
|
||||
#ifndef O_PATH
|
||||
#define O_PATH 0
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
PW_LOG_TOPIC_EXTERN(log_mem);
|
||||
#define PW_LOG_TOPIC_DEFAULT log_mem
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(HAVE_MEMFD_CREATE)
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) \
|
||||
&& !defined(HAVE_MEMFD_CREATE)
|
||||
/*
|
||||
* No glibc wrappers exist for memfd_create(2), so provide our own.
|
||||
*
|
||||
|
@ -42,7 +43,7 @@ static inline int memfd_create(const char *name, unsigned int flags)
|
|||
#define HAVE_MEMFD_CREATE 1
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__)
|
||||
#define MAP_LOCKED 0
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
|
@ -720,7 +720,7 @@ static void init_prgname(void)
|
|||
static char name[PATH_MAX];
|
||||
|
||||
spa_memzero(name, sizeof(name));
|
||||
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__MidnightBSD_kernel__)
|
||||
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__MidnightBSD_kernel__) || defined(__GNU__)
|
||||
{
|
||||
if (readlink("/proc/self/exe", name, sizeof(name)-1) > 0) {
|
||||
prgname = strrchr(name, '/') + 1;
|
||||
|
@ -738,7 +738,7 @@ static void init_prgname(void)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__)
|
||||
{
|
||||
if (prctl(PR_GET_NAME, (unsigned long) name, 0, 0, 0) == 0) {
|
||||
prgname = name;
|
||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/type-info.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__)
|
||||
struct ucred {
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,9 @@ int pthread_setname_np(pthread_t thread, const char *name)
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__GNU__)
|
||||
int pthread_setname_np(pthread_t thread, const char *name) { return 0; }
|
||||
#endif
|
||||
|
||||
static struct spa_thread *impl_create(void *object,
|
||||
const struct spa_dict *props,
|
||||
|
|
Loading…
Reference in a new issue