<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/1103ed6849918d9604b6095b6d53a6a44f3f68b0">https://github.com/macports/macports-legacy-support/commit/1103ed6849918d9604b6095b6d53a6a44f3f68b0</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 1103ed6849918d9604b6095b6d53a6a44f3f68b0
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Sun Jun 30 14:12:15 2024 -0700
<span style='display:block; white-space:pre;color:#404040;'> Rework sysconf flags to fit new scheme.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> The old method of deriving sysconf wrapper needs from ifndefs was
</span><span style='display:block; white-space:pre;color:#404040;'> incompatible with SDK flexibility. This sets up the usual SDK/lib
</span><span style='display:block; white-space:pre;color:#404040;'> flags, referenced to the appropriate OS versions (and the i386 fix).
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> See: https://trac.macports.org/ticket/69867
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> Builds and passes tests on all platforms.
</span>---
include/MacportsLegacySupport.h | 11 +++++++++--
include/unistd.h | 13 ++-----------
src/macports_legacy_sysconf.c | 16 ++++++++--------
3 files changed, 19 insertions(+), 21 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/MacportsLegacySupport.h b/include/MacportsLegacySupport.h
</span><span style='display:block; white-space:pre;color:#808080;'>index eae5fa2..c0ed0a1 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/include/MacportsLegacySupport.h
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/MacportsLegacySupport.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -237,8 +237,15 @@
</span> #define __MPLS_SDK_SYS_AIO_TIGER_FIX__ (__MPLS_SDK_MAJOR < 1050)
/* sysconf() is missing some functions on some systems, and may misbehave on i386 */
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#define __MPLS_LIB_SUPPORT_SYSCONF_WRAP__ (__MPLS_TARGET_OSVER < 101100 \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- || __MPLS_APPLE_I386__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_SDK_SUPPORT_SYSCONF_NPROCESSORS__ (__MPLS_SDK_MAJOR < 1050)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_LIB_SUPPORT_SYSCONF_NPROCESSORS__ (__MPLS_TARGET_OSVER < 1050)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_SDK_SUPPORT_SYSCONF_PHYS_PAGES__ (__MPLS_SDK_MAJOR < 101100)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_LIB_SUPPORT_SYSCONF_PHYS_PAGES__ (__MPLS_TARGET_OSVER < 101100 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || __MPLS_APPLE_I386__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_LIB_SUPPORT_SYSCONF_WRAP__ (__MPLS_LIB_SUPPORT_SYSCONF_NPROCESSORS__ \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || __MPLS_LIB_SUPPORT_SYSCONF_PHYS_PAGES__)
</span>
/* PTHREAD_RWLOCK_INITIALIZER is not defined until 10.5 */
/* The addition uses an #ifndef, so no feature flag is necessary */
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/unistd.h b/include/unistd.h
</span><span style='display:block; white-space:pre;color:#808080;'>index f44aa73..6dd4390 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/include/unistd.h
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/unistd.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -86,23 +86,14 @@
</span> /* Include the primary system unistd.h */
#include_next <unistd.h>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#ifndef _SC_NPROCESSORS_CONF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_SDK_SUPPORT_SYSCONF_NPROCESSORS__
</span> #define _SC_NPROCESSORS_CONF 57
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#define __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_NPROCESSORS_CONF__ 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#ifndef _SC_NPROCESSORS_ONLN
</span> #define _SC_NPROCESSORS_ONLN 58
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#define __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_NPROCESSORS_ONLN__ 1
</span> #endif
<span style='display:block; white-space:pre;background:#ffe0e0;'>-/* The OS-provided version of this item doesn't work properly on i386 */
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#if !defined(_SC_PHYS_PAGES) || defined (__i386__)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#ifndef _SC_PHYS_PAGES
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_SDK_SUPPORT_SYSCONF_PHYS_PAGES__
</span> #define _SC_PHYS_PAGES 200
#endif
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#define __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_PHYS_PAGES__ 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif /* !defined(_SC_PHYS_PAGES) || defined (__i386__) */
</span>
#if __MPLS_SDK_SUPPORT_FSETATTRLIST__
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports_legacy_sysconf.c b/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;color:#808080;'>index c87789b..399ca9c 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -27,12 +27,15 @@
</span> #include <dlfcn.h>
#include <stdlib.h>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-/* emulate several commonly used but missing selectors from sysconf() on various OS versions */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Emulate several commonly used but missing (or broken) selectors from
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * sysconf() on various OS versions.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span>
long sysconf(int name) {
long (*real_sysconf)(int);
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#if __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_NPROCESSORS_ONLN__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_LIB_SUPPORT_SYSCONF_NPROCESSORS__
</span> if ( name == _SC_NPROCESSORS_ONLN ) {
int nm[2];
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -50,9 +53,6 @@ long sysconf(int name) {
</span> return (long)count;
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#if __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_NPROCESSORS_CONF__
</span> if ( name == _SC_NPROCESSORS_CONF ) {
int nm[2];
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -67,9 +67,9 @@ long sysconf(int name) {
</span> if (ret < 0 || count < 1) { count = 1; }
return (long)count;
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* __MPLS_LIB_SUPPORT_SYSCONF_NPROCESSORS__ */
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#if __MP_LEGACY_SUPPORT_SYSCONF_WRAP_NEED_SC_PHYS_PAGES__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_LIB_SUPPORT_SYSCONF_PHYS_PAGES__
</span> if ( name == _SC_PHYS_PAGES ) {
/* the number of pages is the total memory / pagesize */
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -82,7 +82,7 @@ long sysconf(int name) {
</span> return (long)(mem_size/pagesize);
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* __MPLS_LIB_SUPPORT_SYSCONF_PHYS_PAGES__ */
</span>
/* for any other values of "name", call the real sysconf() */
real_sysconf = dlsym(RTLD_NEXT, "sysconf");
</pre><pre style='margin:0'>
</pre>