< prev index next >

src/java.base/unix/native/libjava/UnixFileSystem_md.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -21,10 +21,11 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
+#include <unistd.h>
 #include <assert.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 #ifdef MACOSX

@@ -36,10 +37,14 @@
 #include <string.h>
 #include <stdlib.h>
 #include <dlfcn.h>
 #include <limits.h>
 
+#if defined(__solaris__) && !defined(NAME_MAX)
+#define NAME_MAX MAXNAMLEN
+#endif
+
 #include "jni.h"
 #include "jni_util.h"
 #include "jlong.h"
 #include "jvm.h"
 #include "io_util.h"

@@ -485,5 +490,16 @@
         }
 #endif
     } END_PLATFORM_STRING(env, path);
     return rv;
 }
+
+JNIEXPORT jlong JNICALL
+Java_java_io_UnixFileSystem_getNameMax0(JNIEnv *env, jobject this,
+                                        jstring pathname)
+{
+    jlong length = -1;
+    WITH_PLATFORM_STRING(env, pathname, path) {
+        length = (jlong)pathconf(path, _PC_NAME_MAX);
+    } END_PLATFORM_STRING(env, path);
+    return length != -1 ? length : (jlong)NAME_MAX;
+}
< prev index next >