Kaynağa Gözat

Documentation: Update `readlink.md` to use `LibFileSystem` api

Cameron Youell 2 yıl önce
ebeveyn
işleme
86781f0c08
1 değiştirilmiş dosya ile 5 ekleme ve 7 silme
  1. 5 7
      Base/usr/share/man/man2/readlink.md

+ 5 - 7
Base/usr/share/man/man2/readlink.md

@@ -26,12 +26,12 @@ and sets `errno` to describe the error.
 ## Notes
 ## Notes
 
 
 The underlying system call always returns the full size of the target path on
 The underlying system call always returns the full size of the target path on
-success, not the number of bytes written. `Core::DeprecatedFile::read_link()` makes use
+success, not the number of bytes written. `FileSystem::read_link()` makes use
 of this to provide an alternative way to read links that doesn't require the
 of this to provide an alternative way to read links that doesn't require the
 caller to pick a buffer size and allocate a buffer straight up.
 caller to pick a buffer size and allocate a buffer straight up.
 
 
 Since it's essentially impossible to guess the right buffer size for reading
 Since it's essentially impossible to guess the right buffer size for reading
-links, it's strongly recommended that everything uses `Core::DeprecatedFile::read_link()`
+links, it's strongly recommended that everything uses `FileSystem::read_link()`
 instead.
 instead.
 
 
 ## Examples
 ## Examples
@@ -40,7 +40,7 @@ The following example demonstrates how one could implement an alternative
 version of `getpid(2)` which reads the calling process ID from ProcFS:
 version of `getpid(2)` which reads the calling process ID from ProcFS:
 
 
 ```c++
 ```c++
-#include <LibCore/DeprecatedFile.h>
+#include <LibFileSystem/FileSystem.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
 pid_t read_pid_using_readlink()
 pid_t read_pid_using_readlink()
@@ -53,11 +53,9 @@ pid_t read_pid_using_readlink()
     return atoi(buffer);
     return atoi(buffer);
 }
 }
 
 
-pid_t read_pid_using_core_file()
+ErrorOr<pid_t> read_pid_using_core_file()
 {
 {
-    auto target = Core::DeprecatedFile::read_link("/proc/self");
-    if (target.is_null())
-        return -1;
+    auto target = TRY(File::read_link("/proc/self"sv));
     auto pid = target.to_uint();
     auto pid = target.to_uint();
     ASSERT(pid.has_value());
     ASSERT(pid.has_value());
     return pid.value();
     return pid.value();