natFileChannelPosix.cc: Implement munmap_adaptor and msync_adaptor for older POSIX_C_SOURCES specs.
2004-03-14 Andreas Tobler <a.tobler@schweiz.ch> * gnu/java/nio/channels/natFileChannelPosix.cc: Implement munmap_adaptor and msync_adaptor for older POSIX_C_SOURCES specs. (MappedByteBufferImpl::unmapImpl): Use munmap_adaptor. (MappedByteBufferImpl::forceImpl): Use msync_adptor. From-SVN: r79462
This commit is contained in:
parent
7db956db83
commit
406c98b264
@ -1,3 +1,10 @@
|
||||
2004-03-14 Andreas Tobler <a.tobler@schweiz.ch>
|
||||
|
||||
* gnu/java/nio/channels/natFileChannelPosix.cc: Implement
|
||||
munmap_adaptor and msync_adaptor for older POSIX_C_SOURCES specs.
|
||||
(MappedByteBufferImpl::unmapImpl): Use munmap_adaptor.
|
||||
(MappedByteBufferImpl::forceImpl): Use msync_adptor.
|
||||
|
||||
2004-03-12 Michael Koch <konqueror@gmx.de>
|
||||
|
||||
* java/text/DateFormatSymbols.java: Fixed file name in copyright.
|
||||
|
@ -56,6 +56,26 @@ details. */
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
|
||||
// Use overload resolution to find out the argument types.
|
||||
// E.g. Solaris 2.6 uses different argument types for munmap and msync.
|
||||
// This is in case _POSIX_C_SOURCES is smaller than 3.
|
||||
|
||||
template <typename T_implPtr, typename T_implLen>
|
||||
static inline int
|
||||
munmap_adaptor(int (*munmap)(T_implPtr caddr, T_implLen sizet),
|
||||
void* caddr, size_t sizet)
|
||||
{
|
||||
return munmap ((T_implPtr) caddr, (T_implLen) sizet);
|
||||
}
|
||||
|
||||
template <typename T_implPtr, typename T_implLen, typename T_msync>
|
||||
static inline int
|
||||
msync_adaptor(int (*msync)(T_implPtr caddr, T_implLen sizet, T_msync msynct),
|
||||
void* caddr, size_t sizet, int msynct)
|
||||
{
|
||||
return msync ((T_implPtr) caddr, (T_implLen) sizet, (T_msync) msynct);
|
||||
}
|
||||
#endif
|
||||
|
||||
using gnu::gcj::RawData;
|
||||
@ -498,7 +518,7 @@ void
|
||||
MappedByteBufferImpl::unmapImpl ()
|
||||
{
|
||||
#if defined(HAVE_MMAP)
|
||||
munmap((void*) implPtr, implLen);
|
||||
munmap_adaptor(munmap, implPtr, implLen);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -517,6 +537,6 @@ void
|
||||
MappedByteBufferImpl::forceImpl ()
|
||||
{
|
||||
#if defined(HAVE_MMAP)
|
||||
::msync((void*) implPtr, implLen, MS_SYNC);
|
||||
::msync_adaptor(msync, implPtr, implLen, MS_SYNC);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user