| Server IP : 82.208.35.60 / Your IP : 216.73.216.238 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/science/mbdyn/files/ |
Upload File : |
--- libraries/libobjs/get_nprocs.c.orig 2021-04-22 19:18:04 UTC
+++ libraries/libobjs/get_nprocs.c
@@ -39,10 +39,28 @@
#ifndef HAVE_GET_NPROCS
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
/* GNU libc */
int
get_nprocs(void)
{
+#if defined(__FreeBSD__)
+ static int name[2] = {CTL_HW, HW_NCPU};
+ int32_t ncpu;
+ size_t size = sizeof(ncpu);
+ if (sysctl(name, sizeof(name)/sizeof(*name), &ncpu, &size, NULL, 0)) {
+ perror("unable to determine number of CPUs");
+ abort();
+ }
+ return (int)ncpu;
+
+#else
#warning "pippero!!!"
#if defined(_SC_NPROCESSORS_ONLN)
/* POSIX.1. */
@@ -65,6 +83,7 @@ get_nprocs(void)
#endif
/* we assume that there is at least one :) */
return 1;
+#endif
}
#endif /* HAVE_GET_NPROCS */