* cygerrno.h (__seterrno_from_nt_status): Define. Always set Win32
error code as well as errno. Use throughout where errno is set from NT status. (set_errno): Evaluate val only once. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fix typo in debug output. * fhandler_mem.cc (fhandler_dev_mem::open): Rely on __seterrno_from_nt_status setting Win32 error code in debug output. * fhandler_proc.cc (format_proc_uptime): Ditto. (format_proc_stat): Ditto. * fhandler_process.cc (format_process_stat): Ditto. * sysconf.cc (sysconf): Ditto.
This commit is contained in:
@@ -477,9 +477,8 @@ format_proc_uptime (char *destbuf, size_t maxsize)
|
||||
}
|
||||
else if (ret != STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
debug_printf("NtQuerySystemInformation: ret %d, Dos(ret) %d",
|
||||
ret, RtlNtStatusToDosError (ret));
|
||||
__seterrno_from_nt_status (ret);
|
||||
debug_printf("NtQuerySystemInformation: ret %d, Dos(ret) %E", ret);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -514,9 +513,8 @@ format_proc_stat (char *destbuf, size_t maxsize)
|
||||
(PVOID) &sbi, sizeof sbi, NULL))
|
||||
!= STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %d",
|
||||
ret, RtlNtStatusToDosError (ret));
|
||||
__seterrno_from_nt_status (ret);
|
||||
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E", ret);
|
||||
sbi.NumberProcessors = 1;
|
||||
}
|
||||
|
||||
@@ -556,9 +554,8 @@ format_proc_stat (char *destbuf, size_t maxsize)
|
||||
sizeof stodi, NULL);
|
||||
if (ret != STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
debug_printf("NtQuerySystemInformation: ret %d, Dos(ret) %d",
|
||||
ret, RtlNtStatusToDosError (ret));
|
||||
__seterrno_from_nt_status (ret);
|
||||
debug_printf("NtQuerySystemInformation: ret %d, Dos(ret) %E", ret);
|
||||
return 0;
|
||||
}
|
||||
pages_in = spi.PagesRead;
|
||||
|
Reference in New Issue
Block a user