jdk/src/windows/native/java/io/io_util_md.h
changeset 16476 e269be167fae
parent 14342 8435a30053c1
equal deleted inserted replaced
16475:6b45edea3370 16476:e269be167fae
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2013, 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
    25 
    25 
    26 #include "jni.h"
    26 #include "jni.h"
    27 #include "jni_util.h"
    27 #include "jni_util.h"
    28 
    28 
    29 /*
    29 /*
    30  * Prototypes for functions in io_util_md.c called from io_util,
    30  * Macros to use the right data type for file descriptors
       
    31  */
       
    32 #define FD jlong
       
    33 
       
    34 /*
       
    35  * Prototypes for functions in io_util_md.c called from io_util.c,
    31  * FileDescriptor.c, FileInputStream.c, FileOutputStream.c
    36  * FileDescriptor.c, FileInputStream.c, FileOutputStream.c
    32  */
    37  */
    33 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
    38 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
    34 WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
    39 WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
    35 WCHAR* getPrefixed(const WCHAR* path, int pathlen);
    40 WCHAR* getPrefixed(const WCHAR* path, int pathlen);
    36 WCHAR* currentDir(int di);
    41 WCHAR* currentDir(int di);
    37 int currentDirLength(const WCHAR* path, int pathlen);
    42 int currentDirLength(const WCHAR* path, int pathlen);
    38 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
    43 int handleAvailable(FD fd, jlong *pbytes);
    39 int handleAvailable(jlong fd, jlong *pbytes);
    44 int handleSync(FD fd);
    40 JNIEXPORT int handleSync(jlong fd);
    45 int handleSetLength(FD fd, jlong length);
    41 int handleSetLength(jlong fd, jlong length);
    46 JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
    42 JNIEXPORT jint handleRead(jlong fd, void *buf, jint len);
    47 jint handleWrite(FD fd, const void *buf, jint len);
    43 JNIEXPORT jint handleWrite(jlong fd, const void *buf, jint len);
    48 jint handleAppend(FD fd, const void *buf, jint len);
    44 JNIEXPORT jint handleAppend(jlong fd, const void *buf, jint len);
       
    45 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
    49 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
    46 jlong handleLseek(jlong fd, jlong offset, jint whence);
    50 jlong handleLseek(FD fd, jlong offset, jint whence);
    47 
    51 
    48 /*
    52 /*
    49  * Returns an opaque handle to file named by "path".  If an error occurs,
    53  * Returns an opaque handle to file named by "path".  If an error occurs,
    50  * returns -1 and an exception is pending.
    54  * returns -1 and an exception is pending.
    51  */
    55  */
    52 jlong winFileHandleOpen(JNIEnv *env, jstring path, int flags);
    56 FD winFileHandleOpen(JNIEnv *env, jstring path, int flags);
    53 
       
    54 /*
       
    55  * Macros to use the right data type for file descriptors
       
    56  */
       
    57 #define FD jlong
       
    58 
    57 
    59 /*
    58 /*
    60  * Macros to set/get fd from the java.io.FileDescriptor.
    59  * Macros to set/get fd from the java.io.FileDescriptor.
    61  * If GetObjectField returns null, SET_FD will stop and GET_FD
    60  * If GetObjectField returns null, SET_FD will stop and GET_FD
    62  * will simply return -1 to avoid crashing VM.
    61  * will simply return -1 to avoid crashing VM.