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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 30, 2024 at 6:49 PM Thiago Macieira <thiago@xxxxxxx> wrote:
>
> 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.
>

It can be used to inspect the state of the line without requesting it
for exclusive usage. Please take a look at how `gpiocli info` uses it
(dbus/client/info.c). There's no reason we'd want to force any real
action on the HW just to check if a line is busy.

> 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.
>

No because the user may want to just inspect the state. It's not racy:
if the user wants to request the line, they will do it right away and
see an error if the line is busy.

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

That could be said about all of the methods but the error messages
returned on failures are quite descriptive and by looking at the many
DBus .xml on my system I can tell it's not that common to have a list
of all possible errors in the docs.

Bart

> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>   Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux