Kernel+LibC+LibCore: Implement the unlinkat(2) syscall

This commit is contained in:
sin-ack 2022-02-10 11:30:33 +00:00 committed by Brian Gianforcaro
commit bc7c8879c5
Notes: sideshowbarker 2024-07-17 11:35:08 +09:00
7 changed files with 31 additions and 6 deletions

View file

@ -644,7 +644,13 @@ int link(char const* old_path, char const* new_path)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
int unlink(char const* pathname)
{
int rc = syscall(SC_unlink, pathname, strlen(pathname));
return unlinkat(AT_FDCWD, pathname, 0);
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html
int unlinkat(int dirfd, char const* pathname, int flags)
{
int rc = syscall(SC_unlink, dirfd, pathname, strlen(pathname), flags);
__RETURN_WITH_ERRNO(rc, rc, -1);
}