summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-01-18 14:42:45 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-20 10:40:51 +0100
commit301f4c469fdd7df72a3acd3fc731de155b2197fd (patch)
tree8894b5e3422d7e2d603386fc4a2a348fd4e23b38 /Userland
parent4d2e3de94ca71a98382b5c2d173c67a84357f677 (diff)
downloadserenity-301f4c469fdd7df72a3acd3fc731de155b2197fd.zip
LibCore: Implement Core::System::lseek
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibCore/System.cpp8
-rw-r--r--Userland/Libraries/LibCore/System.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp
index bbc1a08684..a3b7a3e1bf 100644
--- a/Userland/Libraries/LibCore/System.cpp
+++ b/Userland/Libraries/LibCore/System.cpp
@@ -540,6 +540,14 @@ ErrorOr<pid_t> posix_spawnp(StringView const path, posix_spawn_file_actions_t* c
return child_pid;
}
+ErrorOr<off_t> lseek(int fd, off_t offset, int whence)
+{
+ off_t rc = ::lseek(fd, offset, whence);
+ if (rc < 0)
+ return Error::from_syscall("lseek", -errno);
+ return rc;
+}
+
ErrorOr<WaitPidResult> waitpid(pid_t waitee, int options)
{
int wstatus;
diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h
index 1ade033c6a..5b3e7a1c6c 100644
--- a/Userland/Libraries/LibCore/System.h
+++ b/Userland/Libraries/LibCore/System.h
@@ -87,6 +87,7 @@ ErrorOr<Optional<struct passwd>> getpwuid(uid_t);
ErrorOr<Optional<struct group>> getgrgid(gid_t);
ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts);
ErrorOr<pid_t> posix_spawnp(StringView const path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[]);
+ErrorOr<off_t> lseek(int fd, off_t, int whence);
struct WaitPidResult {
pid_t pid;