From nobody Thu Nov 14 00:32:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xph1r57Cpz5cnBr; Thu, 14 Nov 2024 00:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xph1r4gsKz4q5d; Thu, 14 Nov 2024 00:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731544352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gJ7py5fya5sL1WnwLzFebeD/jP6icQEvPwKuKtc10jE=; b=HIbGet3/7yQjVePBhp2Yz2ckEbW16idzp7OQSoqsB8uvdqcA1Mlxp6/mrEHwFyAzV1+Nuv FhW4hOg/Y8Rvk/eLrYOfdaS3GA200MAchbqAhhlwshLmI0puexYQroaVa2oAqxb8iA2ahm kCMTzNpfiikq5p5tB4nzScMXNRXZvO8XpOpLwJRBfa1bPD7HGMtdDypbGw3z75WwRHEl6Z 6NvUh3vCBJzg4mXNHletgCyYMARBiNgLpiCR0Q3jEAQPU5wf9ulspI6NDVVH7jONVfZcmR Lqi3H3DwazxjRVRXgvZnWGimS0pqQdEsBeE30OFsmQxXWvGldNTaJVcWjYKH1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731544352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gJ7py5fya5sL1WnwLzFebeD/jP6icQEvPwKuKtc10jE=; b=hAW8JvrHkN4K74/FLqsn4xnfOwWoEafwO2JvMtqzpNmZwugP/gnG/8eplruZuTi5MwF5nZ A71mQuyNwhkFiqRK5i+tH4uy8ucpyn4y8s6NZ8KNi2ZLuZvAcEsZWVV0yDgXqmaDFLYNWR 9+w5kZUxQpgi/Udj9gRV/gG8Q31v6tsE06shWqoJ9fTir6QAuZe11RBYd09uhe/XljY+3B 9eJlQAvsfU7cqhSQGdXd/3skFwc+Tn+3bNrqarx5SjRJzyKBMym6w8NHN6ONoae50QMgAR aF6ofGBsUHuWIzIumiFL+y35SFK65UuBG5nwgcKhaKzFas0MWaSoUBs79Bn/GA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731544352; a=rsa-sha256; cv=none; b=hUsGJlo54ae8qfjiod+0WNXCZ93hGGbH8YFw1x281OqQZXw7aZ8HnXc2vF3dNfdvIgpj3H u1rSeGLYYjmFifXUcHOsCH+/Ya6KI2waht71aVghN+BGsPh8/yGP4W4u4wqa+Oe07yOWRw ehBqp3xZdda4fJzIP0ZQgLYvNQYNcgZi53uLdKlO0/1PZDfenjBopPb5PVSNXdYzLa+jJk 8UEQE3KQyDhTN8H1vbVjjJVMgEPIeg2zQJCHvMK0lTSuwCOfmiCbQM2GVlUedGzFDiZR71 V0lDD8PLzyEOHUvhCWLheCIcLGgMADQs/oprVv3M53EPjvLHdCFBYPJKOgxE7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xph1r4HHyzG1G; Thu, 14 Nov 2024 00:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AE0WWcd005036; Thu, 14 Nov 2024 00:32:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AE0WW4L005033; Thu, 14 Nov 2024 00:32:32 GMT (envelope-from git) Date: Thu, 14 Nov 2024 00:32:32 GMT Message-Id: <202411140032.4AE0WW4L005033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 36887e04947f - main - sched_getcpu: Add man page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36887e04947fedfebb9b648fadd0dd6cc03142ea Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=36887e04947fedfebb9b648fadd0dd6cc03142ea commit 36887e04947fedfebb9b648fadd0dd6cc03142ea Author: Ed Maste AuthorDate: 2024-11-13 22:04:06 +0000 Commit: Ed Maste CommitDate: 2024-11-14 00:32:04 +0000 sched_getcpu: Add man page Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47556 --- lib/libsys/Makefile.sys | 1 + lib/libsys/sched_getcpu.3 | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index 87290a17820a..4be64a98bb96 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -299,6 +299,7 @@ MAN+= abort2.2 \ rmdir.2 \ rtprio.2 \ sched_get_priority_max.2 \ + sched_getcpu.3 \ sched_setparam.2 \ sched_setscheduler.2 \ sched_yield.2 \ diff --git a/lib/libsys/sched_getcpu.3 b/lib/libsys/sched_getcpu.3 new file mode 100644 index 000000000000..050a8f3facb4 --- /dev/null +++ b/lib/libsys/sched_getcpu.3 @@ -0,0 +1,51 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2024 The FreeBSD Foundation +.\" +.\" This documentation was written by Ed Maste +.\" under sponsorship from the FreeBSD Foundation. +.\" +.Dd November 13, 2024 +.Dt SCHED_GETCPU 3 +.Os +.Sh NAME +.Nm sched_getcpu +.Nd get current CPU +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sched.h +.Ft int +.Fn sched_getcpu void +.Sh DESCRIPTION +The +.Fn sched_getcpu +function returns the current CPU on which the calling thread is running. +.Sh RETURN VALUES +.Fn sched_getcpu +returns the 0-based index of the current CPU at the time of the call. +The value may become invalid immediately after return, unless the thread is +pinned to a specific CPU. +CPU numbering is the same as used by +.Xr cpuset 2 +and CPU affinity calls. +.Pp +There are no error values as +.Fn sched_getcpu +does not fail. +.Sh SEE ALSO +.Xr cpuset 2 , +.Xr cpuset_getaffinity 2 , +.Xr cpuset_setaffinity 2 , +.Xr pthread_getaffinity_np 3 , +.Xr pthread_setaffinity_np +.Sh STANDARDS +The +.Nm +function originated in Linux. +This implementation aims to be source-compatible with the Linux implementation. +.Sh HISTORY +The +.Nm +function was introduced in +.Fx 13.1 .