mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Add renameat2 function [BZ #17662]
The implementation falls back to renameat if renameat2 is not available in the kernel (or in the kernel headers) and the flags argument is zero. Without kernel support, a non-zero argument returns EINVAL, not ENOSYS. This mirrors what the kernel does for invalid renameat2 flags.
This commit is contained in:
@ -153,6 +153,18 @@ extern int renameat (int __oldfd, const char *__old, int __newfd,
|
||||
const char *__new) __THROW;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Flags for renameat2. */
|
||||
# define RENAME_NOREPLACE (1 << 0)
|
||||
# define RENAME_EXCHANGE (1 << 1)
|
||||
# define RENAME_WHITEOUT (1 << 2)
|
||||
|
||||
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
|
||||
additional flags. */
|
||||
extern int renameat2 (int __oldfd, const char *__old, int __newfd,
|
||||
const char *__new, unsigned int __flags) __THROW;
|
||||
#endif
|
||||
|
||||
/* Create a temporary file and open it read/write.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
|
Reference in New Issue
Block a user