This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Linux: consolidate rename()
- From: Yury Norov <ynorov at caviumnetworks dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: <libc-alpha at sourceware dot org>, <zackw at panix dot com>, <arnd at arndb dot de>
- Date: Thu, 20 Oct 2016 15:52:49 +0300
- Subject: Re: [PATCH v2] Linux: consolidate rename()
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yuri dot Norov at caviumnetworks dot com;
- References: <1476924756-31448-1-git-send-email-ynorov@caviumnetworks.com> <mvminsno5qf.fsf@hawking.suse.de> <20161020112331.GA13995@yury-N73SV> <mvmpomvmc5i.fsf@hawking.suse.de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Thu, Oct 20, 2016 at 02:35:05PM +0200, Andreas Schwab wrote:
> On Okt 20 2016, Yury Norov <ynorov@caviumnetworks.com> wrote:
>
> > Hi Andreas,
> >
> > On Thu, Oct 20, 2016 at 09:10:48AM +0200, Andreas Schwab wrote:
> >> On Okt 20 2016, Yury Norov <ynorov@caviumnetworks.com> wrote:
> >>
> >> > diff --git a/sysdeps/unix/sysv/linux/rename.c b/sysdeps/unix/sysv/linux/rename.c
> >> > new file mode 100644
> >> > index 0000000..8e14d7d
> >> > --- /dev/null
> >> > +++ b/sysdeps/unix/sysv/linux/rename.c
> >>
> >> This overrides the unix/syscalls.list entry, thus architectures which
> >> implement the rename syscall no longer use it.
> >
> > Yes. You want me to notice it in commit message?
>
> Do all supported kernels implement renameat?
Ah, now I understand you. It should be then like
#include <fcntl.h>
#include <stdio.h>
/* Rename the file OLD to NEW. */
int
rename (const char *old, const char *new)
{
#ifdef __NR_rename
return INLINE_SYSCALL_CALL (rename, old, new);
#else
return renameat (AT_FDCWD, old, AT_FDCWD, new);
#endif
}
Is it OK?