Kernel/LibC: Implement unlinkat

This commit is contained in:
2025-06-01 05:06:47 +03:00
parent 91756c057e
commit b75970958e
4 changed files with 18 additions and 6 deletions

View File

@@ -56,7 +56,7 @@ __BEGIN_DECLS
O(SYS_POWEROFF, poweroff) \
O(SYS_FCHMODAT, fchmodat) \
O(SYS_CREATE_DIR, create_dir) \
O(SYS_UNLINK, unlink) \
O(SYS_UNLINKAT, unlinkat) \
O(SYS_READLINKAT, readlinkat) \
O(SYS_MSYNC, msync) \
O(SYS_PREAD, pread) \

View File

@@ -518,12 +518,17 @@ int fdatasync(int fildes)
int unlink(const char* path)
{
return syscall(SYS_UNLINK, path);
return unlinkat(AT_FDCWD, path, 0);
}
int unlinkat(int fd, const char* path, int flag)
{
return syscall(SYS_UNLINKAT, fd, path, flag);
}
int rmdir(const char* path)
{
return syscall(SYS_UNLINK, path);
return unlinkat(AT_FDCWD, path, AT_REMOVEDIR);
}
char* optarg = nullptr;