--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java Wed Apr 13 15:05:50 2016 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java Wed Apr 13 14:29:25 2016 +0100
@@ -296,6 +296,23 @@
private static native void stat0(long pathAddress, UnixFileAttributes attrs)
throws UnixException;
+
+ /**
+ * stat(const char* path, struct stat* buf)
+ *
+ * @return st_mode (file type and mode) or 0 if an error occurs.
+ */
+ static int stat(UnixPath path) {
+ NativeBuffer buffer = copyToNativeBuffer(path);
+ try {
+ return stat1(buffer.address());
+ } finally {
+ buffer.release();
+ }
+ }
+ private static native int stat1(long pathAddress);
+
+
/**
* lstat(const char* path, struct stat* buf)
*/
@@ -459,6 +476,22 @@
private static native void access0(long pathAddress, int amode) throws UnixException;
/**
+ * access(constant char* path, F_OK)
+ *
+ * @return true if the file exists, false otherwise
+ */
+ static boolean exists(UnixPath path) {
+ NativeBuffer buffer = copyToNativeBuffer(path);
+ try {
+ return exists0(buffer.address());
+ } finally {
+ buffer.release();
+ }
+ }
+ private static native boolean exists0(long pathAddress);
+
+
+ /**
* struct passwd *getpwuid(uid_t uid);
*
* @return passwd->pw_name