]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN
authorSean Bright <sean.bright@gmail.com>
Fri, 18 Oct 2019 18:47:20 +0000 (14:47 -0400)
committerSean Bright <sean.bright@gmail.com>
Fri, 18 Oct 2019 18:53:32 +0000 (13:53 -0500)
ASTERISK-28590 #close

Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c

include/asterisk/utils.h

index 4dc406db7ff0df7d3fc5c7a162f9d82d4a05005b..2b332a51f04b7b0ca1d1fcd2528ed70011a5b443 100644 (file)
@@ -423,8 +423,13 @@ 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)
-#define AST_STACKSIZE_LOW (((sizeof(void *) * 8 * 2) - 16) * 1024)
+#if defined(PTHREAD_STACK_MIN)
+# define AST_STACKSIZE     MAX((((sizeof(void *) * 8 * 8) - 16) * 1024), PTHREAD_STACK_MIN)
+# define AST_STACKSIZE_LOW MAX((((sizeof(void *) * 8 * 2) - 16) * 1024), PTHREAD_STACK_MIN)
+#else
+# define AST_STACKSIZE     (((sizeof(void *) * 8 * 8) - 16) * 1024)
+# define AST_STACKSIZE_LOW (((sizeof(void *) * 8 * 2) - 16) * 1024)
+#endif
 
 int ast_background_stacksize(void);