xenstore: set READ_THREAD_STACKSIZE to a sane value
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 7 Mar 2014 12:22:58 +0000 (13:22 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 21 Mar 2014 11:25:26 +0000 (11:25 +0000)
On FreeBSD PTHREAD_STACK_MIN is 2048 by default, which is obviously
too low. Set the default back to the previous value (16 * 1024), or if
that's too low set it to PTHREAD_STACK_MIN.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@citrix.com>
tools/xenstore/xs.c

index dd03a8575551ca47f8fe28e328970cbcdfe0cafd..968141dedee21f5baa6fcb4b86fa850be2ed4ddd 100644 (file)
@@ -724,7 +724,10 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
        struct iovec iov[2];
 
 #ifdef USE_PTHREAD
-#define READ_THREAD_STACKSIZE PTHREAD_STACK_MIN
+#define DEFAULT_THREAD_STACKSIZE (16 * 1024)
+#define READ_THREAD_STACKSIZE                                  \
+       ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?       \
+       PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
 
        /* We dynamically create a reader thread on demand. */
        mutex_lock(&h->request_mutex);