* src/vmcore/os.cpp (os_access) [extern "C"]: New function.
* src/vmcore/os.hpp (os): Added malloc.
(system_malloc): Renamed to os::malloc.
int main(int argc, char **argv)
{
#if defined(ENABLE_LIBJVM)
- const char* path;
+ char* path;
# if defined(ENABLE_JRE_LAYOUT)
int len;
# if defined(ENABLE_JRE_LAYOUT)
/* SUN also uses a buffer of 4096-bytes (strace is your friend). */
- path = malloc(sizeof(char) * 4096);
+ path = (char*) os::malloc(sizeof(char) * 4096);
if (readlink("/proc/self/exe", path, 4095) == -1) {
fprintf(stderr, "main: readlink failed: %s\n", strerror(errno));
strcat(path, "/../lib/"LIBJVM_NAME);
# else
- path = CACAO_LIBDIR"/"LIBJVM_NAME;
+ path = (char*) CACAO_LIBDIR"/"LIBJVM_NAME;
# endif
/* First try to open where dlopen searches, e.g. LD_LIBRARY_PATH.
void* os_mmap_anonymous(void *addr, size_t len, int prot, int flags) { return os::mmap_anonymous(addr, len, prot, flags); }
void os_abort(void) { os::abort(); }
+ int os_access(const char* pathname, int mode) { return os::access(pathname, mode); }
int os_atoi(const char* nptr) { return os::atoi(nptr); }
void* os_calloc(size_t nmemb, size_t size) { return os::calloc(nmemb, size); }
#if defined(ENABLE_JRE_LAYOUT)
static inline int getsockname(int s, struct sockaddr* name, socklen_t* namelen);
static inline int getsockopt(int s, int level, int optname, void* optval, socklen_t* optlen);
static inline int listen(int sockfd, int backlog);
+ static inline void* malloc(size_t size);
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);
#endif
}
-inline static void *system_malloc(size_t size)
+inline void* os::malloc(size_t size)
{
#if defined(HAVE_MALLOC)
- return malloc(size);
+ return ::malloc(size);
#else
# error malloc not available
#endif
void* os_mmap_anonymous(void *addr, size_t len, int prot, int flags);
void os_abort(void);
+int os_access(const char* pathname, int mode);
int os_atoi(const char* nptr);
void* os_calloc(size_t nmemb, size_t size);
char* os_dirname(char* path);