From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by sourceware.org (Postfix) with ESMTPS id 6F2E73858D1E for ; Fri, 30 Sep 2022 14:10:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F2E73858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-vs1-xe2a.google.com with SMTP id h1so4879659vsr.11 for ; Fri, 30 Sep 2022 07:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date; bh=1B0ODvIllgG1yuFs9OFl3Thn+rt/AJl/KtlJwYKRRas=; b=OBPra08OCSrXPZK7pnXQowhVGuSdmTByZco70mQcLKo3ympPsD1VZodJrosXrQQPwd VC9lDjlSZeY87Qo0a/vPifRAcU3AgRUSI/d4ia88OpBO576lXB5SbeXvkBupmlQlMV4s nQVEkuKjhOmegvqYfZ4TynsQL9rAyBX5uRyruZf/OKvb377/6mS+ppDq4EqetScC5AKv qn2cUIOIVI+DElq0F7gEgzhCKf2d+k/X1c8rjZkjaMqRCKFRMdoS2HMaZoVg+v2u3GXh /jvMXQfHH5OLdqI3wYLrnDXK4aknwlRG9ju3oFYuBI0N8HcgoDyiCE6UH9odKLk0IaIH hBTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=1B0ODvIllgG1yuFs9OFl3Thn+rt/AJl/KtlJwYKRRas=; b=dEEk1UoHQhiI7oMVhGR9FZeexZwmMz5/Ez6nbzB979O3WK/436xBc3MqiKJ4zg7Wnx fLyT1JgH2cUxTW6Lob2bMTq74+Kmbm2oQxJWY9WYKcxpzYruaGv7L6tUYNFA7PR8sSVj gadJdLQpR/MpihGgiRlUF9Y3Mh20flf8GZF+/nYYGlPN54/eOZyluJjJLhvqte676YB5 FWvawP138tS5eG2Jfe6+K15jG7czn5YYsfg6hsHZk3drPx4tv0ZXLoYc8ygpxpP7mk+q b+THBhNyV6d80yQ6PNY6mNl6B39pkQ3HSPRYnuqSybLwbqWYcB3bh/iABAxOYATyODE3 l53w== X-Gm-Message-State: ACrzQf1Od3hlShkevl0rtcCLZ2ZnnMmAOM57Oqhn3eHX1fSpNZg7aHoo D4e0y6ox9JAEs1MHbfMmBGAX/w== X-Google-Smtp-Source: AMsMyM5rAnW654jnkMNi4ECfKKOgj3eTdTfwLeKKIS8FTSkQ6mo5oi9q5wUbeFDj3VNs4SRjMQgQzg== X-Received: by 2002:a05:6102:758:b0:398:d470:9541 with SMTP id v24-20020a056102075800b00398d4709541mr4362672vsg.28.1664547043700; Fri, 30 Sep 2022 07:10:43 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:3736:5474:7f48:dc74:6616? ([2804:1b3:a7c2:3736:5474:7f48:dc74:6616]) by smtp.gmail.com with ESMTPSA id h13-20020ab0134d000000b003d5484f9ed1sm1570734uae.29.2022.09.30.07.10.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Sep 2022 07:10:43 -0700 (PDT) Message-ID: Date: Fri, 30 Sep 2022 11:10:41 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v2 2/2] nptl: Convert tst-setuid2 to test-driver Content-Language: en-US To: Yu Chien Peter Lin , libc-alpha@sourceware.org Cc: fw@deneb.enyo.de, ycliang@andestech.com, dylan@andestech.com, alankao@andestech.com References: <20220930121951.30671-1-peterlin@andestech.com> <20220930121951.30671-2-peterlin@andestech.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20220930121951.30671-2-peterlin@andestech.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 30/09/22 09:19, Yu Chien Peter Lin wrote: > Use and replace pthread calls to its xpthread > equivalents. > > Signed-off-by: Yu Chien Peter Lin LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > nptl/tst-setuid2.c | 52 +++++++++++++--------------------------------- > 1 file changed, 15 insertions(+), 37 deletions(-) > > diff --git a/nptl/tst-setuid2.c b/nptl/tst-setuid2.c > index aff3b1a97d..9b7799991c 100644 > --- a/nptl/tst-setuid2.c > +++ b/nptl/tst-setuid2.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -36,30 +37,21 @@ static pthread_cond_t cond_recv; > static void * > thread_func (void *ctx __attribute__ ((unused))) > { > - int ret = pthread_mutex_lock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_lock (thread): %d", ret); > - > + xpthread_mutex_lock (&mutex); > while (true) > { > if (func_sent != NULL) > { > void (*func) (void) = func_sent; > - ret = pthread_mutex_unlock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_unlock (thread): %d", ret); > + xpthread_mutex_unlock (&mutex); > + > func (); > - ret = pthread_mutex_lock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_lock (thread): %d", ret); > + > + xpthread_mutex_lock (&mutex); > func_sent = NULL; > - ret = pthread_cond_signal (&cond_recv); > - if (ret != 0) > - FAIL ("pthread_cond_signal (recv): %d", ret); > + xpthread_cond_signal (&cond_recv); > } > - ret = pthread_cond_wait (&cond_send, &mutex); > - if (ret != 0) > - FAIL ("pthread_cond_wait (send): %d", ret); > + xpthread_cond_wait (&cond_send, &mutex); > } > return NULL; > } > @@ -67,31 +59,18 @@ thread_func (void *ctx __attribute__ ((unused))) > static void > run_on_thread (void (*func) (void)) > { > - int ret = pthread_mutex_lock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_lock (%s): %d", __func__, ret); > + xpthread_mutex_lock (&mutex); > func_sent = func; > - ret = pthread_mutex_unlock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_unlock (%s): %d", __func__, ret); > + xpthread_mutex_unlock (&mutex); > > - ret = pthread_cond_signal (&cond_send); > - if (ret != 0) > - FAIL ("pthread_mutex_lock (%s): %d", __func__, ret); > - > - ret = pthread_mutex_lock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_lock (%s): %d", __func__, ret); > + xpthread_cond_signal (&cond_send); > > + xpthread_mutex_lock (&mutex); > while (func_sent != NULL) > { > - ret = pthread_cond_wait (&cond_recv, &mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_wait (%s): %d", __func__, ret); > + xpthread_cond_wait (&cond_recv, &mutex); > } > - ret = pthread_mutex_unlock (&mutex); > - if (ret != 0) > - FAIL ("pthread_mutex_unlock (%s): %d", __func__, ret); > + xpthread_mutex_unlock (&mutex); > } > > static void > @@ -141,5 +120,4 @@ do_test (void) > return 0; > } > > -#define TEST_FUNCTION do_test () > -#include "../test-skeleton.c" > +#include