diff --git a/Userland/Libraries/LibC/serenity.cpp b/Userland/Libraries/LibC/serenity.cpp index 5fade72705..7f2bf8364f 100644 --- a/Userland/Libraries/LibC/serenity.cpp +++ b/Userland/Libraries/LibC/serenity.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ #include #include #include +#include extern "C" { @@ -118,4 +119,14 @@ int anon_create(size_t size, int options) int rc = syscall(SC_anon_create, size, options); __RETURN_WITH_ERRNO(rc, rc, -1); } + +int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size) +{ + Syscall::SC_readlink_params small_params { + { path, path_length }, + { buffer, buffer_size } + }; + int rc = syscall(SC_readlink, &small_params); + __RETURN_WITH_ERRNO(rc, rc, -1); +} } diff --git a/Userland/Libraries/LibC/serenity.h b/Userland/Libraries/LibC/serenity.h index 7aa4f97a6c..d2e3b8f96b 100644 --- a/Userland/Libraries/LibC/serenity.h +++ b/Userland/Libraries/LibC/serenity.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,6 +28,7 @@ #include #include +#include __BEGIN_DECLS @@ -103,6 +104,8 @@ int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size); int anon_create(size_t size, int options); +int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size); + #ifdef __i386__ ALWAYS_INLINE void send_secret_data_to_userspace_emulator(uintptr_t data1, uintptr_t data2, uintptr_t data3) {