aboutsummaryrefslogtreecommitdiff
path: root/src/posix_extras.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/posix_extras.h')
-rw-r--r--src/posix_extras.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/posix_extras.h b/src/posix_extras.h
index 2976016..889175e 100644
--- a/src/posix_extras.h
+++ b/src/posix_extras.h
@@ -93,6 +93,11 @@ class File {
// fewer bytes are returned.
std::vector<std::uint8_t> Read(off_t, size_t) const;
+ // Reads the contents of a symbolic link. The path to the symbolic link is
+ // interpreted relative to the file descriptor and must indeed be relative
+ // (i.e., it must not start with '/').
+ std::string ReadLinkAt(const char* path) const;
+
// Renames a file from old_path to new_path. Both paths are interpreted
// relative to the file descriptor, and both must indeed be relative (i.e.,
// they must not start with '/').
@@ -102,6 +107,11 @@ class File {
// path must indeed be relative (i.e., it must not start with '/').
void RmDirAt(const char* path) const;
+ // Creates a symlink at source pointing to target. target is unvalidated.
+ // source is interpreted as a path relative to the file descriptor and must
+ // indeed be relative (i.e., it must not start with '/').
+ void SymLinkAt(const char* target, const char* source) const;
+
// Removes the file at the path relative to the file descriptor. The path
// must indeed be relative (i.e., it must not start with '/').
void UnlinkAt(const char* path) const;