mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 14:38:21 +00:00
syscalls: readlinkat
This commit is contained in:
@@ -133,10 +133,10 @@ index 0000000..e5b087a
|
||||
+
|
||||
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||
new file mode 100644
|
||||
index 0000000..0b9a48b
|
||||
index 0000000..90bfad3
|
||||
--- /dev/null
|
||||
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||
@@ -0,0 +1,322 @@
|
||||
@@ -0,0 +1,329 @@
|
||||
+#include <bits/ensure.h>
|
||||
+#include <mlibc/debug.hpp>
|
||||
+#include <mlibc/all-sysdeps.hpp>
|
||||
@@ -211,6 +211,13 @@ index 0000000..0b9a48b
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ int sys_readlink(const char *path, void *buffer, size_t max_size, ssize_t *length) {
|
||||
+ long ret;
|
||||
+ long error = syscall(SYSCALL_READLINKAT, &ret, AT_FDCWD, (uint64_t)path, (uint64_t)buffer, max_size);
|
||||
+ *length = ret;
|
||||
+ return error;
|
||||
+ }
|
||||
+
|
||||
+ static int dolink(int oldfd, const char *oldpath, int newfd, const char *newpath, int flags, int type) {
|
||||
+ long ret;
|
||||
+ return syscall(SYSCALL_LINKAT, &ret, oldfd, (uint64_t)oldpath, newfd, (uint64_t)newpath, flags, type);
|
||||
@@ -478,10 +485,10 @@ index 0000000..990eca0
|
||||
+#endif
|
||||
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||
new file mode 100644
|
||||
index 0000000..ee926b6
|
||||
index 0000000..fa60d43
|
||||
--- /dev/null
|
||||
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||
@@ -0,0 +1,53 @@
|
||||
@@ -0,0 +1,54 @@
|
||||
+#ifndef _SYSCALL_H_INCLUDE
|
||||
+#define _SYSCALL_H_INCLUDE
|
||||
+
|
||||
@@ -515,6 +522,7 @@ index 0000000..ee926b6
|
||||
+#define SYSCALL_MKDIRAT 27
|
||||
+#define SYSCALL_CLOCKGET 28
|
||||
+#define SYSCALL_LINKAT 29
|
||||
+#define SYSCALL_READLINKAT 30
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
|
||||
Reference in New Issue
Block a user