aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/sysconf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/sysconf.cc')
-rw-r--r--winsup/cygwin/sysconf.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index 55eaa8c..ac5b350 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -35,7 +35,12 @@ sysconf (int in)
case _SC_OPEN_MAX:
return getdtablesize ();
case _SC_PAGESIZE:
- return getpagesize ();
+ {
+ long max = getdtablesize ();
+ if (max < OPEN_MAX)
+ max = OPEN_MAX;
+ return max;
+ }
case _SC_CLK_TCK:
return CLOCKS_PER_SEC;
case _SC_JOB_CONTROL:
@@ -85,7 +90,14 @@ sysconf (int in)
case _SC_NPROCESSORS_CONF:
return sbi.NumberProcessors;
case _SC_NPROCESSORS_ONLN:
- return sbi.ActiveProcessors;
+ {
+ int i = 0;
+ do
+ if (sbi.ActiveProcessors & 1)
+ i++;
+ while (sbi.ActiveProcessors >>= 1);
+ return i;
+ }
case _SC_PHYS_PAGES:
return sbi.NumberOfPhysicalPages;
case _SC_AVPHYS_PAGES: