lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 3 Jun 2024 10:31:52 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Huichun Feng <foxhoundsk.tw@...il.com>
Cc: corbet@....net, linus.walleij@...aro.org, linux-doc@...r.kernel.org, 
	linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org, 
	warthog618@...il.com
Subject: Re: [PATCH] docs: gpio: prefer pread(2) for interrupt reading

On Sun, Jun 2, 2024 at 9:49 AM Huichun Feng <foxhoundsk.tw@...il.com> wrote:
>
> In legacy sysfs GPIO, when using poll(2) on the sysfs GPIO value for
> state change awaiting, a subsequent read(2) is required for consuming
> the event, which the doc recommends the use of lseek(2) or
> close-and-reopen to reset the file offset afterwards.
>
> The recommendations however, require at least 2 syscalls to consume
> the event. Gladly, use of pread(2) require only 1 syscall for the
> consumption. Let's advertise this usage by prioritizing its placement.
>
> Signed-off-by: Huichun Feng <foxhoundsk.tw@...il.com>
> ---
>  Documentation/userspace-api/gpio/sysfs.rst | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/userspace-api/gpio/sysfs.rst b/Documentation/userspace-api/gpio/sysfs.rst
> index 116921048..bd64896de 100644
> --- a/Documentation/userspace-api/gpio/sysfs.rst
> +++ b/Documentation/userspace-api/gpio/sysfs.rst
> @@ -97,9 +97,10 @@ and have the following read/write attributes:
>                 poll(2) will return whenever the interrupt was triggered. If
>                 you use poll(2), set the events POLLPRI and POLLERR. If you
>                 use select(2), set the file descriptor in exceptfds. After
> -               poll(2) returns, either lseek(2) to the beginning of the sysfs
> -               file and read the new value or close the file and re-open it
> -               to read the value.
> +               poll(2) returns, use pread(2) to read the value at offset
> +               zero. Alternatively, either lseek(2) to the beginning of the
> +               sysfs file and read the new value or close the file and
> +               re-open it to read the value.
>
>         "edge" ...
>                 reads as either "none", "rising", "falling", or
> --
> 2.34.1
>

Please don't send new versions of a patch as responses in an email
thread. Otherwise tools such as b4 cannot tell if it's a new version
or part of a larger series. Please always start a new thread with get
send-email or - better yet - start using b4 and let it manage the
series for you. Please resend this correctly.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ