From patchwork Sun Jul 4 20:36:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 470039 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3400810jao; Sun, 4 Jul 2021 13:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhPMbH0bpwrxexbP+wmMrDIcTf0SH+OQ3t/AYPrEXQ0/XNBY2IuX/E2DPIqebRbG52n6qZ X-Received: by 2002:a17:906:2582:: with SMTP id m2mr10122724ejb.97.1625431001934; Sun, 04 Jul 2021 13:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625431001; cv=none; d=google.com; s=arc-20160816; b=qVKuIyIEVByOt8u33clC94dPQAv11kOu7c56yRnhFLUwvk4sku8pRrVwiGpQZ/mxxD DO/HKVN+ANroE3C3h1TMtEM1g1txdcD0ZKTRMUV4jbUTfs1BGwFEhThiHT6jNoc0bocU K5XaWwN6i+RLmJIeziCbJCo1oEixOWAqVva4RDq9Wx69fnmSsKBg6djL3nEFo3rLAtEl ajNXLKNiDlrifV93mMXYSRVrGjzREHRQjqRqLtOYZIBjQkHQM3xC14J0hT8fth8+JhA7 HXVWmsPeuQm5BtTYH3lyA0cvd3YRSY4YiQktEPAQPbh7AHyRLR2aL+HouPtd5i1oQ2D4 z52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=A9Ko76ZMx8BVV+fx9hb93kPIzDQ4seYJiGBHhFarsFY=; b=p99bKLCbzhho8s7+QbRc6Sq5vxucNDSF3vOW/1eu/tln5bdrt0fgBUhpkRq49a64z4 yFiMdHQmTUBAF4C3ld8TP/TEKUNRSCLMzuYGHnyP+oPIcqvgoJ/qQNiiQGUo1tpXvGUM g5C3Myq+yBeMtq7aGne7rswCKw4C7J4AKMFlBECGT34kxagCSHW2rl7/JH0BbWtFiVyw YZHk63cWt6i+tYjyvTl2+NaG+PqO7Kof/OWap9qUvSGOyXh5ZVJpQ6nE5BLpnCRx1zBX rB9ooMwKoFV4vlvSpvM/ec62/YyLYnkRWn4puiH302QxBLNh63qDHmAHSUvtZ1toxOMq 8tPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-rt-users-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-rt-users-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si3034453edq.421.2021.07.04.13.36.41; Sun, 04 Jul 2021 13:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-rt-users-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-rt-users-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-rt-users-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbhGDUjN (ORCPT + 3 others); Sun, 4 Jul 2021 16:39:13 -0400 Received: from mail.monom.org ([188.138.9.77]:39748 "EHLO mail.monom.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbhGDUjG (ORCPT ); Sun, 4 Jul 2021 16:39:06 -0400 Received: from mail.monom.org (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id D8445500665; Sun, 4 Jul 2021 22:36:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.monom.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (unknown [94.31.98.41]) by mail.monom.org (Postfix) with ESMTPSA id 80896500609; Sun, 4 Jul 2021 22:36:28 +0200 (CEST) From: Daniel Wagner To: Clark Williams , John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH rt-tests v1 1/3] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Date: Sun, 4 Jul 2021 22:36:19 +0200 Message-Id: <20210704203621.5612-2-wagi@monom.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210704203621.5612-1-wagi@monom.org> References: <20210704203621.5612-1-wagi@monom.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Daniel Wagner pthread_getaffinity_np() prevents static builds as glibc does not expose it for this configuration. Instead use sched_getaffinity() which is always present and has the exact same semantics. Fixes: f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified [NUM]") Signed-off-by: Daniel Wagner --- src/lib/rt-numa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.32.0 diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c index babcc634d57e..2d34ae36cc03 100644 --- a/src/lib/rt-numa.c +++ b/src/lib/rt-numa.c @@ -68,13 +68,11 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask) int cpu_for_thread_ua(int thread_num, int max_cpus) { int res, num_cpus, i, m, cpu; - pthread_t thread; cpu_set_t cpuset; - thread = pthread_self(); CPU_ZERO(&cpuset); - res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset); + res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); if (res != 0) fatal("pthread_getaffinity_np failed: %s\n", strerror(res));