Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-02-22 20:09:46 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-02-22 20:09:46 +0300
commiteef57fe1e33dddda8840188a62365393a683fb54 (patch)
treed18a3434852a51c8548e6ab26c029d4bb6435aab /winsup/cygwin/sysconf.cc
parent64f211c87c2fcbc26abc091a5545643ebd129f4d (diff)
* fhandler.cc (fhandler_base::set_no_inheritance): Always use
SetHandleInformation. * fhandler_disk_file.cc (fhandler_disk_file::lock): Always use UnlockFileEx/LockFileEx functions. * net.cc (fdsock): Don't bother to duplicate socket for inheritance. * sysconf.cc (get_nproc_values): Take NT for granted. (get_avphys): Ditto. * syslog.cc (WIN95_EVENT_LOG_PATH): Remove define. (get_win95_event_log_path): Remove. (vsyslog): Fix formatting. Take NT for granted. * wincap.cc: Remove has_lock_file_ex, has_signal_object_and_wait, has_eventlog, has_set_handle_information, has_set_handle_information_on_console_handles and supports_smp throughout. * wincap.h: Ditto.
Diffstat (limited to 'winsup/cygwin/sysconf.cc')
-rw-r--r--winsup/cygwin/sysconf.cc81
1 files changed, 31 insertions, 50 deletions
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index 7a4ee9c64..64f5bfaa1 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -40,46 +40,32 @@ get_page_size (int in)
static long
get_nproc_values (int in)
{
+ NTSTATUS ret;
+ SYSTEM_BASIC_INFORMATION sbi;
+ if ((ret = NtQuerySystemInformation (SystemBasicInformation, (PVOID) &sbi,
+ sizeof sbi, NULL)) != STATUS_SUCCESS)
+ {
+ __seterrno_from_nt_status (ret);
+ debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
+ ret);
+ return -1;
+ }
switch (in)
{
case _SC_NPROCESSORS_CONF:
+ return sbi.NumberProcessors;
case _SC_NPROCESSORS_ONLN:
- if (!wincap.supports_smp ())
- return 1;
- /*FALLTHRU*/
+ {
+ int i = 0;
+ do
+ if (sbi.ActiveProcessors & 1)
+ i++;
+ while (sbi.ActiveProcessors >>= 1);
+ return i;
+ }
case _SC_PHYS_PAGES:
- if (wincap.supports_smp ())
- {
- NTSTATUS ret;
- SYSTEM_BASIC_INFORMATION sbi;
- if ((ret = NtQuerySystemInformation (SystemBasicInformation,
- (PVOID) &sbi,
- sizeof sbi, NULL))
- != STATUS_SUCCESS)
- {
- __seterrno_from_nt_status (ret);
- debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
- ret);
- return -1;
- }
- switch (in)
- {
- case _SC_NPROCESSORS_CONF:
- return sbi.NumberProcessors;
- case _SC_NPROCESSORS_ONLN:
- {
- int i = 0;
- do
- if (sbi.ActiveProcessors & 1)
- i++;
- while (sbi.ActiveProcessors >>= 1);
- return i;
- }
- case _SC_PHYS_PAGES:
- return sbi.NumberOfPhysicalPages
- / (getpagesize () / getsystempagesize ());
- }
- }
+ return sbi.NumberOfPhysicalPages
+ / (getpagesize () / getsystempagesize ());
}
return -1;
}
@@ -87,23 +73,18 @@ get_nproc_values (int in)
static long
get_avphys (int in)
{
- if (wincap.supports_smp ())
+ NTSTATUS ret;
+ SYSTEM_PERFORMANCE_INFORMATION spi;
+ if ((ret = NtQuerySystemInformation (SystemPerformanceInformation,
+ (PVOID) &spi, sizeof spi, NULL))
+ != STATUS_SUCCESS)
{
- NTSTATUS ret;
- SYSTEM_PERFORMANCE_INFORMATION spi;
- if ((ret = NtQuerySystemInformation (SystemPerformanceInformation,
- (PVOID) &spi,
- sizeof spi, NULL))
- != STATUS_SUCCESS)
- {
- __seterrno_from_nt_status (ret);
- debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
- ret);
- return -1;
- }
- return spi.AvailablePages / (getpagesize () / getsystempagesize ());
+ __seterrno_from_nt_status (ret);
+ debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
+ ret);
+ return -1;
}
- return -1;
+ return spi.AvailablePages / (getpagesize () / getsystempagesize ());
}
enum sc_type { nsup, cons, func };