Add support for reading symlinks

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-11-21 14:20:41 -05:00
parent 1197797ee1
commit f066dd2ad9
22 changed files with 173 additions and 54 deletions
+3
View File
@@ -53,5 +53,8 @@
/// Maximum number of characters in a path name.
#define PATH_MAX 4096
/// Maximum length of arguments provided to exec function.
#define ARG_MAX 256
/// Maximum pid number.
#define PID_MAX_LIMIT 32768
+7
View File
@@ -60,6 +60,13 @@ int unlink(const char *path);
/// @return 0 on success, a negative number if fails and errno is set.
int symlink(const char *linkname, const char *path);
/// @brief Read the symbolic link, if present.
/// @param file the file for which we want to read the symbolic link information.
/// @param buffer the buffer where we will store the symbolic link path.
/// @param bufsize the size of the buffer.
/// @return The number of read characters on success, -1 otherwise and errno is set to indicate the error.
int readlink(const char *path, char *buffer, size_t bufsize);
/// @brief Wrapper for exit system call.
/// @param status The exit status.
extern void exit(int status);