From patchwork Tue Oct 18 23:50:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zach O'Keefe X-Patchwork-Id: 13011208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E023EC4332F for ; Tue, 18 Oct 2022 23:51:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D57C6B0073; Tue, 18 Oct 2022 19:51:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 785956B0074; Tue, 18 Oct 2022 19:51:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64D226B0075; Tue, 18 Oct 2022 19:51:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 54A476B0073 for ; Tue, 18 Oct 2022 19:51:08 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 22D98C0167 for ; Tue, 18 Oct 2022 23:51:08 +0000 (UTC) X-FDA: 80035718616.06.5145928 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf30.hostedemail.com (Postfix) with ESMTP id B512B80024 for ; Tue, 18 Oct 2022 23:51:07 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id c12-20020a170903234c00b0017f695bf8f0so10584627plh.6 for ; Tue, 18 Oct 2022 16:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wd/fY6QKSavm7D1EQgjukQCfw7sIII/V1ACtOSRxwG8=; b=aHetoDSIQJVnq8NUhnzmf11U/kL09k6c1YTQSkzohD/Z0UO0iLChwZCJGBfY4RQvdG EZepcBLhTRbaHHrlNGfg7amGPhNd9pL4e7jrdVABKpz41BeLajfQ9v+ujhM4xEbeW/fm JOnNrCfU1JviAtDdUsq24AHLNcEELrMBGU4JxugsMOovDH0pOriXVvXkvO1pvGJ9mFm2 9LqzOZDrZRe5bf7RxxouQ7QQZ81kLpmastbmmOu4gpGzQ8srLbDkYnzgn8DASqo787bU zeVM/h9VsHOJK62K1ltU4N9M7megtQQ6av68Xr52yP+vZhTT7hRFXOjWVW4mdscZiwJ8 rTSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wd/fY6QKSavm7D1EQgjukQCfw7sIII/V1ACtOSRxwG8=; b=WF2IUm0Fmq5mR4nEOI05oZGEW0UFM8jZsRxN7iKsbYZSO8t1wfV5X2T7suVrutE2a4 /xXsMnVUcg/jy4uDWb2VhCgLpbS0sdi2n22Hy/CfaAJPfL6DEEPIuapdIMXkXwbYPdyg sn/t8wmeH6qiz7A3kbFJTHVom2i2wsv0j1srAoJjX4oK2gAyC35jtG9OkoHM6rj1v5QB EPSEX92IYWXD6KEutxoBtNQL0mjV1iMKFuSWIZJD0XwDL0i8/5ZcS1qG0Qm+I40BSS8V jb7TFJvLrfPGRmuM2cF1lOsqwvl5VKEBKcf3ZdrkofaWsWg0LollB//UUYG6oR3EaFjv bFIg== X-Gm-Message-State: ACrzQf3vXaSZbSk18bBPtnPr2k1SxnlO8QDfAz1iyA0EBc8l0I124vri Q6hQXK8D//y2WsJW5uCdUNiNhdyXN2Hp X-Google-Smtp-Source: AMsMyM6F3VrdnWK11gjs2ukDG4Yeylh6kcOkNOnMEXcElOKlidoqn4RHNF5QmFfW5WRXBoMTki3TK2Kdf3QI X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:90a:4811:b0:20a:fee1:8f69 with SMTP id a17-20020a17090a481100b0020afee18f69mr1905851pjh.0.1666137066188; Tue, 18 Oct 2022 16:51:06 -0700 (PDT) Date: Tue, 18 Oct 2022 16:50:49 -0700 In-Reply-To: <20221018235051.152548-1-zokeefe@google.com> Mime-Version: 1.0 References: <20221018235051.152548-1-zokeefe@google.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog Message-ID: <20221018235051.152548-3-zokeefe@google.com> Subject: [PATCH man-pages v2 2/4] madvise.2: document reliable probe for advice support From: Zach OKeefe To: Alejandro Colomar , Michael Kerrisk Cc: Yang Shi , linux-mm@kvack.org, linux-man@vger.kernel.org, "Zach O'Keefe" ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aHetoDSI; spf=pass (imf30.hostedemail.com: domain of 36jtPYwcKCL84tpjjkjlttlqj.htrqnsz2-rrp0fhp.twl@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=36jtPYwcKCL84tpjjkjlttlqj.htrqnsz2-rrp0fhp.twl@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666137067; a=rsa-sha256; cv=none; b=a+ROFnkFb5fI+FK6cOcWVaz0lbaqXjADfza9lu1B0gvdp/looOvL+RYwcc155n1PufU571 +rWIIYRL+605Y1HhG43Z9wDpkbAzgq262U84Vn1h8cgce1svZZjwZl0X/RyNA6Zyv6q14p o29QMj1sWTIH2gA7WJaOXUN6683KHSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666137067; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wd/fY6QKSavm7D1EQgjukQCfw7sIII/V1ACtOSRxwG8=; b=X3Y6pNH4AdyTTl5iJHjJPHqpwlyEMKmVCGZQltsejxHSjyIZmpQgAs3ihZ/L4pcjP+rKWI kvSdENUv1VN65UZ2AjltM3wUjKFf49yh6IuoUWVUKguEydUFyiRsUCxXdaAJVElAfcCavR l+IcUqTOt9uYCZTeAussqOom4oqPbDY= X-Stat-Signature: bnzsrzsidhawqfzbb8atj5jcyz94xpab X-Rspamd-Queue-Id: B512B80024 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aHetoDSI; spf=pass (imf30.hostedemail.com: domain of 36jtPYwcKCL84tpjjkjlttlqj.htrqnsz2-rrp0fhp.twl@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=36jtPYwcKCL84tpjjkjlttlqj.htrqnsz2-rrp0fhp.twl@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1666137067-389469 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Zach O'Keefe EINVAL is an overloaded error code for madvise(2) and it's not clear under what context it means "advice is not valid" vs another error. Explicitly document that madvise(0, 0, advice) can reliably be used to probe for kernel support for "advice", returning zero iff "advice" is supported by the kernel. Signed-off-by: Zach O'Keefe --- man2/madvise.2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/man2/madvise.2 b/man2/madvise.2 index 64f788ace..df3413cc8 100644 --- a/man2/madvise.2 +++ b/man2/madvise.2 @@ -790,6 +790,11 @@ that are not mapped, the Linux version of ignores them and applies the call to the rest (but returns .B ENOMEM from the system call, as it should). +.PP +.IR madvise(0,\ 0,\ advice) +will return zero iff +.I advice +is supported by the kernel and can be relied on to probe for support. .\" .SH HISTORY .\" The .\" .BR madvise ()