From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 0D3221B4AD; Tue, 10 Jul 2018 12:46:45 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id p6-v6so16372596ljc.5; Tue, 10 Jul 2018 03:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hz+h3FVfPHxn4DGPtnGWU2a/Fh+Ght1JoIunA9HiXgI=; b=gEjRuV3j6hG87KpYNRnmVJVTXy+ajHeb9GyVGMkx6wPP2AF5TQXKylspcgVqWY5iMj WrSDj8VuAIpYQMJ1GZi1g9dgkgx2z1C8h5igC+M5YBUEieWajYfK7/Kc8NtiWIbIF8Dl SrbGrMWK6eUfRdmWzrhbwEglY1oXWpyEqQS1hE0WkrpqCQk/wMCNwdxSXmtOO46nLRxM lcEEgSw//rpHkDqTgxtygoqD9uWgNNW7KA1XK4StGDBd4j9kXFrnyCEVmOkEV5bVL8eJ l7CP1HDpbHP+qoegDlhNTLSlPRe0cFyXDk21QxtytqFUr/9l4tVQpoNgca0OTuxmu24X +luA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hz+h3FVfPHxn4DGPtnGWU2a/Fh+Ght1JoIunA9HiXgI=; b=JxR4UUzlWkrcYU16uwGbM4q/7NnykFh28f+8bKH6uB6HXu18kvSDuZWs+F7Y1klSHr 0LM0nkOGenbKRauWKozNQkLZKLAQQN6fhOeDN924KYZWxcYMEtAgBn0aHEIC6yxBK455 vGoxXIEP9CBmJRtHTWDjAUHYDno74LRDfznioVhrOqMKIUEE46vPDmbo4Z41tAGkRYtN GJZRshUS62qrunCq7jNbHZwMtf6tR28n996htWNfYfpWgWWlTZTKiT585BhQ8K1r0p5g hfSstbo6MLh3vwDTHCC619cVG4qSYKSY+AJdquzPd2cLXo0RiGhWNkxYcX6Sh0nJ+DzB v7uQ== X-Gm-Message-State: APt69E2aUq5Db3X4Wc3k5nvZsOZUq4mkK4HZwnG750Es8rPQeMgE+oPC BklOlEoZ5aBact8QQOOcZoL1WAAJ X-Google-Smtp-Source: AAOMgpcdk9hA2MonL2VYgB8IDtDMxqrmx0DMq8R1juRgzk/QRwSrVmRJB/oKgPQ6Hl8CRryxhpZjkg== X-Received: by 2002:a2e:590e:: with SMTP id n14-v6mr14524035ljb.128.1531219604480; Tue, 10 Jul 2018 03:46:44 -0700 (PDT) Received: from localhost.localdomain (89-68-114-161.dynamic.chello.pl. [89.68.114.161]) by smtp.gmail.com with ESMTPSA id q4-v6sm4591320lfj.81.2018.07.10.03.46.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 03:46:43 -0700 (PDT) From: Dariusz Stojaczyk To: dev@dpdk.org, Anatoly Burakov , Olivier Matz , stable@dpdk.org Cc: Dariusz Stojaczyk Date: Tue, 10 Jul 2018 12:44:47 +0200 Message-Id: <20180710104447.16756-3-darek.stojaczyk@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180710104447.16756-1-darek.stojaczyk@gmail.com> References: <1528461427-164113-1-git-send-email-dariuszx.stojaczyk@intel.com> <20180710104447.16756-1-darek.stojaczyk@gmail.com> Subject: [dpdk-stable] [PATCH v2 3/3] eal/thread: fix return codes for rte_ctrl_thread_create() X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 10:46:45 -0000 From: Dariusz Stojaczyk This function returned positive error numbers instead of negative ones as desbribed in the doc. What's worse, multiple of its callers only check for (rc < 0) to detect failure. It was incorrectly assumed that pthread_create and pthread_setaffinity_np return negative errnos. They always returns positive ones, so this patch negates their return values before returning. Fixes: 9e5afc72c909 ("eal: add function to create control threads") Cc: olivier.matz@6wind.com Cc: stable@dpdk.org Signed-off-by: Dariusz Stojaczyk Acked-by: Anatoly Burakov Reviewed-by: Olivier Matz --- lib/librte_eal/common/eal_common_thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index 8110ac2ae..48ef4d6de 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -175,7 +175,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, params = malloc(sizeof(*params)); if (!params) - return -1; + return -ENOMEM; params->start_routine = start_routine; params->arg = arg; @@ -185,7 +185,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, ret = pthread_create(thread, attr, rte_thread_init, (void *)params); if (ret != 0) { free(params); - return ret; + return -ret; } if (name != NULL) { @@ -228,5 +228,5 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, } pthread_cancel(*thread); pthread_join(*thread, NULL); - return ret; + return -ret; } -- 2.11.0