diff --git a/src/nvim/os/proc.c b/src/nvim/os/proc.c index 5e87f09a93..275a82c41c 100644 --- a/src/nvim/os/proc.c +++ b/src/nvim/os/proc.c @@ -25,13 +25,15 @@ # include #endif -#if defined(__APPLE__) || defined(BSD) +// Exclude GNU Hurd since glibc defines BSD but lacks sysctl.h +#if defined(__APPLE__) || (defined(BSD) && !defined(__gnu_hurd__)) # include # include "nvim/macros_defs.h" #endif -#if defined(__linux__) +// Group Hurd with Linux, as both use glibc and standard POSIX interfaces here +#if defined(__linux__) || defined(__gnu_hurd__) # include #endif @@ -147,7 +149,7 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count) } while (Process32Next(h, &pe)); CloseHandle(h); -#elif defined(__APPLE__) || defined(BSD) +#elif defined(__APPLE__) || (defined(BSD) && !defined(__gnu_hurd__)) # if defined(__APPLE__) # define KP_PID(o) o.kp_proc.p_pid # define KP_PPID(o) o.kp_eproc.e_ppid @@ -201,7 +203,7 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count) return 1; // Process not found. } -#elif defined(__linux__) +#elif defined(__linux__) || defined(__gnu_hurd__) char proc_p[256] = { 0 }; // Collect processes whose parent matches `ppid`. // Rationale: children are defined in thread with same ID of process.