Kernel/LibC: Implement readlink and readlinkat

This commit is contained in:
2023-11-11 23:16:52 +02:00
parent 381cfdad77
commit c084ce8b01
5 changed files with 62 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ __BEGIN_DECLS
#define SYS_CREATE 56 // creat, mkfifo
#define SYS_CREATE_DIR 57 // mkdir
#define SYS_UNLINK 58
#define SYS_READLINK 59
#define SYS_READLINKAT 60
__END_DECLS

View File

@@ -78,6 +78,16 @@ ssize_t write(int fildes, const void* buf, size_t nbyte)
return syscall(SYS_WRITE, fildes, buf, nbyte);
}
ssize_t readlink(const char* __restrict path, char* __restrict buf, size_t bufsize)
{
return syscall(SYS_READLINK, path, buf, bufsize);
}
ssize_t readlinkat(int fd, const char* __restrict path, char* __restrict buf, size_t bufsize)
{
return syscall(SYS_READLINKAT, fd, path, buf, bufsize);
}
int dup(int fildes)
{
return syscall(SYS_DUP, fildes);