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 v2] Linux: consolidate rename()


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?


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