You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2008/09/04 14:08:21 UTC

svn commit: r691987 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c

Author: hindessm
Date: Thu Sep  4 05:08:20 2008
New Revision: 691987

URL: http://svn.apache.org/viewvc?rev=691987&view=rev
Log:
Fix for freebsd - which has unsigned char* as third argument to mincore.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c?rev=691987&r1=691986&r2=691987&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c Thu Sep  4 05:08:20 2008
@@ -95,14 +95,20 @@
   	  jboolean result = 0;
   	  IDATA m_addr = (IDATA)addr;
 	  int page_size = getPageSize();
-	  unsigned char* vec = NULL;
+#if defined(FREEBSD)
+#define HY_VEC_T char
+#else
+#define HY_VEC_T unsigned char
+#endif
+	  HY_VEC_T* vec = NULL;
 	  int page_count = 0;
 	  int align_offset = m_addr%page_size;//addr should align with the boundary of a page.
 	  m_addr -= align_offset;
 	  size   += align_offset;
 	  page_count = (size+page_size-1)/page_size;
-	  vec = (unsigned char*) hymem_allocate_memory(page_count*sizeof(char));
-	  if(mincore((void *)m_addr, size , vec)==0) //or else there is error about the mincore and return false;
+	  vec = (HY_VEC_T *) hymem_allocate_memory(page_count*sizeof(char));
+	  if(mincore((void *)m_addr, size, vec)==0) //or else there is error about the mincore and return false;
+#undef HY_VEC_T
 	  {
 	  	  int i;
 		  for(i=0 ;i<page_count;i++)