From 6dd5089b684c002ca009a2c56fb14a83dd6f1d05 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Mon, 25 Aug 2008 15:47:26 +0200 Subject: [PATCH] * src/vm/os.hpp (os): Added readlink. (os::readlink): New function. --- src/vm/os.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vm/os.hpp b/src/vm/os.hpp index e8bc08fad..45ec5412f 100644 --- a/src/vm/os.hpp +++ b/src/vm/os.hpp @@ -143,6 +143,7 @@ public: static inline void* memcpy(void* dest, const void* src, size_t n); static inline void* memset(void* s, int c, size_t n); static inline int mprotect(void* addr, size_t len, int prot); + static inline ssize_t readlink(const char* path, char* buf, size_t bufsiz); static inline int scandir(const char* dir, struct dirent*** namelist, int(*filter)(const struct dirent*), int(*compar)(const void*, const void*)); static inline int setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen); static inline int shutdown(int s, int how); @@ -479,6 +480,15 @@ inline static ssize_t system_read(int fd, void *buf, size_t count) #endif } +inline ssize_t os::readlink(const char* path, char* buf, size_t bufsiz) +{ +#if defined(HAVE_READLINK) + return ::readlink(path, buf, bufsiz); +#else +# error readlink not available +#endif +} + inline static void *system_realloc(void *ptr, size_t size) { #if defined(HAVE_REALLOC) -- 2.25.1