8245619: Remove unused methods in UnixNativeDispatcher

Reviewed-by: alanb
This commit is contained in:
Claes Redestad 2020-05-22 12:10:55 +02:00
parent 113c48f5da
commit de37507b8e
2 changed files with 0 additions and 101 deletions

View file

@ -97,27 +97,6 @@ class UnixNativeDispatcher {
}
private static native void close0(int fd);
/**
* FILE* fopen(const char *filename, const char* mode);
*/
static long fopen(UnixPath filename, String mode) throws UnixException {
NativeBuffer pathBuffer = copyToNativeBuffer(filename);
NativeBuffer modeBuffer = NativeBuffers.asNativeBuffer(Util.toBytes(mode));
try {
return fopen0(pathBuffer.address(), modeBuffer.address());
} finally {
modeBuffer.release();
pathBuffer.release();
}
}
private static native long fopen0(long pathAddress, long modeAddress)
throws UnixException;
/**
* fclose(FILE* stream)
*/
static native void fclose(long stream) throws UnixException;
/**
* void rewind(FILE* stream);
*/
@ -579,25 +558,6 @@ class UnixNativeDispatcher {
private static native void statvfs0(long pathAddress, UnixFileStoreAttributes attrs)
throws UnixException;
/**
* long int pathconf(const char *path, int name);
*/
static long pathconf(UnixPath path, int name) throws UnixException {
NativeBuffer buffer = copyToNativeBuffer(path);
try {
return pathconf0(buffer.address(), name);
} finally {
buffer.release();
}
}
private static native long pathconf0(long pathAddress, int name)
throws UnixException;
/**
* long fpathconf(int fildes, int name);
*/
static native long fpathconf(int filedes, int name) throws UnixException;
/**
* char* strerror(int errnum)
*/

View file

@ -361,40 +361,6 @@ Java_sun_nio_fs_UnixNativeDispatcher_dup(JNIEnv* env, jclass this, jint fd) {
return (jint)res;
}
JNIEXPORT jlong JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_fopen0(JNIEnv* env, jclass this,
jlong pathAddress, jlong modeAddress)
{
FILE* fp = NULL;
const char* path = (const char*)jlong_to_ptr(pathAddress);
const char* mode = (const char*)jlong_to_ptr(modeAddress);
do {
fp = fopen(path, mode);
} while (fp == NULL && errno == EINTR);
if (fp == NULL) {
throwUnixException(env, errno);
}
return ptr_to_jlong(fp);
}
JNIEXPORT void JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_fclose(JNIEnv* env, jclass this, jlong stream)
{
FILE* fp = jlong_to_ptr(stream);
/* NOTE: fclose() wrapper is only used with read-only streams.
* If it ever is used with write streams, it might be better to add
* RESTARTABLE(fflush(fp)) before closing, to make sure the stream
* is completely written even if fclose() failed.
*/
if (fclose(fp) == EOF && errno != EINTR) {
throwUnixException(env, errno);
}
}
JNIEXPORT void JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_rewind(JNIEnv* env, jclass this, jlong stream)
{
@ -1076,33 +1042,6 @@ Java_sun_nio_fs_UnixNativeDispatcher_statvfs0(JNIEnv* env, jclass this,
}
}
JNIEXPORT jlong JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_pathconf0(JNIEnv* env, jclass this,
jlong pathAddress, jint name)
{
long err;
const char* path = (const char*)jlong_to_ptr(pathAddress);
err = pathconf(path, (int)name);
if (err == -1) {
throwUnixException(env, errno);
}
return (jlong)err;
}
JNIEXPORT jlong JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_fpathconf(JNIEnv* env, jclass this,
jint fd, jint name)
{
long err;
err = fpathconf((int)fd, (int)name);
if (err == -1) {
throwUnixException(env, errno);
}
return (jlong)err;
}
JNIEXPORT void JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_mknod0(JNIEnv* env, jclass this,
jlong pathAddress, jint mode, jlong dev)