This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Linux: consolidate rename()
On 20/10/2016 13:31, Joseph Myers wrote:
> On Thu, 20 Oct 2016, Adhemerval Zanella wrote:
>
>> I think the idea is to remove the 'generic' folder and let the
>> sysdeps/unix/sysv/linux/ be the generic Linux implementation (which makes
>> more sense IMHO and avoid confusion in which folder to imply).
>
> That's fine, but when there are so many deficiencies in a single patch it
> seems to make sense to suggest it be split into baby steps, so supporting
> systems with only renameat2 is separate from unifying the implementations
> of these functions into a single set of sources, which is separate from
> any change of the rename function from using the rename syscall to using
> the renameat syscall on platforms that have the rename syscall (if such a
> change is desired at all).
Yes, for this specific patch it seems sensible to split it in smaller
changes.
>
>> Now, related to patch I think a simpler implementation for both
>> rename and renameat would be just:
>>
>> * sysdeps/unix/sysv/linux/rename.c:
>>
>> int
>> rename (const char *old, const char *new)
>> {
>> #ifdef __NR_rename
>> return INLINE_SYSCALL_CALL (rename, old, new);
>> #else
>> return INLINE_SYSCALL_CALL (renameat, AT_FDCWD, old, AT_FDCWD, new);
>> #endif
>> }
>
> That of course is an implementation for the present situation of not
> handling renameat2-only architectures, and a further conditional would be
> needed for handling such architectures (but with a division into baby
> steps, supporting renameat2 here would be separate from combining the
> support for rename and renameat syscalls).
Indeed I did not take this constraint in consideration (an architecture
that only supports renameat2).