From patchwork Fri Oct 21 22:32:58 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: 13015559 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 61C6FECDFA1 for ; Fri, 21 Oct 2022 22:33:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE0DB8E0006; Fri, 21 Oct 2022 18:33:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D69BF8E0001; Fri, 21 Oct 2022 18:33:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE4658E0006; Fri, 21 Oct 2022 18:33:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AA3658E0001 for ; Fri, 21 Oct 2022 18:33:14 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7EF7A80439 for ; Fri, 21 Oct 2022 22:33:14 +0000 (UTC) X-FDA: 80046408708.16.52D20CB Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf07.hostedemail.com (Postfix) with ESMTP id 2A11240034 for ; Fri, 21 Oct 2022 22:33:13 +0000 (UTC) Received: by mail-pf1-f201.google.com with SMTP id cu10-20020a056a00448a00b00562f2ff1058so1972291pfb.23 for ; Fri, 21 Oct 2022 15:33:13 -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=j2YCFcqV/9HrzAdGPsM8brD/lu5Yer6yqOKsV1muLNk=; b=HHfec0IrAIaL4AtU3Wpm7aVpC4i94PMX7nrLVtU6PvrMsavLXNOlDhshgg27hWZdIt idPOGOjnsq77chS50l9alJOA+dp4fbdKYtel6mYHNQ0akrF1p8ChpF5/BYN52LnexEBP 4ve9YZatUDehddh8CDFokDoIQ9E4TWQaMCb7hlSA0ZSD3X5/3xZiZwsnuj4TULdfP21s rJxUGOJwsrRBDKXUMAi2FYITq1O0NUNm0y+ZwLxQ+lhk/d7Hmj7xI0EzASF75pcDym+d vZDT9jSnS45yobGQuRhMMbj2hdTyKiuHpvOcVNhdpt+koA5Fu0eDrCUVicuoZ3OvKAgl kgTQ== 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=j2YCFcqV/9HrzAdGPsM8brD/lu5Yer6yqOKsV1muLNk=; b=UILP8I3f4KF+R9Fgxfv7CReNBI2Gwg+fkmWa9QafNIetFY8aQ/8rdp65+81/lV1oY4 W1fJ4eKuqW93zl8ivKqx2DWJymfNL2sN4ej0usfjq+9nvQi87KFsZiYfX4tzNZgh8Axz lW9bY+46VrEdFG/b8z4UR3qrm36OyQu2N7w+lznsGc0HdIAjBDPp7Y6p97Us43eO4iMp K37uq1MvWO+dp3pqfVa9VFtEdk7+Qdk4pC/SnapHVt4HhR4vhrG8vNJn42r6UzFq+mYH MnWghXBgMQlYqMxHpmzjMIja0x9G/RfA1Yu5+eRDINrcKzNbvYV4M8FQdwQxZf2eSq6f bSjQ== X-Gm-Message-State: ACrzQf2Rfr+nUkyLmi4bDMWieOoAd6FjfbbHRkjrh9xEVFBazWxGxiHb 6bDB2ZlnX2Qe/emhhVUnx6r7BKJ+6gx4 X-Google-Smtp-Source: AMsMyM5jbebFfHwkbcLcmu7Jew0Ty0YvJLAwsxWJiSk2lsX8c+ywMk9uxffW2GmlBDmylLmhg9xrUyNlvbUA X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a62:144b:0:b0:562:38de:9a0e with SMTP id 72-20020a62144b000000b0056238de9a0emr21455891pfu.78.1666391593062; Fri, 21 Oct 2022 15:33:13 -0700 (PDT) Date: Fri, 21 Oct 2022 15:32:58 -0700 In-Reply-To: <20221021223300.3675201-1-zokeefe@google.com> Mime-Version: 1.0 References: <20221021223300.3675201-1-zokeefe@google.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221021223300.3675201-3-zokeefe@google.com> Subject: [PATCH man-pages v3 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666391594; 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=j2YCFcqV/9HrzAdGPsM8brD/lu5Yer6yqOKsV1muLNk=; b=3YnP+HlyDiUhKfinyvYMzpgs7NPklK2rvOJyaVYLBB2lcoBOXf9hF+6O9yl4q3Ib41hfW1 sfstUWXzBywX5GP/SEKfYJ7thBhv9MkpjdhrTMYsOJc8O7jMLSQqYKPB/0P0g0pjNpPzj1 lzuOP6qYV/ZNKmi01sc0X8xR76Oq1VQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HHfec0Ir; spf=pass (imf07.hostedemail.com: domain of 3KR5TYwcKCNINC822324CC492.0CA96BIL-AA8Jy08.CF4@flex--zokeefe.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3KR5TYwcKCNINC822324CC492.0CA96BIL-AA8Jy08.CF4@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666391594; a=rsa-sha256; cv=none; b=eVB0oqcV/XsUmg/wHmGSeYNjpx/Ns3hPyUu87UcT7PsD9XkKmxTe4ZF+8JV6tctxzGrzxj mGFiaxdvkLk8+9yuBOXeoYqbVnsh0p4eRQhNGw7H8WNhBWqNZe1oof6n6ArtKK+982Rw+U dvGjWqldESoY6TDuu/oFQaFHW3htPX0= X-Stat-Signature: yngray8ujqn5gicgabzunkmsdx7qojxa X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HHfec0Ir; spf=pass (imf07.hostedemail.com: domain of 3KR5TYwcKCNINC822324CC492.0CA96BIL-AA8Jy08.CF4@flex--zokeefe.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3KR5TYwcKCNINC822324CC492.0CA96BIL-AA8Jy08.CF4@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2A11240034 X-HE-Tag: 1666391593-13779 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 ()