mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-26 10:53:39 +01:00
- Use unsigned int for values obtained with sysctlbyname(). This fixes
sparc64 performance problems. Submitted by: Oleg Moskalenko <oleg.moskalenko@citrix.com> Tested by: trasz
This commit is contained in:
parent
9f988ef16b
commit
ab28d4d3cf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244346
@ -103,7 +103,7 @@ bool debug_sort;
|
||||
bool need_hint;
|
||||
|
||||
#if defined(SORT_THREADS)
|
||||
size_t ncpu = 1;
|
||||
unsigned int ncpu = 1;
|
||||
size_t nthreads = 1;
|
||||
#endif
|
||||
|
||||
@ -268,14 +268,16 @@ set_hw_params(void)
|
||||
#if defined(SORT_THREADS)
|
||||
size_t ncpusz;
|
||||
#endif
|
||||
size_t pages, psize, psz, pszsz;
|
||||
unsigned int pages, psize;
|
||||
size_t psz, pszsz;
|
||||
|
||||
pages = psize = 0;
|
||||
#if defined(SORT_THREADS)
|
||||
ncpu = 1;
|
||||
ncpusz = sizeof(size_t);
|
||||
#endif
|
||||
psz = pszsz = sizeof(size_t);
|
||||
psz = sizeof(pages);
|
||||
pszsz = sizeof(psize);
|
||||
|
||||
if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &psz,
|
||||
NULL, 0) < 0) {
|
||||
@ -299,6 +301,9 @@ set_hw_params(void)
|
||||
|
||||
free_memory = (unsigned long long) pages * (unsigned long long) psize;
|
||||
available_free_memory = (free_memory * 9) / 10;
|
||||
|
||||
if (available_free_memory < 1024)
|
||||
available_free_memory = 1024;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -54,7 +54,7 @@ extern const char *nlsstr[];
|
||||
|
||||
#if defined(SORT_THREADS)
|
||||
#define MT_SORT_THRESHOLD (10000)
|
||||
extern size_t ncpu;
|
||||
extern unsigned int ncpu;
|
||||
extern size_t nthreads;
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user