From nobody Wed Dec 04 18:34:33 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 4Y3R554hTRz5g1Rs; Wed, 04 Dec 2024 18:34:33 +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 4Y3R5544Dmz4v6C; Wed, 4 Dec 2024 18:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733337273; 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=nRqilYJXGPWjAkf0Yb1/pNYQzWhsLo0qnORYcPByxfs=; b=V0xHKh7SGrOSUwngLAcoQoMJDHlZ6xh0OZHf4xVycuHyciPBNc2e1fzfuMI8pA9PN5esGb GamYsQ9vndDiX+f/32DdD2ROHiz0flN0RUUe356gui3HlGUUD7rQi60zHucYY3RmPj8nrA EZOr/9nZkKY0Z+5Fb+1Tx+UhdYyafy3x3TglegjSgOHcXL01nIdu99Zt0xpWODgc6IVMQ5 OxJTVPFBS9cSLUKia0jbaRl0PWM1npNIrewfYmJ/XyCcrk0XE1VcN6eFufMXV2MYCNgog7 hinqmgG8o1bLPWUF2fJaHHfwvumRyiyIOg7sDuyNSLQvKpX6PlAuuGSFU1bnwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733337273; 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=nRqilYJXGPWjAkf0Yb1/pNYQzWhsLo0qnORYcPByxfs=; b=AA3MziktNt2xQCCi0gMbNZJugwsHoybj7SxqGADXwNrBxZSRmFdRcjLlFD6oCaK8LW+J8E HHSqMsEf0S798dREB9fVLW8hPmQ26W+VTOtRfLdmHMlJ580UndyWCwiLfClmq/meIjloTa Oe0yApq+aBYBWc3uaHAVHUSc3CkIX/754kFyOHXQ1mhSzPJ2vk5wwq0U4PpmwnJJCw/6IL LT/wInhj6KTrAdbJD+e2GJiTQaDHigLmkwiTRmJ6qCYxG1GJGSW+rUmLJIQy46LBzP7hOs kdDBFldzETd7uaj3BLl2f6Hu9VdtnvMS4IcHEcgdr9IJJFBafLu3edoqIs0juw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733337273; a=rsa-sha256; cv=none; b=EekeLScEEocuavuiYczIvFcs+rUQR960OgQexZ9HicgeSTQEeJ5ojM68GxsO4/pbEPoDOh KP8MAoI/VzyMNYrCTITAj2bNV8OGE9y3aB8ys6jk1XwuM+YrNXbnfCIOj/nBNJJV09+RW+ 4vfunBjWN5oqaxVyOu52PYXU12G4DnLRmnYODv2Rgx5ijTXjpYvWa2GOXr9ACoTQstamOI Ubjt8uzq2+sK+L73yoBzKsanflzzDKVemTBCRnRtp9qgIs9kCmkj3tM7uztTjLuoUUFIir pN2z/Fbum6JNaUi/GBpJGw6niaRoH45nCeHTdlguAmsAMba0SiGYs+7NY7y/cg== 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 4Y3R553gbkzJnC; Wed, 4 Dec 2024 18:34:33 +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 4B4IYXsT077603; Wed, 4 Dec 2024 18:34:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B4IYXOB077600; Wed, 4 Dec 2024 18:34:33 GMT (envelope-from git) Date: Wed, 4 Dec 2024 18:34:33 GMT Message-Id: <202412041834.4B4IYXOB077600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 25caac4d4566 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 25caac4d456665e4f05f018a15e8ad98bb5d3d9f Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=25caac4d456665e4f05f018a15e8ad98bb5d3d9f commit 25caac4d456665e4f05f018a15e8ad98bb5d3d9f Author: Ed Maste AuthorDate: 2024-11-13 22:04:06 +0000 Commit: Ed Maste CommitDate: 2024-12-04 18:32:58 +0000 sched_getcpu: Add man page Moved from libsys to libc for stable/14. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47556 (cherry picked from commit 36887e04947fedfebb9b648fadd0dd6cc03142ea) --- lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/sched_getcpu.3 | 51 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index e964e3dcff26..7628f121feac 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -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/libc/sys/sched_getcpu.3 b/lib/libc/sys/sched_getcpu.3 new file mode 100644 index 000000000000..050a8f3facb4 --- /dev/null +++ b/lib/libc/sys/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 .