On 08/22/2016 06:04 AM, Peter Lieven wrote:
+static size_t adjust_stack_size(size_t sz) +{ +#ifdef _SC_THREAD_STACK_MIN + /* avoid stacks smaller than _SC_THREAD_STACK_MIN */ + sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz); +#endif
You need to place the sysconf result into a local variable. What you have now expands to 4 invocations of the function.
You might also consider passing in the pagesize, since you've already called getpagesize in one of the two users of this function.
r~