Add GNU/Hurd support

This commit is contained in:
Samuel Thibault 2023-09-24 16:17:12 +02:00 committed by Wim Taymans
parent f9559d2e83
commit 8b807ded35
8 changed files with 21 additions and 10 deletions

View file

@ -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);

View file

@ -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