Changeset 406 for trunk/openjdk/jdk/src/solaris/native
- Timestamp:
- Dec 21, 2012, 10:37:13 AM (13 years ago)
- Location:
- trunk/openjdk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/openjdk
- Property svn:mergeinfo changed
/branches/vendor/oracle/openjdk6/b27 (added) merged: 405 /branches/vendor/oracle/openjdk6/current merged: 404
- Property svn:mergeinfo changed
-
trunk/openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
r278 r406 1 1 /* 2 * Copyright (c) 1998, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 311 311 JNIEXPORT jboolean JNICALL 312 312 Java_java_io_UnixFileSystem_createFileExclusively(JNIEnv *env, jclass cls, 313 jstring pathname) 313 jstring pathname, 314 jboolean restrictive) 314 315 { 315 316 jboolean rv = JNI_FALSE; … … 320 321 fd = JVM_EEXIST; /* The root directory always exists */ 321 322 } else { 322 fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666); 323 jint mode = (restrictive == JNI_TRUE) ? 0600 : 0666; 324 fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, mode); 323 325 } 324 326 if (fd < 0) { -
trunk/openjdk/jdk/src/solaris/native/java/net/net_util_md.c
r278 r406 1 1 /* 2 * Copyright (c) 1997, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 65 65 66 66 /* 67 * EXCLBIND socket options only on Solaris 8 & 9.67 * EXCLBIND socket options only on Solaris 68 68 */ 69 69 #if defined(__solaris__) && !defined(TCP_EXCLBIND) … … 78 78 static int tcp_max_buf; 79 79 static int udp_max_buf; 80 static int useExclBind = 0; 80 81 81 82 /* … … 646 647 647 648 #endif 649 650 void parseExclusiveBindProperty(JNIEnv *env) { 651 #ifdef __solaris__ 652 jstring s, flagSet; 653 jclass iCls; 654 jmethodID mid; 655 656 s = (*env)->NewStringUTF(env, "sun.net.useExclusiveBind"); 657 CHECK_NULL(s); 658 iCls = (*env)->FindClass(env, "java/lang/System"); 659 CHECK_NULL(iCls); 660 mid = (*env)->GetStaticMethodID(env, iCls, "getProperty", 661 "(Ljava/lang/String;)Ljava/lang/String;"); 662 CHECK_NULL(mid); 663 flagSet = (*env)->CallStaticObjectMethod(env, iCls, mid, s); 664 if (flagSet != NULL) { 665 useExclBind = 1; 666 } 667 #endif 668 } 648 669 649 670 /* In the case of an IPv4 Inetaddress this method will return an … … 1223 1244 * caught. 1224 1245 * 1225 * On Solaris 8/9with IPv6 enabled we must use an exclusive1226 * bind to guarantee da unique port number across the IPv4 and1246 * On Solaris with IPv6 enabled we must use an exclusive 1247 * bind to guarantee a unique port number across the IPv4 and 1227 1248 * IPv6 port spaces. 1228 1249 * … … 1254 1275 #if defined(__solaris__) && defined(AF_INET6) 1255 1276 /* 1256 * Solaris 8/9 have seperate IPv4 and IPv6 port spaces so we1277 * Solaris has separate IPv4 and IPv6 port spaces so we 1257 1278 * use an exclusive bind when SO_REUSEADDR is not used to 1258 1279 * give the illusion of a unified port space. 1259 * This also avoid problems with IPv6 sockets connecting1280 * This also avoids problems with IPv6 sockets connecting 1260 1281 * to IPv4 mapped addresses whereby the socket conversion 1261 1282 * results in a late bind that fails because the … … 1266 1287 1267 1288 len = sizeof(arg); 1268 if ( getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&arg,1269 &len) == 0) {1270 if ( arg == 0) {1289 if (useExclBind || getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, 1290 (char *)&arg, &len) == 0) { 1291 if (useExclBind || arg == 0) { 1271 1292 /* 1272 * SO_REUSEADDR is disabled so enable TCP_EXCLBIND or 1293 * SO_REUSEADDR is disabled or sun.net.useExclusiveBind 1294 * property is true so enable TCP_EXCLBIND or 1273 1295 * UDP_EXCLBIND 1274 1296 */
Note:
See TracChangeset
for help on using the changeset viewer.