Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 75313 invoked from network); 1 Sep 2009 07:28:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Sep 2009 07:28:50 -0000 Received: (qmail 72557 invoked by uid 500); 1 Sep 2009 07:28:50 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 72470 invoked by uid 500); 1 Sep 2009 07:28:49 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 72461 invoked by uid 99); 1 Sep 2009 07:28:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 07:28:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 07:28:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8DFD123888EC; Tue, 1 Sep 2009 07:28:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r809862 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/ main/native/os/darwin/ main/native/os/hpux/ main/native/os/linux/ main/native/os/solaris/ main/native/os/win32/ test/org/apache/commons/runtime/ Date: Tue, 01 Sep 2009 07:28:25 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090901072825.8DFD123888EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Tue Sep 1 07:28:24 2009 New Revision: 809862 URL: http://svn.apache.org/viewvc?rev=809862&view=rev Log: Add pagesize alignment const Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java Tue Sep 1 07:28:24 2009 @@ -81,8 +81,9 @@ MAX_PATH = i[6]; ABS_MAX_PATH = i[7]; PAGESIZE = i[8]; + PAGESIZE_ALIGN = i[9]; - if (i[9] == 16) + if (i[10] == 16) STRUCT_ALIGN = 4; else STRUCT_ALIGN = 8; @@ -138,6 +139,12 @@ public static final int PAGESIZE; /** + * The granualarity of the starting address at wich {@code memory} pages + * can be allocated. + */ + public static final int PAGESIZE_ALIGN; + + /** * Size of the {@code structure} alignment. */ public static final int STRUCT_ALIGN; Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c Tue Sep 1 07:28:24 2009 @@ -74,7 +74,8 @@ ia[6] = PATH_MAX; ia[7] = PATH_MAX; ia[8] = (jint)acr_page_size; - ia[9] = (jint)sizeof(struct_align_t); + ia[9] = (jint)acr_page_size; + ia[10] = (jint)sizeof(struct_align_t); (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]); Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c Tue Sep 1 07:28:24 2009 @@ -74,7 +74,8 @@ ia[6] = PATH_MAX; ia[7] = PATH_MAX; ia[8] = (jint)acr_page_size; - ia[9] = (jint)sizeof(struct_align_t); + ia[9] = (jint)acr_page_size; + ia[10] = (jint)sizeof(struct_align_t); (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]); Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c Tue Sep 1 07:28:24 2009 @@ -74,7 +74,8 @@ ia[6] = PATH_MAX; ia[7] = PATH_MAX; ia[8] = (jint)acr_page_size; - ia[9] = (jint)sizeof(struct_align_t); + ia[9] = (jint)acr_page_size; + ia[10] = (jint)sizeof(struct_align_t); (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]); if (acr_native_codepage == -1) { Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c Tue Sep 1 07:28:24 2009 @@ -74,7 +74,8 @@ ia[6] = PATH_MAX; ia[7] = PATH_MAX; ia[8] = (jint)acr_page_size; - ia[9] = (jint)sizeof(struct_align_t); + ia[9] = (jint)acr_page_size; + ia[10] = (jint)sizeof(struct_align_t); (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]); Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c Tue Sep 1 07:28:24 2009 @@ -97,7 +97,8 @@ ia[6] = 248; ia[7] = 32760; ia[8] = (jint)acr_page_size; - ia[9] = (jint)sizeof(struct_align_t); + ia[9] = (jint)acr_osinf->dwAllocationGranularity; + ia[10] = (jint)sizeof(struct_align_t); (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]); Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java?rev=809862&r1=809861&r2=809862&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java (original) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java Tue Sep 1 07:28:24 2009 @@ -85,22 +85,10 @@ } if (pa == null) { try { - pa = map.map(Platform.PAGESIZE, 128); - System.out.println("Map requires Platform.PAGESIZE (" + - Platform.PAGESIZE + ") bytes offset alignment"); - } catch (IOException e) { - // Ignore - } catch (SecurityException x) { - // File is too small - // We should test with some larger file. - pa = map.map(0, 128); - } - } - if (pa == null) { - try { - // Windows requires 64k alignment - pa = map.map(65536, 128); - System.out.println("Map requires 64k offset alignment"); + pa = map.map(Platform.PAGESIZE_ALIGN, 128); + System.out.println("Map requires Platform.PAGESIZE_ALIGN (" + + Platform.PAGESIZE_ALIGN + + ") bytes offset alignment"); } catch (IOException e) { // Ignore } catch (SecurityException x) {