previous: >>108323183
#define __NR_rename 82
#define __NR_renameat 264
#define __NR_renameat2 316
https://man7.org/linux/man-pages/man2/rename.2.html
tl;dr:
rename a file
mostly a pretty cut and dry syscall. it's only with renameat2 that things start to get interesting, since you can add flags to the call. RENAME_EXCHANGE
and RENAME_NOREPLACE
both make sense intuitively and seem like the type of flags that ought to exist. RENAME_WHITEOUT
is a bit more confusing imo, but that's probably just because i have no experience with overlay/union filesystem implementations. anyone ever used one of those? want to explain to the class wtf is going on? it sort of seems equivalent to bind mounting a null file overtop of it? or something along those lines. the filesystem concept seems pretty interesting in general
aside from that, there are lots of interesting caveats, e.g.
>... there will probably be a window in which both oldpath and newpath refer to the file being renamed.
what do you think, anon? are any of the caveats particularly interesting to you?
relevant resources:
man man
man syscalls
https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/