3261N/A# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A# This code is free software; you can redistribute it and/or modify it 0N/A# under the terms of the GNU General Public License version 2 only, as 0N/A# published by the Free Software Foundation. 0N/A# This code is distributed in the hope that it will be useful, but WITHOUT 0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A# version 2 for more details (a copy is included in the LICENSE file that 0N/A# accompanied this code). 0N/A# You should have received a copy of the GNU General Public License version 0N/A# 2 along with this work; if not, write to the Free Software Foundation, 0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A # Verify directory context variables are set 0N/A if [ "${TESTJAVA}" = "" ] ; then 0N/A echo "TESTJAVA not set. Test cannot execute. Failed." 0N/A if [ "${TESTCLASSES}" = "" ] ; then 0N/A if [ "${TESTSRC}" = "" ] ; then 0N/A echo "Test bypassed: jvmstat feature not supported on ${OS}" 0N/A # verify that the tmp directory supports persistent ACLs, which 0N/A # are required for jvmstat to enable its shared memory feature. 0N/A # NOTE: FAT type files systems do not support ACLs, but NTFS files 0N/A if [ "${TMPDRIVE}" = "" ] ; then 0N/A echo "Could not get temp directory drive letter" 0N/A echo "temp file system characteristics:" 0N/A echo "Test bypassed: jvmstat feature disabled because the temp" 0N/A echo "directory doesn't support persistent ACLs" 0N/A echo "Could not get temp directory file system features" 0N/A echo "Unexpected return code from grep - $?" 0N/A# function to kill the process with the given process id 0N/A if [ "${kill_pid}" = "" ] 0N/A echo "kill_proc(): null pid: ignored" 0N/A echo "kill_proc(): invalid pid: ${kill_pid}: ignored" 0N/A [1234567].* | 8.[12345].*) 0N/A # when starting processes in the background, mks creates an 0N/A # intervening between the parent process and the background 0N/A # process. The pid acquired for background process as acquired 0N/A # by the $! shell variable is actually the pid of the invervening 0N/A # shell and not that of the background process. Sending a specific 0N/A # signal to the intervening shell will only effects the intervening 0N/A # shell and not the background process, thus leaving the background 0N/A # process running. The following code assumes that the pid passed 0N/A # into this function as ${kill_pid}, was acquired by $!. Therefore, 0N/A # in order to kill the background process, we must first find the 0N/A # children of ${kill_pid} (should be only one child) and kill them. 0N/A echo "killing children of ${kill_pid}: ${children}" 0N/A # in mks 8.6 and later, the pid returned in $! is now the pid 0N/A # of the background process and not that of the intervening shell. 0N/A { pids = pids $1 " " } 0N/A # verify that the process exists and we can signal it 0N/A echo "Could not signal >${kpid}<" 0N/A echo "process information :" 0N/A # check if it's still hanging around 0N/A # it's still lingering, now it it hard 0N/A echo "Could not kill ${kpid}!" 0N/A echo "Error sending term signal to ${kpid}!" 2500N/A# check to see if a port is free 2500N/A if [ "${inuse}" = "" ] ; then 2500N/A# Get a free port, where port+1 is also free, return 0 when giving up