From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by sourceware.org (Postfix) with ESMTPS id E4F41384782E for ; Wed, 26 May 2021 16:57:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4F41384782E Received: by mail-qv1-xf29.google.com with SMTP id e8so1076623qvp.7 for ; Wed, 26 May 2021 09:57:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L5keZK/39HtxFWJrH344+W6ipg1rRcsJSxlDHiGvT5I=; b=pbk08jmbzGva51XkWqWdgrKh32QhQ/klhctHy+OJCB+jrTkQHl9bMs693BMHXrmRaG qxV4/PB3arnndlv2KyaEC+SSSIpF747RJj0MjqkygdEf1T4y2K9HpyuLN3nWud+cMcsy wPCs5WOqBKxDGewV4qEdCdawL6nW/oIunu29gNkfFzsJxKMI/TPISisk1Tso4l3HEtG4 v1+pZkpj6yhk0j7oYvl3rCqD8bG2KIwFVjg53HN9rLno0mxjtm50nMYrNhndFFKY+yvB LLYYHmvqAT6kBl207mhjB+eqq9mXoCGVnebsYKm+qpMq21ZNAUqCol0fPcaxX/O0cdDb rDxQ== X-Gm-Message-State: AOAM533xYhlLSP7ScQG46qtj/sTXQxw+i3QS0fiZra/zMc4dejGT8Wwt 3iMcgoi8HHH0MhEaXMQMoaD5bJkbeyB9xQ== X-Google-Smtp-Source: ABdhPJxQ6JGQSfeQtXkClRkT7iVbXR7fCnGUomHiaJXDmfzoZQepYbx4lB3NL0PjSD3k78TFuSbJaQ== X-Received: by 2002:a05:6214:207:: with SMTP id i7mr10661057qvt.10.1622048257357; Wed, 26 May 2021 09:57:37 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id k125sm1859761qkf.53.2021.05.26.09.57.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 09:57:37 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/11] support: Add xpthread_attr_setaffinity_np wrapper Date: Wed, 26 May 2021 13:57:20 -0300 Message-Id: <20210526165728.1772546-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210526165728.1772546-1-adhemerval.zanella@linaro.org> References: <20210526165728.1772546-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 16:57:39 -0000 --- support/Makefile | 1 + support/xpthread_attr_setaffinity_np.c | 28 ++++++++++++++++++++++++++ support/xthread.h | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 support/xpthread_attr_setaffinity_np.c diff --git a/support/Makefile b/support/Makefile index da6dc58d37..0a4b057db5 100644 --- a/support/Makefile +++ b/support/Makefile @@ -128,6 +128,7 @@ libsupport-routines = \ xpthread_attr_init \ xpthread_attr_setdetachstate \ xpthread_attr_setguardsize \ + xpthread_attr_setaffinity_np \ xpthread_attr_setstack \ xpthread_attr_setstacksize \ xpthread_barrier_destroy \ diff --git a/support/xpthread_attr_setaffinity_np.c b/support/xpthread_attr_setaffinity_np.c new file mode 100644 index 0000000000..cddcd5fdb4 --- /dev/null +++ b/support/xpthread_attr_setaffinity_np.c @@ -0,0 +1,28 @@ +/* pthread_attr_setaffinity_np with error checking. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +void +xpthread_attr_setaffinity_np (pthread_attr_t *attr, + size_t cpusetsize, const cpu_set_t *cpuset) +{ + xpthread_check_return ("pthread_attr_setaffinity_np", + pthread_attr_setaffinity_np (attr, cpusetsize, + cpuset)); +} diff --git a/support/xthread.h b/support/xthread.h index 1ba3f133ad..cffd9c1694 100644 --- a/support/xthread.h +++ b/support/xthread.h @@ -66,6 +66,9 @@ void *xpthread_join (pthread_t thr); void xpthread_once (pthread_once_t *guard, void (*func) (void)); void xpthread_attr_destroy (pthread_attr_t *attr); void xpthread_attr_init (pthread_attr_t *attr); +void xpthread_attr_setaffinity_np (pthread_attr_t *attr, + size_t cpusetsize, + const cpu_set_t *cpuset); void xpthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate); void xpthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, -- 2.30.2