1 diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
2 index 06ca90564f0..bb244f8f358 100644
3 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
4 +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
9 +#include <sys/types.h>
10 #include "util/list.h"
11 #include "util/rwlock.h"
12 #include "ac_gpu_info.h"
13 diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
14 index 22f99c41909..2f3195926be 100644
15 --- a/src/gallium/drivers/freedreno/freedreno_util.h
16 +++ b/src/gallium/drivers/freedreno/freedreno_util.h
17 @@ -108,6 +108,8 @@ extern bool fd_binning_enabled;
18 #include <sys/types.h>
19 #include <sys/syscall.h>
21 +#define gettid() ((pid_t)syscall(SYS_gettid))
23 #define DBG(fmt, ...) \
26 diff --git a/src/gallium/frontends/nine/nine_debug.c b/src/gallium/frontends/nine/nine_debug.c
27 index f3a6a945025..f4a6c41a612 100644
28 --- a/src/gallium/frontends/nine/nine_debug.c
29 +++ b/src/gallium/frontends/nine/nine_debug.c
30 @@ -65,7 +65,7 @@ _nine_debug_printf( unsigned long flag,
32 static boolean first = TRUE;
33 static unsigned long dbg_flags = DBG_ERROR | DBG_WARN;
34 - unsigned long tid = 0;
39 @@ -74,7 +74,7 @@ _nine_debug_printf( unsigned long flag,
41 #if defined(HAVE_PTHREAD)
42 if (dbg_flags & DBG_TID)
43 - tid = (unsigned long)pthread_self();
44 + tid = pthread_self();
47 if (dbg_flags & flag) {
48 diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
49 index 81b64f1ea71..56ebd2eccdf 100644
50 --- a/src/util/rand_xor.c
51 +++ b/src/util/rand_xor.c
53 #if defined(HAVE_GETRANDOM)
54 #include <sys/random.h>
56 +#include <sys/types.h> /* size_t, ssize_t */