1 diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
2 index fadb15d..0490dcc 100644
3 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
4 +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
6 // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
7 // of lacros-chrome is complete.
8 #if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
9 +#if defined(__GLIBC__)
10 #include <gnu/libc-version.h>
13 #include "base/linux_util.h"
14 #include "base/strings/string_split.h"
15 @@ -325,7 +327,7 @@ void RecordLinuxDistro() {
16 void RecordLinuxGlibcVersion() {
17 // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
18 // of lacros-chrome is complete.
19 -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
20 +#if (defined(OS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS_LACROS)
21 base::Version version(gnu_get_libc_version());
23 UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE;
24 diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
25 index 0bb9da1..61af776 100644
26 --- a/net/dns/dns_config_service_posix.cc
27 +++ b/net/dns/dns_config_service_posix.cc
28 @@ -93,7 +93,7 @@ base::Optional<DnsConfig> ReadDnsConfig() {
30 base::Optional<DnsConfig> dns_config;
31 // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
32 -#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
33 +#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || defined(_GNU_SOURCE)
34 // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
35 // res_init behaves the same way.
36 memset(&_res, 0, sizeof(_res));
37 diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
38 index f5b86a7..2762d60 100644
39 --- a/sandbox/linux/seccomp-bpf/trap.cc
40 +++ b/sandbox/linux/seccomp-bpf/trap.cc
41 @@ -174,7 +174,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
42 // If the version of glibc doesn't include this information in
43 // siginfo_t (older than 2.17), we need to explicitly copy it
44 // into an arch_sigsys structure.
45 - memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
46 + memcpy(&sigsys, &info->__sifields, sizeof(sigsys));
50 diff --git a/sandbox/linux/suid/process_util.h b/sandbox/linux/suid/process_util.h
51 index 10071d3..0856910 100644
52 --- a/sandbox/linux/suid/process_util.h
53 +++ b/sandbox/linux/suid/process_util.h
56 #include <sys/types.h>
58 +// Some additional functions
59 +# define TEMP_FAILURE_RETRY(expression) \
61 + ({ long int __result; \
62 + do __result = (long int) (expression); \
63 + while (__result == -1L && errno == EINTR); \
67 // This adjusts /proc/process/oom_score_adj so the Linux OOM killer
68 // will prefer certain process types over others. The range for the
69 // adjustment is [-1000, 1000], with [0, 1000] being user accessible.
70 diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc
71 index 71b901f..f33aba0 100644
72 --- a/third_party/blink/renderer/platform/wtf/stack_util.cc
73 +++ b/third_party/blink/renderer/platform/wtf/stack_util.cc
74 @@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
75 // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
76 // correctly for the main thread.
78 -#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
79 +#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
81 // pthread_getattr_np() can fail if the thread is not invoked by
82 // pthread_create() (e.g., the main thread of blink_unittests).
83 @@ -97,7 +97,7 @@ return Threading::ThreadStackSize();
86 void* GetStackStart() {
87 -#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
88 +#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
92 diff --git a/third_party/ffmpeg/libavutil/cpu.c b/third_party/ffmpeg/libavutil/cpu.c
93 index 52f6b9a..8da9488 100644
94 --- a/third_party/ffmpeg/libavutil/cpu.c
95 +++ b/third_party/ffmpeg/libavutil/cpu.c
97 #include <sys/param.h>
99 #include <sys/types.h>
100 -#include <sys/sysctl.h>
104 diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
105 index 8d4e4d2..45d589b 100644
106 --- a/third_party/lss/linux_syscall_support.h
107 +++ b/third_party/lss/linux_syscall_support.h
108 @@ -139,12 +139,14 @@ extern "C" {
110 #pragma push_macro("stat64")
111 #pragma push_macro("fstat64")
112 +#pragma push_macro("fstatat64")
113 #pragma push_macro("lstat64")
114 #pragma push_macro("pread64")
115 #pragma push_macro("pwrite64")
116 #pragma push_macro("getdents64")
123 @@ -1303,6 +1305,12 @@ struct kernel_statfs {
124 #ifndef __NR_getrandom
125 #define __NR_getrandom 318
129 +#define __NR_pread __NR_pread64
131 +#define __NR_pwrite __NR_pwrite64
133 /* End of x86-64 definitions */
134 #elif defined(__mips__)
135 #if _MIPS_SIM == _MIPS_SIM_ABI32
136 @@ -4854,6 +4862,7 @@ struct kernel_statfs {
137 * corresponding #pragma push_macro near the top of this file. */
138 #pragma pop_macro("stat64")
139 #pragma pop_macro("fstat64")
140 +#pragma pop_macro("fstatat64")
141 #pragma pop_macro("lstat64")
142 #pragma pop_macro("pread64")
143 #pragma pop_macro("pwrite64")
144 diff --git a/third_party/nasm/nasmlib/realpath.c b/third_party/nasm/nasmlib/realpath.c
145 index c31003e..73de448 100644
146 --- a/third_party/nasm/nasmlib/realpath.c
147 +++ b/third_party/nasm/nasmlib/realpath.c
152 -#ifdef HAVE_CANONICALIZE_FILE_NAME
153 +#if defined(__GLIBC__)
156 * GNU-specific, but avoids the realpath(..., NULL)
157 diff --git a/third_party/ots/src/include/opentype-sanitiser.h b/third_party/ots/src/include/opentype-sanitiser.h
158 index df36fe3..df1ab9d 100644
159 --- a/third_party/ots/src/include/opentype-sanitiser.h
160 +++ b/third_party/ots/src/include/opentype-sanitiser.h
161 @@ -20,6 +20,7 @@ typedef unsigned __int64 uint64_t;
162 #define ots_htonl(x) _byteswap_ulong (x)
163 #define ots_htons(x) _byteswap_ushort (x)
165 +#include <sys/types.h>
166 #include <arpa/inet.h>
168 #define ots_ntohl(x) ntohl (x)
169 diff --git a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
170 index 2e9c4e5..cb71b29 100644
171 --- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
172 +++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
177 -#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
178 +#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || !defined(__GLIBC__)
179 #include <sys/prctl.h>
182 @@ -58,7 +58,7 @@ inline bool MaybeSetThreadName(const std::string& name) {
184 inline bool GetThreadName(std::string& out_result) {
186 -#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
187 +#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || !defined(__GLIBC__)
188 if (prctl(PR_GET_NAME, buf) != 0)
191 diff --git a/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc b/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc
192 index 3750d7f..d399b39 100644
193 --- a/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc
194 +++ b/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc
196 #include "llvm/Support/raw_ostream.h"
200 +#if HAVE_EXECINFO_H && defined(__GLIBC__)
201 # include <execinfo.h> // For backtrace().
207 #undef HAVE__UNWIND_BACKTRACE
208 +#undef HAVE_BACKTRACE