1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

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
parent a5514fece9
commit bc7c8879c5
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);
}