This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Linux: Add <sys/direntries.h>



On 08/07/2019 08:19, Florian Weimer wrote:
> * Florian Weimer:
> 
>> This header file provides the types struct direntry and struct
>> direntries, and the functions direntries_init, direntries_read,
>> and direntries_next.  Using a separate header file (instead of
>> augmenting <dirent.h>) allows more straightforward type names
>> because identifier collisions are less of a problem (new code
>> can work around them).
>>
>> The d_off member is not exposed via struct direntry because it is
>> difficult to use correctly (it refers to the *next* entry), and
>> it is also difficult to emulate with other interfaces.
> 
> Any comments on this patch?  I think it fits the addition of getdents64.
> 
>   <https://sourceware.org/ml/libc-alpha/2019-06/msg00418.html>

I really think these function should be part of the application
that wants to use getdents instead of glibc.  Some of functionalities 
are already provided by dirent functions and the API adds the extensible
layer which in turn adds even more indirection (some getdents usage 
I see in the wild is exactly to avoid the multiple buffer copies).

The only advantage I see is it allows use provide a specific buffer
for getdents usage instead of the pre-defined one using in opendir.
However I would prefer to add a opendir_np which uses a user-provided
buffer instead (similar to the hack I did for posix_spawn closeall).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]