Re: [PATCH RESEND libgpiod v2 10/18] dbus: add the API definitions

Thiago Macieira <[email protected]> Sun, 30 Jun 2024 09:49:35 -0700
Newsgroups gmane.comp.freedesktop.dbus,gmane.linux.kernel.gpio
Message-ID <1917470.LkxdtWsSYb@tjmaciei-mobl5>
On Friday 28 June 2024 11:58:29 GMT-7 Bartosz Golaszewski wrote:
> +    <!--
> +      Used:
> +
> +      True if line is busy.
> +
> +      Line can be used by gpio-manager, another user-space process, a
> kernel +      driver or is hogged. The exact reason a line is busy cannot
> be determined +      from user-space unless it's known to be managed by
> gpio-manager (see: +      the Managed property of this interface).
> +    -->
> +    <property name='Used' type='b' access='read'/>

What's the point of this property? It looks racy, as the user (whichever it 
is) can stop using it soon after a true read, or the line can become used 
right after a false read? The latter could lead to TOCTOU problems.

Wouldn't it be better to force users to RequestLine and get an error if the 
line is busy? Because if it wasn't busy, now the calling application knows 
nothing else can grab it.

Speaking of, RequestLine should document the errors it may return.