From patchwork Mon Oct 17 17:55:21 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: 13009197 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 B797DC43219 for ; Mon, 17 Oct 2022 17:55:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57FA26B0078; Mon, 17 Oct 2022 13:55:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5090E6B007B; Mon, 17 Oct 2022 13:55:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AADA6B007D; Mon, 17 Oct 2022 13:55:31 -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 2B9906B0078 for ; Mon, 17 Oct 2022 13:55:31 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 05B741C670C for ; Mon, 17 Oct 2022 17:55:31 +0000 (UTC) X-FDA: 80031193662.19.88EAF7F Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf01.hostedemail.com (Postfix) with ESMTP id A193840042 for ; Mon, 17 Oct 2022 17:55:30 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id o17-20020a170902d4d100b0018552c4f4bcso1961244plg.13 for ; Mon, 17 Oct 2022 10:55:30 -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=agT9QZQMe+zYcofiwo2fky7Lo5K5JsV+HiadouuU+xY=; b=S7DlGIdUa4amE9BoDHGwjgJKqiO83psDwvsaprmeCr6GoWIkFEdQbvV1sXIPEdMv9g 0S+OXhabA0N1xRVPgyuPg8TszXx/+yHwEO/CwpGp6XtpFK4Aa0li2Rgx7e8Wep8ZS4Yg D2hoxAMrGZxuAweBsXnXIRb2O4uBtN4Hu9jS5ucQx6yD3+/rFU9BvVSoZ40szyivSNPQ mPYW2ZFLSvD8UW88Br1sKdAu1R5d5pxrbcFyU/efuZkbveR396g+Zsvi7twrPveruTq1 bibaRLQLbg+zlWTHOfH5AEGo01xabCQUJWuWanJovvYb+5EK1z3YP+FGpyatA6wVwCX2 T1wQ== 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=agT9QZQMe+zYcofiwo2fky7Lo5K5JsV+HiadouuU+xY=; b=qFu1nT5nJnyYWj09TUcngZLugGIJfWPdzx3L/k2XCOYuoSjuwuxU8lYdmthT2JqMuw 1YPhWZNeH6P2Lb87iEQnXiI9Dm2J4oRv7uWmoBxTjNWbknr7vFGwwDuzuaj4BVPdFxRp aDkPpA4pe9Sc1VD4cyWAyeNpb5b5NXRbUHTNqbcRVNMdduGj5uQKaRv9ireI523Z/zbF /6I6NYebB1egaJSHwNWG+soDfNR+0t6HS3FcRP8grId6lHx/6hfSPEyvS00j532/a1JI GqrcbVR/bMPgL1wg/8QW0nqs38YEhsEGR4u0q0oubVfrpwLH/RX0KA61VvWL8wo6PI2W AtOQ== X-Gm-Message-State: ACrzQf29PpRHUHPQQvfzgKVvE4+/RR9RTqxcVIoCCubxYm0koDnHYAnt zgHpNBLkuq5Y7LBwK2oeqwYt8Q/9xvHY X-Google-Smtp-Source: AMsMyM5HuNyELUBHl+u6TZZkzRJi+vyJvjs8M4Fo5QyR44pbs2aljP0dCpBB03K1dW9Fpcw4ETF6ejUH7NJA X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:902:ef92:b0:17e:2618:ee91 with SMTP id iz18-20020a170902ef9200b0017e2618ee91mr13497088plb.122.1666029329663; Mon, 17 Oct 2022 10:55:29 -0700 (PDT) Date: Mon, 17 Oct 2022 10:55:21 -0700 In-Reply-To: <20221017175523.2048887-1-zokeefe@google.com> Mime-Version: 1.0 References: <20221017175523.2048887-1-zokeefe@google.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog Message-ID: <20221017175523.2048887-3-zokeefe@google.com> Subject: [PATCH man-pages 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666029330; 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=agT9QZQMe+zYcofiwo2fky7Lo5K5JsV+HiadouuU+xY=; b=mysZvbMlzJGcabQH0RyKbbdZ/CzDMgKkgeMc8+tqLULLrjRLjdRhtVkfuFRjgtssHr6pmb UBVxOg9K7ndhy4k9MuWze4SOPiy1/fIfk4aeFdxKovmnLjY3GFKipOiNxgmAvFbfY1ZMiW Rn9ZtU/GmPUyBOGLCng8uzZF36NpJ+0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=S7DlGIdU; spf=pass (imf01.hostedemail.com: domain of 3EZdNYwcKCJYPEA44546EE6B4.2ECB8DKN-CCAL02A.EH6@flex--zokeefe.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3EZdNYwcKCJYPEA44546EE6B4.2ECB8DKN-CCAL02A.EH6@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666029330; a=rsa-sha256; cv=none; b=FvkOe8I5i2XnBIl8ls1sgfyXapi0w8npwwqNXFlt2Gz58YVrTn0P5T/yZw9SGjM5eM5RgW 3Zx3E8sGTn+AuMUt15MK805k6L/1Ae7jRzsnTO43J7OwLKdd3j6joPhF5oXY3rDD8nejaJ PRzr4Zmx5OZrw6cxghbwhi3HuqsTZDM= X-Rspamd-Server: rspam12 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=S7DlGIdU; spf=pass (imf01.hostedemail.com: domain of 3EZdNYwcKCJYPEA44546EE6B4.2ECB8DKN-CCAL02A.EH6@flex--zokeefe.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3EZdNYwcKCJYPEA44546EE6B4.2ECB8DKN-CCAL02A.EH6@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 7c9anbdoitaoqgzfm1fgs6z8on37skzj X-Rspamd-Queue-Id: A193840042 X-HE-Tag: 1666029330-661823 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/man2/madvise.2 b/man2/madvise.2 index e14e0f7fb..adfe24c24 100644 --- a/man2/madvise.2 +++ b/man2/madvise.2 @@ -789,6 +789,13 @@ 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 +.BR madvise (0, +0, +.IR 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 ()