From: Sean Bright Date: Fri, 18 Oct 2019 18:47:20 +0000 (-0400) Subject: utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN X-Git-Tag: 13.30.0-rc1~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1e3a13579603eb9a530fa6d87e1b2a6ad45960b;p=thirdparty%2Fasterisk.git utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN ASTERISK-28590 #close Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c --- diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index bcd73aace5..2e652c35ee 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -423,10 +423,16 @@ int ast_careful_fwrite(FILE *f, int fd, const char *s, size_t len, int timeoutms * Thread management support (should be moved to lock.h or a different header) */ -#define AST_STACKSIZE (((sizeof(void *) * 8 * 8) - 16) * 1024) +#if defined(PTHREAD_STACK_MIN) +# define AST_THREAD_STACK_MIN PTHREAD_STACK_MIN +#else +# define AST_THREAD_STACK_MIN 0 +#endif + +#define AST_STACKSIZE MAX((((sizeof(void *) * 8 * 8) - 16) * 1024), AST_THREAD_STACK_MIN) #if defined(LOW_MEMORY) -#define AST_BACKGROUND_STACKSIZE (((sizeof(void *) * 8 * 2) - 16) * 1024) +#define AST_BACKGROUND_STACKSIZE MAX((((sizeof(void *) * 8 * 2) - 16) * 1024), AST_THREAD_STACK_MIN) #else #define AST_BACKGROUND_STACKSIZE AST_STACKSIZE #endif