src/java.base/windows/native/libjava/io_util_md.c
changeset 49440 396ea30afbd5
parent 47289 6439a2eca58b
child 50549 75a03a4cfbca
child 56721 01b558efd286
equal deleted inserted replaced
49439:bf53d82a51e5 49440:396ea30afbd5
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2018, 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
   221         return NULL;
   221         return NULL;
   222     }
   222     }
   223     return pathbuf;
   223     return pathbuf;
   224 }
   224 }
   225 
   225 
   226 FD
   226 JNIEXPORT FD JNICALL
   227 winFileHandleOpen(JNIEnv *env, jstring path, int flags)
   227 winFileHandleOpen(JNIEnv *env, jstring path, int flags)
   228 {
   228 {
   229     const DWORD access =
   229     const DWORD access =
   230         (flags & O_WRONLY) ?  GENERIC_WRITE :
   230         (flags & O_WRONLY) ?  GENERIC_WRITE :
   231         (flags & O_RDWR)   ? (GENERIC_READ | GENERIC_WRITE) :
   231         (flags & O_RDWR)   ? (GENERIC_READ | GENERIC_WRITE) :
   573     if (CloseHandle(h) == 0) { /* Returns zero on failure */
   573     if (CloseHandle(h) == 0) { /* Returns zero on failure */
   574         JNU_ThrowIOExceptionWithLastError(env, "close failed");
   574         JNU_ThrowIOExceptionWithLastError(env, "close failed");
   575     }
   575     }
   576 }
   576 }
   577 
   577 
   578 jlong
   578 JNIEXPORT jlong JNICALL
   579 handleLseek(FD fd, jlong offset, jint whence)
   579 handleLseek(FD fd, jlong offset, jint whence)
   580 {
   580 {
   581     LARGE_INTEGER pos, distance;
   581     LARGE_INTEGER pos, distance;
   582     DWORD lowPos = 0;
   582     DWORD lowPos = 0;
   583     long highPos = 0;
   583     long highPos = 0;