This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH for java.nio FileChannel and MappedByteBuffer


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








Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]