* Makefile.in: Build wincap.o.
* wincap.cc: New file. * wincap.h: Ditto. * autoload.cc: Add dynamic load statement for `CreateHardLinkA'. * dcrt0.cc (os_being_run): Eliminated. (osname): Ditto. (iswinnt): Ditto. (set_os_type): Ditto. (dll_crt0_1): Call wincap.init() instead of set_os_type(). (_dll_crt0): Ditto. * environ.cc (set_chunksize): New function. (parse_thing): `forkchunk' setting now invokes function `set_chunksize'. * fork.cc (chunksize): Eliminated. Moved to be member of wincap. * host_dependent.h: Removed. * syscalls.cc (_link): Try using `CreateHardLinkA' first, if available. * cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc, environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc, fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h, security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc, times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap capability check throughout. * winsup.h: Include wincap.h. Eliminate extern declarations of `os_being_run' and `iswinnt'. Eliminate `os_type" definition. * include/cygwin/version.h: Bump version to 1.3.4.
This commit is contained in:
@@ -56,37 +56,39 @@ sysconf (int in)
|
||||
#endif
|
||||
case _SC_NPROCESSORS_CONF:
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
if (!iswinnt)
|
||||
if (!wincap.supports_smp ())
|
||||
return 1;
|
||||
/*FALLTHRU*/
|
||||
case _SC_PHYS_PAGES:
|
||||
case _SC_AVPHYS_PAGES:
|
||||
{
|
||||
NTSTATUS ret;
|
||||
SYSTEM_BASIC_INFORMATION sbi;
|
||||
if ((ret = NtQuerySystemInformation (SystemBasicInformation,
|
||||
(PVOID) &sbi,
|
||||
sizeof sbi, NULL))
|
||||
!= STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
debug_printf("NtQuerySystemInformation: ret = %d, "
|
||||
"Dos(ret) = %d",
|
||||
ret, RtlNtStatusToDosError (ret));
|
||||
return -1;
|
||||
}
|
||||
switch (in)
|
||||
{
|
||||
case _SC_NPROCESSORS_CONF:
|
||||
return sbi.NumberProcessors;
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
return sbi.ActiveProcessors;
|
||||
case _SC_PHYS_PAGES:
|
||||
return sbi.NumberOfPhysicalPages;
|
||||
case _SC_AVPHYS_PAGES:
|
||||
return sbi.HighestPhysicalPage - sbi.LowestPhysicalPage + 1;
|
||||
}
|
||||
}
|
||||
if (!wincap.supports_smp ())
|
||||
{
|
||||
NTSTATUS ret;
|
||||
SYSTEM_BASIC_INFORMATION sbi;
|
||||
if ((ret = NtQuerySystemInformation (SystemBasicInformation,
|
||||
(PVOID) &sbi,
|
||||
sizeof sbi, NULL))
|
||||
!= STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
debug_printf("NtQuerySystemInformation: ret = %d, "
|
||||
"Dos(ret) = %d",
|
||||
ret, RtlNtStatusToDosError (ret));
|
||||
return -1;
|
||||
}
|
||||
switch (in)
|
||||
{
|
||||
case _SC_NPROCESSORS_CONF:
|
||||
return sbi.NumberProcessors;
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
return sbi.ActiveProcessors;
|
||||
case _SC_PHYS_PAGES:
|
||||
return sbi.NumberOfPhysicalPages;
|
||||
case _SC_AVPHYS_PAGES:
|
||||
return sbi.HighestPhysicalPage - sbi.LowestPhysicalPage + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Invalid input or unimplemented sysconf name */
|
||||
|
Reference in New Issue
Block a user