Kernel/LibC: Implement unlinkat
This commit is contained in:
@@ -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) \
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user