< prev index next >

src/os/solaris/vm/attachListener_solaris.cpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/interfaceSupport.hpp"
  27 #include "runtime/os.inline.hpp"
  28 #include "services/attachListener.hpp"
  29 #include "services/dtraceAttacher.hpp"

  30 
  31 #include <door.h>
  32 #include <limits.h>
  33 #include <string.h>
  34 #include <signal.h>
  35 #include <sys/types.h>
  36 #include <sys/socket.h>
  37 #include <sys/stat.h>
  38 
  39 // stropts.h uses STR in stream ioctl defines
  40 #undef STR
  41 #include <stropts.h>
  42 #undef STR
  43 #define STR(a) #a
  44 
  45 // The attach mechanism on Solaris is implemented using the Doors IPC
  46 // mechanism. The first tool to attempt to attach causes the attach
  47 // listener thread to startup. This thread creats a door that is
  48 // associated with a function that enqueues an operation to the attach
  49 // listener. The door is attached to a file in the file system so that


 292     int return_fd = -1;
 293     SolarisAttachOperation* op = NULL;
 294 
 295     // no listener
 296     jint res = 0;
 297     if (!AttachListener::is_initialized()) {
 298       // how did we get here?
 299       debug_only(warning("door_call when not enabled"));
 300       res = (jint)SolarisAttachListener::ATTACH_ERROR_INTERNAL;
 301     }
 302 
 303     // check client credentials
 304     if (res == 0) {
 305       if (check_credentials() != 0) {
 306         res = (jint)SolarisAttachListener::ATTACH_ERROR_DENIED;
 307       }
 308     }
 309 
 310     // if we are stopped at ShowMessageBoxOnError then maybe we can
 311     // load a diagnostic library
 312     if (res == 0 && is_error_reported()) {
 313       if (ShowMessageBoxOnError) {
 314         // TBD - support loading of diagnostic library here
 315       }
 316 
 317       // can't enqueue operation after fatal error
 318       res = (jint)SolarisAttachListener::ATTACH_ERROR_RESOURCE;
 319     }
 320 
 321     // create the operation
 322     if (res == 0) {
 323       int err;
 324       op = create_operation(argp, arg_size, &err);
 325       res = (op == NULL) ? (jint)err : 0;
 326     }
 327 
 328     // create a pair of connected sockets. Store the file descriptor
 329     // for one end in the operation and enqueue the operation. The
 330     // file descriptor for the other end wil be returned to the client.
 331     if (res == 0) {
 332       int s[2];




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/interfaceSupport.hpp"
  27 #include "runtime/os.inline.hpp"
  28 #include "services/attachListener.hpp"
  29 #include "services/dtraceAttacher.hpp"
  30 #include "utilities/vmError.hpp"
  31 
  32 #include <door.h>
  33 #include <limits.h>
  34 #include <string.h>
  35 #include <signal.h>
  36 #include <sys/types.h>
  37 #include <sys/socket.h>
  38 #include <sys/stat.h>
  39 
  40 // stropts.h uses STR in stream ioctl defines
  41 #undef STR
  42 #include <stropts.h>
  43 #undef STR
  44 #define STR(a) #a
  45 
  46 // The attach mechanism on Solaris is implemented using the Doors IPC
  47 // mechanism. The first tool to attempt to attach causes the attach
  48 // listener thread to startup. This thread creats a door that is
  49 // associated with a function that enqueues an operation to the attach
  50 // listener. The door is attached to a file in the file system so that


 293     int return_fd = -1;
 294     SolarisAttachOperation* op = NULL;
 295 
 296     // no listener
 297     jint res = 0;
 298     if (!AttachListener::is_initialized()) {
 299       // how did we get here?
 300       debug_only(warning("door_call when not enabled"));
 301       res = (jint)SolarisAttachListener::ATTACH_ERROR_INTERNAL;
 302     }
 303 
 304     // check client credentials
 305     if (res == 0) {
 306       if (check_credentials() != 0) {
 307         res = (jint)SolarisAttachListener::ATTACH_ERROR_DENIED;
 308       }
 309     }
 310 
 311     // if we are stopped at ShowMessageBoxOnError then maybe we can
 312     // load a diagnostic library
 313     if (res == 0 && VMError::is_error_reported()) {
 314       if (ShowMessageBoxOnError) {
 315         // TBD - support loading of diagnostic library here
 316       }
 317 
 318       // can't enqueue operation after fatal error
 319       res = (jint)SolarisAttachListener::ATTACH_ERROR_RESOURCE;
 320     }
 321 
 322     // create the operation
 323     if (res == 0) {
 324       int err;
 325       op = create_operation(argp, arg_size, &err);
 326       res = (op == NULL) ? (jint)err : 0;
 327     }
 328 
 329     // create a pair of connected sockets. Store the file descriptor
 330     // for one end in the operation and enqueue the operation. The
 331     // file descriptor for the other end wil be returned to the client.
 332     if (res == 0) {
 333       int s[2];


< prev index next >