8293121: (fs) Refactor UnixFileSystem copying into generic Unix, Linux, and BSD implementations

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2022-09-01 22:21:21 +00:00
parent 032be168b5
commit 0a4d0cee9f
11 changed files with 1051 additions and 854 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <mntent.h>
#include <fcntl.h>
#include "sun_nio_fs_LinuxNativeDispatcher.h"
@ -139,6 +140,13 @@ JNIEXPORT void JNICALL
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent(JNIEnv* env, jclass this, jlong stream)
{
FILE* fp = jlong_to_ptr(stream);
/* FIXME - man page doesn't explain how errors are returned */
// The endmntent() function always returns 1.
endmntent(fp);
}
JNIEXPORT jint JNICALL
Java_sun_nio_fs_LinuxNativeDispatcher_posix_1fadvise(JNIEnv* env, jclass this,
jint fd, jlong offset, jlong len, jint advice)
{
return posix_fadvise64((int)fd, (off64_t)offset, (off64_t)len, (int)advice);
}