+ 959. [port] freebsd: ncpus via sysctlbyname(). [RT #1584]
+
958. [port] ssize_t is not available on all platforms. [RT #1607]
957. [bug] sys/select.h inclusion was broken on older platforms.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.h.in,v 1.46 2001/08/15 06:03:39 marka Exp $ */
+/* $Id: config.h.in,v 1.47 2001/08/16 06:19:56 marka Exp $ */
/***
*** This file is not to be included by any public header files, because
/* define if sysconf() is available */
#undef HAVE_SYSCONF
+/* define if sysctlbyname() is available */
+#undef HAVE_SYSCTLBYNAME
+
/* define if catgets() is available */
#undef HAVE_CATGETS
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
+/* Define if you have the <sys/sysctl.h> header file. */
+#undef HAVE_SYS_SYSCTL_H
+
/* Define if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
-AC_REVISION($Revision: 1.289 $)
+AC_REVISION($Revision: 1.290 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h)
+AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/sysctl.h)
AC_C_CONST
AC_C_INLINE
+AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME),)
#
# UnixWare 7.1.1 with the feature supplement to the UDK compiler
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.10 2001/02/17 01:23:43 gson Exp $ */
+/* $Id: os.c,v 1.11 2001/08/16 06:19:58 marka Exp $ */
#include <config.h>
#endif /* __hpux */
+#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+static int
+sysctl_ncpus(void) {
+ int ncpu, result;
+ size_t len;
+
+ len = sizeof ncpu;
+ result = sysctlbyname("hw.ncpu", &ncpu, &len , 0, 0);
+ if (result != -1)
+ return (ncpu);
+ return (0);
+}
+#endif
unsigned int
isc_os_ncpus(void) {
#elif defined(HAVE_SYSCONF)
ncpus = sysconf_ncpus();
#endif
-
+#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME)
+ if (ncpus <= 0)
+ ncpus = sysctl_ncpus();
+#endif
if (ncpus <= 0)
ncpus = 1;