* src/vm/os.hpp (os): Added readlink.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 25 Aug 2008 13:47:26 +0000 (15:47 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 25 Aug 2008 13:47:26 +0000 (15:47 +0200)
(os::readlink): New function.

src/vm/os.hpp

index e8bc08fad54abeda86564340f338572afff2b19f..45ec5412f4cf633bf9165c7ba20e8210d5fbd5c2 100644 (file)
@@ -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)