#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
#
# Determine whether this version of the ksh being
# executed has a bug where the limit of background
# processes of 25.
#
function check_bg_procs_limit_num
{
chmod 777 /var/tmp/exitsZero.ksh
cat <<EOF > /var/tmp/testbackgprocs.ksh
#!/usr/bin/ksh
#
# exitsZero.ksh is a one line script
# that exit with status of "0"
#
PIDS=""
typeset -i i=1
while [ \$i -le 50 ]
do
/var/tmp/exitsZero.ksh &
PIDS="\$PIDS \$!"
(( i = i + 1 ))
done
\sleep 1
for pid in \$PIDS
do
\wait \$pid
(( \$? == 127 )) && exit 1
done
exit 0
EOF
if [[ $? -eq 1 ]]; then
#
# Current ksh being executed has a limit
# of 25 background processes.
#
return 1
else
return 0
fi
}
function init_setup
{
typeset disklist=$1
if ! is_global_zone ; then
fi
}
function wait_pid
{
do
done
}
#
# Generate given number files in a
# directory of zfs file system
# $1 - the directory holds the generated files
# $2 - number of to-be-generated files
#
function generate_files
{
typeset -i count
typeset -i proc_num=0
count=1
else
fi
do
proc_num=0
PIDS=""
fi
done
}
#
# Move given number files from one directory to
# another directory in parallel
# $1 - source directory
# $2 - target directory
#
function mv_files
{
}
#
# Count the files number after moving, and
# compare it with the original number
# $1 - directory that to be operated
# $2 - original files number
#
function count_files
{
typeset -i file_num
wc -l`
"$2 is not equal to that of the source "\
"directory $1"
}
#
# Running the 'mv' test
# $1 - old directory
# $2 - new directory
#
function mv_test
{
typeset old=$1
typeset new=$2
typeset -i num=0
for num in $MVNUMFILES $inc_num
do
done
typeset dir=$(get_device_dir $DISKS)
return 0
}