This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PATCH for java.nio FileChannel and MappedByteBuffer
- From: andreas tobler <toa at pop dot agri dot ch>
- To: Per Bothner <per at bothner dot com>
- Cc: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 07 Mar 2004 16:47:24 +0100
- Subject: Re: PATCH for java.nio FileChannel and MappedByteBuffer
- References: <4035662B.9070301@bothner.com>
Per Bothner wrote:
Index: gnu/java/nio/channels/natFileChannelImpl.cc
===================================================================
RCS file: gnu/java/nio/channels/natFileChannelImpl.cc
diff -N gnu/java/nio/channels/natFileChannelImpl.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/java/nio/channels/natFileChannelImpl.cc 20 Feb 2004 01:27:57 -0000
+void
+MappedByteBufferImpl::unmapImpl ()
+{
+#if defined(__JV_POSIX_H__) && defined(HAVE_MMAP)
+ munmap((void*) implPtr, implLen);
munmap and the msync below cause here some headache.
+void
+MappedByteBufferImpl::forceImpl ()
+{
+#if defined(__JV_POSIX_H__) && defined(HAVE_MMAP)
+ ::msync((void*) implPtr, implLen, MS_SYNC);
+#elif defined(__JV_WIN32_H__)
+#endif
+}
+
Here means on solaris 2.6. Both are defined under solaris 2.6 even with
two versions, but, only the one for POSIX_C_SOURCE > 2 works.
Here the two functions are defined as:
extern int munmap(void *, size_t);
extern int msync(void *, size_t, int);
For the else case where POSIX_C_SOURCE is < 2:
extern int munmap(caddr_t, size_t);
extern int msync(caddr_t, size_t, int);
Where caddr_t is defined as char*.
This the case where I struggle.
What shall we do, define POSIX_C_SOURCE being bigger than 2 in this file?
or do an ifdef for this case?
Andreas