mirror of https://git.musl-libc.org/git/musl
Browse Source
This syscall is available since Linux 3.15 and also implemented in glibc from version 2.28. It is commonly used in filesystem or security contexts. Constants RENAME_NOREPLACE, RENAME_EXCHANGE, RENAME_WHITEOUT are guarded by _GNU_SOURCE as with glibc.master
committed by
Rich Felker
2 changed files with 18 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||
|
#define _GNU_SOURCE |
||||
|
#include <stdio.h> |
||||
|
#include "syscall.h" |
||||
|
|
||||
|
int renameat2(int oldfd, const char *old, int newfd, const char *new, unsigned flags) |
||||
|
{ |
||||
|
#ifdef SYS_renameat |
||||
|
if (!flags) return syscall(SYS_renameat, oldfd, old, newfd, new); |
||||
|
#endif |
||||
|
return syscall(SYS_renameat2, oldfd, old, newfd, new, flags); |
||||
|
} |
||||
Loading…
Reference in new issue