1 --- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Thu May 28 11:43:30 2020
2 +++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Wed May 20 19:29:11 2020
7 +JNIEXPORT jlong JNICALL
8 +Java_sun_nio_fs_UnixNativeDispatcher_fopen0(JNIEnv* env, jclass this,
9 + jlong pathAddress, jlong modeAddress)
12 + const char* path = (const char*)jlong_to_ptr(pathAddress);
13 + const char* mode = (const char*)jlong_to_ptr(modeAddress);
16 + fp = fopen(path, mode);
17 + } while (fp == NULL && errno == EINTR);
20 + throwUnixException(env, errno);
23 + return ptr_to_jlong(fp);
26 JNIEXPORT void JNICALL
27 +Java_sun_nio_fs_UnixNativeDispatcher_fclose(JNIEnv* env, jclass this, jlong stream)
29 + FILE* fp = jlong_to_ptr(stream);
31 + /* NOTE: fclose() wrapper is only used with read-only streams.
32 + * If it ever is used with write streams, it might be better to add
33 + * RESTARTABLE(fflush(fp)) before closing, to make sure the stream
34 + * is completely written even if fclose() failed.
36 + if (fclose(fp) == EOF && errno != EINTR) {
37 + throwUnixException(env, errno);
41 +JNIEXPORT void JNICALL
42 Java_sun_nio_fs_UnixNativeDispatcher_rewind(JNIEnv* env, jclass this, jlong stream)
44 FILE* fp = jlong_to_ptr(stream);
45 @@ -1222,6 +1256,33 @@
49 +JNIEXPORT jlong JNICALL
50 +Java_sun_nio_fs_UnixNativeDispatcher_pathconf0(JNIEnv* env, jclass this,
51 + jlong pathAddress, jint name)
54 + const char* path = (const char*)jlong_to_ptr(pathAddress);
56 + err = pathconf(path, (int)name);
58 + throwUnixException(env, errno);
63 +JNIEXPORT jlong JNICALL
64 +Java_sun_nio_fs_UnixNativeDispatcher_fpathconf(JNIEnv* env, jclass this,
69 + err = fpathconf((int)fd, (int)name);
71 + throwUnixException(env, errno);
76 JNIEXPORT void JNICALL
77 Java_sun_nio_fs_UnixNativeDispatcher_mknod0(JNIEnv* env, jclass this,
78 jlong pathAddress, jint mode, jlong dev)