X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=ikvm-native%2Fos.c;h=43531ae0ea5b5d7666759ac7dd98d5505e4f4067;hb=b9afa882093e6c112faa386ab205f90a056866db;hp=9098d269b379430202a771b1fa672be77a665be5;hpb=8729c3da5a87f5c61f9522c0888924276828428c;p=mono.git diff --git a/ikvm-native/os.c b/ikvm-native/os.c index 9098d269b37..43531ae0ea5 100644 --- a/ikvm-native/os.c +++ b/ikvm-native/os.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Jeroen Frijters + Copyright (C) 2004, 2005 Jeroen Frijters This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,18 +57,26 @@ } #else #include + #include + #include #include "jni.h" + void* JNICALL ikvm_LoadLibrary(char* psz); + JNIEXPORT void* JNICALL ikvm_LoadLibrary(char* psz) { return g_module_open(psz, 0); } + void JNICALL ikvm_FreeLibrary(GModule* handle); + JNIEXPORT void JNICALL ikvm_FreeLibrary(GModule* handle) { g_module_close(handle); } + void* JNICALL ikvm_GetProcAddress(GModule* handle, char* name, jint argc); + JNIEXPORT void* JNICALL ikvm_GetProcAddress(GModule* handle, char* name, jint argc) { void *symbol; @@ -80,4 +88,30 @@ else return NULL; } + + void* JNICALL ikvm_mmap(int fd, jboolean writeable, jboolean copy_on_write, jlong position, jint size); + + JNIEXPORT void* JNICALL ikvm_mmap(int fd, jboolean writeable, jboolean copy_on_write, jlong position, jint size) + { + return mmap(0, size, writeable ? PROT_WRITE | PROT_READ : PROT_READ, copy_on_write ? MAP_PRIVATE : MAP_SHARED, fd, position); + } + + int JNICALL ikvm_munmap(void* address, jint size); + + JNIEXPORT int JNICALL ikvm_munmap(void* address, jint size) + { + return munmap(address, size); + } + + int JNICALL ikvm_msync(void* address, jint size); + + JNIEXPORT int JNICALL ikvm_msync(void* address, jint size) + { +#if defined(__native_client__) && defined(USE_NEWLIB) + g_assert_not_reached (); + return -1; +#else + return msync(address, size, MS_SYNC); +#endif + } #endif