* 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.
This commit is contained in:
@@ -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 };
|
||||
|
Reference in New Issue
Block a user