Throughout use wincap.allocation_granularity instead of getpagesize.
Throughout use wincap.page_size instead of getsystempagesize. Throughout use "status" as variable name to hold NTSTATUS values. * fhandler_mem.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS. Fix debug_printf output. Rectify long statements. Fix comment formatting. * fhandler_proc.cc: Ditto. (format_proc_swaps): Drop useless test for ERROR_PROC_NOT_FOUND. * fhandler_process.cc: Ditto as in fhandler_mem.cc. (get_process_state): Rearrange allocation loop. Use malloc/realloc. (get_mem_values): Fix potential NULL pointer usage. Drop unused variable. * pinfo.cc (winpids::enum_processes): Handle low memory gracefully. * sec_auth.cc (get_priv_list): Drop local variable ret. * shared.cc (memory_init): Drop outdated call to getpagesize. * syscalls.cc (getsystempagesize): Remove. * sysconf.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS. (sysinfo): Constify sizeof_stodi. Drop useless test for ERROR_PROC_NOT_FOUND. * thread.cc (pthread_getattr_np): Cast pointers to uintptr_t rather than to int for pointer arithmetic. * winsup.h (getsystempagesize): Drop declaration.
This commit is contained in:
@@ -2509,7 +2509,7 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
||||
{
|
||||
const size_t sizeof_tbi = sizeof (THREAD_BASIC_INFORMATION);
|
||||
PTHREAD_BASIC_INFORMATION tbi;
|
||||
NTSTATUS ret;
|
||||
NTSTATUS status;
|
||||
|
||||
if (!pthread::is_good_object (&thread))
|
||||
return ESRCH;
|
||||
@@ -2529,20 +2529,21 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
||||
(*attr)->guardsize = thread->attr.guardsize;
|
||||
|
||||
tbi = (PTHREAD_BASIC_INFORMATION) malloc (sizeof_tbi);
|
||||
ret = NtQueryInformationThread (thread->win32_obj_id, ThreadBasicInformation,
|
||||
tbi, sizeof_tbi, NULL);
|
||||
|
||||
if (NT_SUCCESS (ret))
|
||||
status = NtQueryInformationThread (thread->win32_obj_id,
|
||||
ThreadBasicInformation,
|
||||
tbi, sizeof_tbi, NULL);
|
||||
if (NT_SUCCESS (status))
|
||||
{
|
||||
PNT_TIB tib = tbi->TebBaseAddress;
|
||||
(*attr)->stackaddr = tib->StackBase;
|
||||
/* stack grows downwards on x86 systems */
|
||||
(*attr)->stacksize = (int)tib->StackBase - (int)tib->StackLimit;
|
||||
(*attr)->stacksize = (uintptr_t) tib->StackBase
|
||||
- (uintptr_t) tib->StackLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_printf ("NtQueryInformationThread(ThreadBasicInformation), "
|
||||
"status %p", ret);
|
||||
"status %p", status);
|
||||
(*attr)->stackaddr = thread->attr.stackaddr;
|
||||
(*attr)->stacksize = thread->attr.stacksize;
|
||||
}
|
||||
|
Reference in New Issue
Block a user