[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] libs/store: make build without PTHREAD_STACK_MIN


  • To: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 18 Jan 2021 18:56:46 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eseyazQVtaBR5ZJlC2132wbCTkzi2fFb+UGttCPJ3vU=; b=OadVYi6Rr8G2BEmlgIx0G5lMvLIWgAd95y9g1iTDswpXf7IN8GAPAuDMhE1duVxZePwwGT8JO0sVHSJ00SpsRu1NIPLGOlfgCP+HmmD+byylijC0nGjj12cd0xKMJgZp2ZalKF6MI1Kh3ojrzEs3Y6IgF1aW5jMk+xR52Wk17UKbCpY1yTvMQGOJQWsRGGnxcwaf4r1Ttf6+2ujxl5OMvKeMTOsdYZKvgbh1RiI0Z+mv1VHxgmRu5agKfwpUTf46KmCz2kOzjxIstJSmla/pKBfXHuRh86UfrVN7g8CeXdgN5xXTQCkywkkM5E7eAbwzO7C50LC4UjbJZyuHScZD8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=at1bi0wjD99xMyFAwB4dGvlUhA+E7lDHNh2R7cAxj5Wrf/x2UydRl+iBNxXBom0gEcvYc+ZQ/+rCfkU+eFHyj/59cx1DZuVoT56n68o76Gi/0eaeiYjomj/KXzF9e7iZ2nH2v+sALtlu/8MJztb1SvC768YJJumRYXPHbyNMZAvuAvGuMMksUUktq/m7qESjam7x7nNecMH/6Juji17ij96Ofrk6xM0aXRmVcL3fGceWHxESkfqkEwLY4oxuQ3ZbfYkIArdtsNk2cULUBawk/AZv56ApAPd0bojjCRFyQSv2NC15GzjsgTs/EeSE/6onqPdzMNlyxfQ/iVhzX2XrxQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Manuel Bouyer <bouyer@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>
  • Delivery-date: Mon, 18 Jan 2021 18:57:05 +0000
  • Ironport-sdr: M/DCuV+jMAoQrBTN+tEX9Qe24qnMFnVFbnGIJrgEXIlki6lerHjA8db+VZ0tD828iZDTFuMM2h s7ox6iPVAfw+7Xvo/Ttj8y7o3NbrZE+8MSOhOgFIdBlpka/0tO8jiFzmgLANXwrEW+2AE/oXzn FAe6bUV0oQHFQFT0nLRVIC4cNzDfGDg5hd0gEs7LNeWeMzty/AavfsCyjFZuZHHL1a8pAcXTL6 Ty+ozInI/rf2F2dnELTlLyNVHcSb4ZzTzmB8MR6b8ipigH3K+L/YxV9tI/xLc3zalorEQPoz63 F2c=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12/01/2021 18:12, Manuel Bouyer wrote:
> From: Manuel Bouyer <bouyer@xxxxxxxxxx>
>
> On NetBSD, PTHREAD_STACK_MIN is not available.
> Just use DEFAULT_THREAD_STACKSIZE if PTHREAD_STACK_MIN is not available.
>
> Signed-off-by: Manuel Bouyer <bouyer@xxxxxxxxxx>
> ---
>  tools/libs/store/xs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
> index 4ac73ec317..8e646b98d6 100644
> --- a/tools/libs/store/xs.c
> +++ b/tools/libs/store/xs.c
> @@ -811,9 +811,13 @@ bool xs_watch(struct xs_handle *h, const char *path, 
> const char *token)
>  
>  #ifdef USE_PTHREAD
>  #define DEFAULT_THREAD_STACKSIZE (16 * 1024)
> +#ifndef PTHREAD_STACK_MIN
> +#define READ_THREAD_STACKSIZE DEFAULT_THREAD_STACKSIZE
> +#else
>  #define READ_THREAD_STACKSIZE                                        \
>       ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?       \
>       PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
> +#endif

How about this:

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 4ac73ec317..3fa3abdeca 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -811,9 +811,14 @@ bool xs_watch(struct xs_handle *h, const char
*path, const char *token)
 
 #ifdef USE_PTHREAD
 #define DEFAULT_THREAD_STACKSIZE (16 * 1024)
-#define READ_THREAD_STACKSIZE                                  \
-       ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?       \
-       PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
+
+/* NetBSD doesn't have PTHREAD_STACK_MIN. */
+#ifndef PTHREAD_STACK_MIN
+# define PTHREAD_STACK_MIN 0
+#endif
+
+#define READ_THREAD_STACKSIZE \
+       MAX(PTHREAD_STACK_MIN, DEFAULT_THREAD_STACKSIZE)
 
        /* We dynamically create a reader thread on demand. */
        mutex_lock(&h->request_mutex);

which makes things rather clearer IMO.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.