Ignore:
Timestamp:
Dec 21, 2012, 10:37:13 AM (13 years ago)
Author:
dmik
Message:

trunk: Merged in openjdk6 b27 from branches/vendor/oracle.

Location:
trunk/openjdk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk

  • trunk/openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c

    r278 r406  
    11/*
    2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    311311JNIEXPORT jboolean JNICALL
    312312Java_java_io_UnixFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
    313                                                   jstring pathname)
     313                                                  jstring pathname,
     314                                                  jboolean restrictive)
    314315{
    315316    jboolean rv = JNI_FALSE;
     
    320321            fd = JVM_EEXIST;    /* The root directory always exists */
    321322        } 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);
    323325        }
    324326        if (fd < 0) {
  • trunk/openjdk/jdk/src/solaris/native/java/net/net_util_md.c

    r278 r406  
    11/*
    2  * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    6565
    6666/*
    67  * EXCLBIND socket options only on Solaris 8 & 9.
     67 * EXCLBIND socket options only on Solaris
    6868 */
    6969#if defined(__solaris__) && !defined(TCP_EXCLBIND)
     
    7878static int tcp_max_buf;
    7979static int udp_max_buf;
     80static int useExclBind = 0;
    8081
    8182/*
     
    646647
    647648#endif
     649
     650void 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}
    648669
    649670/* In the case of an IPv4 Inetaddress this method will return an
     
    12231244 * caught.
    12241245 *
    1225  * On Solaris 8/9 with IPv6 enabled we must use an exclusive
    1226  * bind to guaranteed a unique port number across the IPv4 and
     1246 * On Solaris with IPv6 enabled we must use an exclusive
     1247 * bind to guarantee a unique port number across the IPv4 and
    12271248 * IPv6 port spaces.
    12281249 *
     
    12541275#if defined(__solaris__) && defined(AF_INET6)
    12551276    /*
    1256      * Solaris 8/9 have seperate IPv4 and IPv6 port spaces so we
     1277     * Solaris has separate IPv4 and IPv6 port spaces so we
    12571278     * use an exclusive bind when SO_REUSEADDR is not used to
    12581279     * give the illusion of a unified port space.
    1259      * This also avoid problems with IPv6 sockets connecting
     1280     * This also avoids problems with IPv6 sockets connecting
    12601281     * to IPv4 mapped addresses whereby the socket conversion
    12611282     * results in a late bind that fails because the
     
    12661287
    12671288        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) {
    12711292                /*
    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
    12731295                 * UDP_EXCLBIND
    12741296                 */
Note: See TracChangeset for help on using the changeset viewer.