src/java.base/windows/native/libnio/ch/FileChannelImpl.c
changeset 57804 9b7b9f16dfd9
parent 54313 440cbcf3b268
equal deleted inserted replaced
57803:23e3ab980622 57804:9b7b9f16dfd9
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    58  * Channel
    58  * Channel
    59  */
    59  */
    60 
    60 
    61 JNIEXPORT jlong JNICALL
    61 JNIEXPORT jlong JNICALL
    62 Java_sun_nio_ch_FileChannelImpl_map0(JNIEnv *env, jobject this,
    62 Java_sun_nio_ch_FileChannelImpl_map0(JNIEnv *env, jobject this,
    63                                jint prot, jlong off, jlong len)
    63                                      jint prot, jlong off, jlong len, jboolean map_sync)
    64 {
    64 {
    65     void *mapAddress = 0;
    65     void *mapAddress = 0;
    66     jint lowOffset = (jint)off;
    66     jint lowOffset = (jint)off;
    67     jint highOffset = (jint)(off >> 32);
    67     jint highOffset = (jint)(off >> 32);
    68     jlong maxSize = off + len;
    68     jlong maxSize = off + len;
    83         fileProtect = PAGE_READWRITE;
    83         fileProtect = PAGE_READWRITE;
    84         mapAccess = FILE_MAP_WRITE;
    84         mapAccess = FILE_MAP_WRITE;
    85     } else if (prot == sun_nio_ch_FileChannelImpl_MAP_PV) {
    85     } else if (prot == sun_nio_ch_FileChannelImpl_MAP_PV) {
    86         fileProtect = PAGE_WRITECOPY;
    86         fileProtect = PAGE_WRITECOPY;
    87         mapAccess = FILE_MAP_COPY;
    87         mapAccess = FILE_MAP_COPY;
       
    88     }
       
    89 
       
    90     if (map_sync) {
       
    91         JNU_ThrowInternalError(env, "should never call map on platform where MAP_SYNC is unimplemented");
       
    92         return IOS_THROWN;
    88     }
    93     }
    89 
    94 
    90     mapping = CreateFileMapping(
    95     mapping = CreateFileMapping(
    91         fileHandle,      /* Handle of file */
    96         fileHandle,      /* Handle of file */
    92         NULL,            /* Not inheritable */
    97         NULL,            /* Not inheritable */