Re: proposed libc interface and man page for statmount(2)

Ian Kent
2023-11-21T23:07:23Z

On 22/11/23 03:42, Miklos Szeredi wrote:
> On Tue, 21 Nov 2023 at 02:33, Ian Kent <raven@themaw.net> wrote:
>
>> I've completely lost what we are talking about.
> I started thinking about a good userspace API, and I'm skeptical about
> the proposed kernel API being good for userspace as well.
>
> Maybe something like this would be the simplest and least likely to be
> misused (and also very similar to opendir/readdir/closedir):
>
> handle = listmount_open(mnt_id, flags);
> for (;;) {
> child_id = listmount_next(handle);
> if (child_id == 0)
> break;
> /* do something with child_id */
> }
> listmount_close(handle)

Ahh ... yes that seems like something that would work.

Of course we will still end up working with an out of date list

but that's unavoidable, at least the list would be consistent at

the time it was fetched and if it was really needed to have a

consistent list then the above could be used.

Are there potential problems with holding locks over the

open/next/close procedure such as the close not called or the

process crashing?

Ian