<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/34a07860328be4af718d35afaa0a4d615d833bd8">https://github.com/macports/macports-ports/commit/34a07860328be4af718d35afaa0a4d615d833bd8</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 34a07860328be4af718d35afaa0a4d615d833bd8
</span>Author: Sergey Fedorov <vital.had@gmail.com>
AuthorDate: Sun Aug 14 13:59:30 2022 +0700
<span style='display:block; white-space:pre;color:#404040;'> folly: fix build for gcc and older systems
</span>---
devel/folly/Portfile | 54 +++++++---
devel/folly/files/patch-cmakelists.diff | 32 ++++++
devel/folly/files/patch-darwin-ppc.diff | 79 +++++++++++++++
devel/folly/files/patch-older-systems.diff | 158 +++++++++++++++++++++++++++++
4 files changed, 309 insertions(+), 14 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/folly/Portfile b/devel/folly/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index db67e4887a0..50c960b1eb5 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/devel/folly/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/folly/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -9,7 +9,11 @@ PortGroup compiler_blacklist_versions 1.0
</span> PortGroup legacysupport 1.1
legacysupport.newest_darwin_requires_legacy 19
<span style='display:block; white-space:pre;background:#ffe0e0;'>-legacysupport.use_mp_libcxx yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[string match *clang* ${configure.compiler}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Don’t use libcxx with gcc.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ legacysupport.use_mp_libcxx yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
github.setup facebook folly 2022.08.08.00 v
revision 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -39,16 +43,6 @@ github.tarball_from releases
</span> distname ${name}-v${version}
extract.mkdir yes
<span style='display:block; white-space:pre;background:#ffe0e0;'>-platform darwin {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${os.major} < 16} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- known_fail yes
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- pre-fetch {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "${subport} requires macOS 10.12 or later"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return -code error "incompatible macOS version"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> set port_libfmt libfmt9
cmake.module_path-append \
${prefix}/lib/${port_libfmt}/cmake
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -70,6 +64,16 @@ depends_lib-append port:bzip2 \
</span>
cmake.generator Ninja
<span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles patch-cmakelists.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${os.platform} eq "darwin" && ${os.major} < 16} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append patch-older-systems.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${build_arch} in [list ppc ppc64]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append patch-darwin-ppc.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> configure.args-append -DBUILD_SHARED_LIBS=ON -DFOLLY_USE_JEMALLOC=0
compiler.cxx_standard 2017
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -84,13 +88,26 @@ platform darwin {
</span> # https://github.com/facebook/folly/issues/864
if {${os.major} <= 16} {
configure.args-append -DCOMPILER_HAS_F_ALIGNED_NEW=OFF
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cxxflags-append -fno-aligned-allocation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # gcc does not recognize -fno-aligned-allocation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[string match *clang* ${configure.compiler}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cxxflags-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -fno-aligned-allocation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://kumasento.github.io/2020-06-12-glog-gflags-and-c-abi/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${os.major} < 16} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cxxflags-append -D_GLIBCXX_USE_CXX11_ABI=0
</span> }
# Support for TCP fast-open was only added to macOS 10.11+
if {${os.major} < 15} {
configure.cxxflags-append -DFOLLY_ALLOW_TFO=0
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cxxflags-append -DFOLLY_MOBILE=0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[string match *gcc* ${configure.compiler}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # ___atomic_fetch_sub_8, ___atomic_load_8, ___atomic_exchange_8, ___atomic_store_8, ___atomic_compare_exchange_8, ___atomic_fetch_add_8
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.ldflags-append -latomic
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://github.com/macports/macports-ports/pull/15689#issuecomment-1212969969
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.ldflags-append -L${prefix}/lib -lgflags
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
variant jemalloc description {Use je_malloc} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -101,5 +118,14 @@ variant jemalloc description {Use je_malloc} {
</span> }
variant native description {Build with best native support for local CPU capabilities} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cxxflags-append -march=native
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${build_arch} ni [list ppc ppc64]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # This flag is unsupported for PPC:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cxxflags-append -march=native
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${build_arch} eq "ppc"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cxxflags-append -mtune=G4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${build_arch} eq "ppc64"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cxxflags-append -mtune=G5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/folly/files/patch-cmakelists.diff b/devel/folly/files/patch-cmakelists.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..07183bb50b7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/folly/files/patch-cmakelists.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,32 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- CMakeLists.txt.orig.txt 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ CMakeLists.txt 2022-08-11 21:23:56.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -230,6 +230,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ endif()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # base64 SIMD files compilation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if (APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "ppc")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ message(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ STATUS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "PowerPC Big Endian has a limited support, "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "skipping building Base64SWAR of base64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ list(REMOVE_ITEM files ${FOLLY_DIR}/detail/base64_detail/Base64SWAR.cpp)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++endif()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (${IS_X86_64_ARCH})
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ message(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ STATUS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- CMake/folly-deps.cmake.orig 2022-08-12 00:46:34.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ CMake/folly-deps.cmake 2022-08-12 00:33:29.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -247,7 +247,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ FOLLY_STDLIB_LIBCPP
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-if (APPLE)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if (APPLE AND NOT(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ list (APPEND CMAKE_REQUIRED_LIBRARIES c++abi)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ list (APPEND FOLLY_LINK_LIBRARIES c++abi)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ endif ()
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/folly/files/patch-darwin-ppc.diff b/devel/folly/files/patch-darwin-ppc.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..79ab6ebe2bf
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/folly/files/patch-darwin-ppc.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,79 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/Portability.h.orig 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/Portability.h 2022-08-10 23:12:09.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -103,12 +103,18 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define FOLLY_AARCH64 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#if defined(__powerpc64__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__powerpc64__) || defined(__ppc64__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define FOLLY_PPC64 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define FOLLY_PPC64 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__ppc__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define FOLLY_PPC 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define FOLLY_PPC 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(__s390x__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define FOLLY_S390X 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -120,6 +126,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr bool kIsArchAmd64 = FOLLY_X64 == 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++constexpr bool kIsArchPPC = FOLLY_PPC == 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr bool kIsArchS390X = FOLLY_S390X == 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace folly
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -318,6 +325,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr auto kIsLittleEndian = true;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif defined(__APPLE__) && defined(__POWERPC__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// Darwin ppc/ppc64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++constexpr auto kIsLittleEndian = false;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr auto kIsLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/mr-c/misc/wiki/pause-techniques-on-many-architectures
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/portability/Asm.h.orig 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/portability/Asm.h 2022-08-10 23:07:57.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -41,8 +41,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ asm volatile("pause");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #elif FOLLY_AARCH64 || (defined(__arm__) && !(__ARM_ARCH < 7))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ asm volatile("yield");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#elif FOLLY_PPC64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif FOLLY_PPC64 && !(defined(__APPLE__))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ asm volatile("or 27,27,27");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif (FOLLY_PPC || FOLLY_PPC64) && defined(__APPLE__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ __asm__ volatile ("or r27,r27,r27" ::: "memory");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace folly
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/facebook/folly/issues/1834
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/detail/base64_detail/Base64Api.cpp.orig 2022-08-14 12:11:09.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/detail/base64_detail/Base64Api.cpp 2022-08-14 12:19:29.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,10 +31,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ base64URLDecodeSWAR};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__POWERPC__) // PowerPC BE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ base64EncodeScalar,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ base64URLEncode};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else // Everything but PowerPC BE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ base64EncodeScalar,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ base64URLEncodeScalar,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ base64DecodeSWAR,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ base64URLDecodeSWAR};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace folly::detail::base64_detail
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/folly/files/patch-older-systems.diff b/devel/folly/files/patch-older-systems.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..ecc224eb457
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/folly/files/patch-older-systems.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,158 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/macports/macports-ports/pull/15689#issuecomment-1211163024
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/facebook/folly/issues/1833
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/File.cpp.orig 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/File.cpp 2022-08-11 19:15:42.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -120,8 +120,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int fd;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef _WIN32
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fd = ::dup(fd_);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elseif defined(F_DUPFD_CLOEXEC)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fd = ::fcntl(fd_, F_DUPFD_CLOEXEC, 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fd = ::dup(fd_);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ checkUnixError(fd, "dup() failed");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# TASK_INFO: https://github.com/bear-metal/tunemygc/commit/9652a759ab4eba7caa7a333383ebd7461e3040cf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Can CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID be borrowed?
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://opensource.apple.com/source/Libc/Libc-1158.50.2/gen/clock_gettime.c.auto.html
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/portability/Time.cpp.orig 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/portability/Time.cpp 2022-08-12 00:53:36.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -37,11 +37,13 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if !FOLLY_HAVE_CLOCK_GETTIME || FOLLY_FORCE_CLOCK_GETTIME_DEFINITION
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if __MACH__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <errno.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/types.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/mach_init.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/mach_port.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/mach_time.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/mach_types.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/task.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <mach/task_info.h> // for MacOS <= Lion
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/thread_act.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <mach/vm_map.h> // @manual
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -64,6 +66,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Get CPU usage for terminated threads.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifdef MACH_TASK_BASIC_INFO
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mach_task_basic_info task_basic_info;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mach_msg_type_number_t task_basic_info_count = MACH_TASK_BASIC_INFO_COUNT;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kern_result = task_info(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -74,6 +77,18 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (UNLIKELY(kern_result != KERN_SUCCESS)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ task_basic_info task_basic_info;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ mach_msg_type_number_t task_basic_info_count = TASK_BASIC_INFO_COUNT;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ kern_result = task_info(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ mach_task_self(),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ TASK_BASIC_INFO,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ (thread_info_t)&task_basic_info,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ &task_basic_info_count);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (UNLIKELY(kern_result != KERN_SUCCESS)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto cputime = time_value_to_ns(thread_times_info.user_time) +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ time_value_to_ns(thread_times_info.system_time) +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -99,6 +114,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED > 101100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ FOLLY_ATTR_WEAK int clock_gettime(clockid_t clk_id, struct timespec* ts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ switch (folly::to_underlying(clk_id)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case CLOCK_REALTIME: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -120,6 +136,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int clock_getres(clockid_t clk_id, struct timespec* ts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (clk_id != CLOCK_MONOTONIC) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -190,6 +207,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res->tv_nsec = time_t(perSec * kNsPerSec);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED > 101100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case CLOCK_PROCESS_CPUTIME_ID:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case CLOCK_THREAD_CPUTIME_ID: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DWORD adj, timeIncrement;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -198,12 +216,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res->tv_sec = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res->tv_nsec = long(timeIncrement * 100);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ default:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -236,6 +253,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ duration_to_ts(now, tp);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED > 101100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case CLOCK_PROCESS_CPUTIME_ID: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!GetProcessTimes(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ GetCurrentProcess(),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -268,7 +286,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ filetimeToUnsignedNanos(kernalTime) +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ filetimeToUnsignedNanos(userTime));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ default:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/system/ThreadId.cpp.orig 2022-07-30 03:08:35.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/system/ThreadId.cpp 2022-08-12 00:37:48.000000000 +0545
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -40,9 +40,18 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uint64_t getOSThreadIDSlow() {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if __APPLE__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- uint64_t tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- pthread_threadid_np(nullptr, &tid);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ uint64_t tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ tid = pthread_mach_thread_np(pthread_self());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1070
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ uint64_t tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ tid = pthread_mach_thread_np(pthread_self());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ uint64_t tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ pthread_threadid_np(nullptr, &tid);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return tid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #elif defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return uint64_t(GetCurrentThreadId());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #elif defined(__FreeBSD__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- folly/net/TcpInfoTypes.h.orig 2022-08-06 08:35:42.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ folly/net/TcpInfoTypes.h 2022-08-14 19:19:26.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -179,7 +179,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ __u32 tcpi_total_retrans;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#elif defined(__APPLE__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED > 101003
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define FOLLY_HAVE_TCP_INFO 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ using tcp_info = ::tcp_connection_info;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const int tcp_info_sock_opt = TCP_CONNECTION_INFO;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span></pre><pre style='margin:0'>
</pre>