[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230919190206.388896-4-axelrasmussen@google.com>
Date: Tue, 19 Sep 2023 12:01:59 -0700
From: Axel Rasmussen <axelrasmussen@...gle.com>
To: Alejandro Colomar <alx@...nel.org>, Peter Xu <peterx@...hat.com>
Cc: linux-man@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Axel Rasmussen <axelrasmussen@...gle.com>
Subject: [PATCH 03/10] userfaultfd.2: comment on feature detection in the
example program
The example program doesn't depend on any extra features, so it does not
make use of the two-step feature handshake process. This is fine, but it
might set a bad example for programs which *do* depend on specific
features (e.g. they may conclude they don't need to do anything to
enable / detect them).
No need to make the example program more complicated: let's just add a
comment indicating why we do it the way we do it in the example, and
describing briefly what a more complicated program would need to do
instead.
The comment is kept rather brief; a full description of this feature
will be included in ioctl_userfaultfd.2 instead.
Signed-off-by: Axel Rasmussen <axelrasmussen@...gle.com>
---
man2/userfaultfd.2 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2
index 00d94e514..b2b79f61d 100644
--- a/man2/userfaultfd.2
+++ b/man2/userfaultfd.2
@@ -881,6 +881,13 @@ main(int argc, char *argv[])
if (uffd == \-1)
err(EXIT_FAILURE, "userfaultfd");
\&
+ /* NOTE: Two-step feature handshake is not needed here, since this
+ example doesn't require any specific features.
+
+ Programs that *do* should call UFFDIO_API twice: once with
+ `features = 0` to detect features supported by this kernel, and
+ again with the subset of features the program actually wants to
+ enable. */
uffdio_api.api = UFFD_API;
uffdio_api.features = 0;
if (ioctl(uffd, UFFDIO_API, &uffdio_api) == \-1)
--
2.42.0.459.ge4e396fd5e-goog
Powered by blists - more mailing lists