<pre style='margin:0'>
Ken (kencu) pushed a commit to branch wrapfunctions
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/f419945ad63d3707f58b4c48518a3dec45a4e9ef">https://github.com/macports/macports-legacy-support/commit/f419945ad63d3707f58b4c48518a3dec45a4e9ef</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit f419945ad63d3707f58b4c48518a3dec45a4e9ef
</span>Author: Ken Cunningham <kencu@macports.org>
AuthorDate: Mon Jan 21 19:15:34 2019 -0800
<span style='display:block; white-space:pre;color:#404040;'> add "wrap" functions
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> these changes "wrap" existing library functions
</span><span style='display:block; white-space:pre;color:#404040;'> modifying the behaviour to behave like current
</span><span style='display:block; white-space:pre;color:#404040;'> expected library functions
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> realpath: leopard and earlier
</span><span style='display:block; white-space:pre;color:#404040;'> support NULL as buffer
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> sysconf: tiger
</span><span style='display:block; white-space:pre;color:#404040;'> support _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN
</span>---
include/MacportsLegacySupport.h | 7 ++++
include/stdlib.h | 38 ++++++++++++++++++-
include/unistd.h | 45 ++++++++++++++++++++++
src/macports_legacy_realpath.c | 27 ++++++++++++++
src/macports_legacy_sysconf.c | 82 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 197 insertions(+), 2 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 47c2875..5201cea 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;'>@@ -62,4 +62,11 @@
</span> /* posix_memalign */
#define __MP_LEGACY_SUPPORT_POSIX_MEMALIGN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060)
<span style='display:block; white-space:pre;background:#e0ffe0;'>+/* sysconf() wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MP_LEGACY_SUPPORT_SYSCONF_WRAP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* realpath() wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MP_LEGACY_SUPPORT_REALPATH_WRAP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> #endif /* _MACPORTS_LEGACYSUPPORTDEFS_H_ */
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/stdlib.h b/include/stdlib.h
</span><span style='display:block; white-space:pre;color:#808080;'>index 08d861a..e31d6c3 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/include/stdlib.h
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/stdlib.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,11 +19,45 @@
</span> #ifndef _MACPORTS_STDLIB_H_
#define _MACPORTS_STDLIB_H_
<span style='display:block; white-space:pre;background:#e0ffe0;'>+/* MP support header */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include "MacportsLegacySupport.h"
</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;'>+/* realpath wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* we need a way to isolate ourselves from our header wrapping while building */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef __BUILDING_MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* we are going to move the old realpath definition out of the way */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef realpath
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define realpath realpath_macports_original
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__BUILDING_MP_LEGACY_SUPPORT_REALPATH_WRAP__ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__MP_LEGACY_SUPPORT_REALPATH_WRAP__*/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /* Include the primary system stdlib.h */
#include_next <stdlib.h>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-/* MP support header */
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#include "MacportsLegacySupport.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* realpath wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef __BUILDING_MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* and now define realpath as our new wrapped function */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef realpath
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define realpath macports_legacy_realpath
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __cplusplus
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+extern "C" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ extern char * macports_legacy_realpath(const char *, void *);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __cplusplus
</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;'>+#endif /*__BUILDING_MP_LEGACY_SUPPORT_REALPATH_WRAP__ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__MP_LEGACY_SUPPORT_REALPATH_WRAP__*/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>
/* posix_memalign */
#if __MP_LEGACY_SUPPORT_POSIX_MEMALIGN__
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/unistd.h b/include/unistd.h
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..527d2df
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/unistd.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,45 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* MP support header */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include "MacportsLegacySupport.h"
</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 __MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef __BUILDING_MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* redefine the original sysconf */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef sysconf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define sysconf sysconf_orig
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* __BUILDING_MP_LEGACY_SUPPORT_SYSCONF_WRAP__ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__MP_LEGACY_SUPPORT_SYSCONF_WRAP__*/
</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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include_next <unistd.h>
</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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef __BUILDING_MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* and now define sysconf as our new wrapped function */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef sysconf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define sysconf macports_legacy_sysconf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef _SC_NPROCESSORS_CONF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _SC_NPROCESSORS_CONF 57
</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;'>+#ifndef _SC_NPROCESSORS_ONLN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _SC_NPROCESSORS_ONLN 58
</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;'>+#ifdef __cplusplus
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+extern "C" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+extern long macports_legacy_sysconf(int);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __cplusplus
</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;'>+#endif /* __BUILDING_MP_LEGACY_SUPPORT_SYSCONF_WRAP__ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__MP_LEGACY_SUPPORT_SYSCONF_WRAP__*/
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports_legacy_realpath.c b/src/macports_legacy_realpath.c
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..051ed55
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports_legacy_realpath.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,27 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* MP support header */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include "MacportsLegacySupport.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* realpath wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* we need this blocker so as to not get caught in our own wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __BUILDING_MP_LEGACY_SUPPORT_REALPATH_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include <limits.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include <stdlib.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+char *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+macports_legacy_realpath(const char *stringsearch, void *buffer)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (buffer == NULL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ char *myrealpathbuf = malloc(PATH_MAX);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (myrealpathbuf != NULL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return(realpath(stringsearch, myrealpathbuf));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return(NULL);
</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;'>+ return(realpath(stringsearch, buffer));
</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 /*__MP_LEGACY_SUPPORT_REALPATH_WRAP__*/
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports_legacy_sysconf.c b/src/macports_legacy_sysconf.c
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..99ed65b
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</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;'>@@ -0,0 +1,82 @@
</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;'>+ * Copyright (c) 2019 Ken Cunningham <kencu@macports.org>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Permission to use, copy, modify, and distribute this software for any
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * purpose with or without fee is hereby granted, provided that the above
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * copyright notice and this permission notice appear in all copies.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
</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;'>+/* MP support header */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include "MacportsLegacySupport.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* sysconf wrap, 10.4 */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/* we need this blocker so as to not get caught in our own wrap */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __BUILDING_MP_LEGACY_SUPPORT_SYSCONF_WRAP__
</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;'>+#include <sys/types.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include <sys/sysctl.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include <unistd.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef _SC_NPROCESSORS_CONF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _SC_NPROCESSORS_CONF 57
</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;'>+#ifndef _SC_NPROCESSORS_ONLN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _SC_NPROCESSORS_ONLN 58
</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;'>+/* emulate two commonly used but missing selectors from sysconf() on 10.4 */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long macports_legacy_sysconf(int name){
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ( name == _SC_NPROCESSORS_ONLN ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int nm[2];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size_t len = 4;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uint32_t count;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sysctl(nm, 2, &count, &len, NULL, 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (count < 1) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* try again with _SC_NPROCESSORS_CONF */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports_legacy_sysconf(_SC_NPROCESSORS_CONF);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return (long)count;
</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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ( name == _SC_NPROCESSORS_CONF ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int nm[2];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size_t len = 4;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uint32_t count;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ nm[0] = CTL_HW; nm[1] = HW_NCPU;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sysctl(nm, 2, &count, &len, NULL, 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* there has to be at least 1 processor */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (count < 1) { count = 1; }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return (long)count;
</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;'>+ /* for any other values of "name", call the real sysconf() */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return (long)sysconf(name);
</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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /*__MP_LEGACY_SUPPORT_SYSCONF_WRAP__*/
</span>\ No newline at end of file
</pre><pre style='margin:0'>
</pre>