#!/bin/bash
#
# This script will start or stop an Xvfb display.
# Note: This workflow only runs on Linux due to Xvfb supporting Linux only.
#
# Arguments taken:
# start - start an Xvfb display
# stop - kill the Xvfb display associated with this session
#
#
# Global vars
#
XVFB_DISP=
XVFB_DISP_FILE=/tmp/X.xvfb-display.txt
XVFB_LOG_FILE=/tmp/X.setup-log.txt
AUTH_FILE=/tmp/X.xvfb-auth.txt
randomIndex=0
DBUS_EXISTS=0
[ -n "$XSCT_FAST_TRAP" ] && trap 'trap - SIGTERM && kill -0 $$ && kill -- -$$' SIGINT SIGTERM SIGUSR2
#
# Cleanup a Xvfb display
# Used when a signal is trapped
# Background: A kill by SIGUSR2 will cause Xvfb to leave the /tmp/.X$DISPLAY-lock file
#
cleanupXvfb() {
LOG=/tmp/X.xvfb-cleanup_$USER.txt
if [ -f $XVFB_DISP_FILE ] ; then
XVFBDISPLAY=`cat $XVFB_DISP_FILE`
else
echo "Error: xvfb-display.txt not found, exiting."
exit 1
fi
XVFB_LOCK=/tmp/.X$XVFBDISPLAY-lock
XVFB_LOCK_UNIX=/tmp/.X11-unix/X$XVFBDISPLAY
#
# Only run if there is a lockfile present since Xvfb will be killed by LSF
#
if [ -f $XVFB_LOCK ] ; then
rm -f $LOG
touch $LOG
echo `date` "Cleaning up Xvfb processes and files due to SIGUSR2" >> $LOG
#
# Try to kill Xvfb gracefully if it has not already been killed
#
XVFB_PID=`ps -ef -u $USER | grep Xvfb | grep ":$XVFBDISPLAY " | grep -v grep | awk '{print $2}'`
if [ x$XVFB_PID != x ] ; then
echo "kill $XVFB_PID" >> $LOG
kill $XVFB_PID >> $LOG
fi
#
# This is what we really want to cleanup
#
echo "rm -f $XVFB_LOCK" >> $LOG
rm -f $XVFB_LOCK >> $LOG
echo "rm -f $XVFB_LOCK_UNIX" >> $LOG
rm -f $XVFB_LOCK_UNIX >> $LOG
fi
if [ "$DBUS_EXISTS" = "1" ]; then
# Clean up dbus-daemon and dbus-launch
DBUS_DAEMON_PID=`sed -e 's,.*DBUS_SESSION_BUS_PID=,,g' -e 's,\;.*,,g' $DBUS_INFO_FILE`
#echo "Killing dbus daemon pid $DBUS_DAEMON_PID"
ps $DBUS_DAEMON_PID > /dev/null
if [ "$?" == "0" ] ; then
kill $DBUS_DAEMON_PID
fi
DBUS_LAUNCH_PID=`cat $DBUS_PID_FILE`
#echo "Killing dbus launch pid $DBUS_LAUNCH_PID"
ps $DBUS_LAUNCH_PID > /dev/null
# Dbus is getting cleaned automatically, as it was started as session.
#if [ "$?" == "0" ] ; then
#kill $DBUS_LAUNCH_PID
#fi
rm -Rf $DBUS_INFO_FILE
rm -Rf $DBUS_PID_FILE
fi
rm -Rf $XVFB_LOG_FILE
rm -Rf $AUTH_FILE
rm -Rf $XVFB_DISP_FILE
rm -Rf $LOG
}
#
# Find a X display to use
#
startXvfb() {
attempts=0
attempts_max=40
rm -f $AUTH_FILE
rm -f $XVFB_DISP_FILE
#
# This is required to give access to X sessions from the localhost only
#
echo localhost > $AUTH_FILE
XVFB=`which Xvfb`
#
# Select a random display to start the Xvfb display on.
#
while [ $attempts -le $attempts_max ]; do
i=$[100 + $[ RANDOM % 100 ]]
if [ -S /tmp/.X11-unix/X$i -o -f /tmp/.X$i-lock ] ; then
sleep 0.25
let attempts++
else
XVFB_DISP=$i
if [ ! -x $XVFB ]; then
echo "ERROR: Xvfb is not available on the system"
exit 1
fi
#
# Attempt to create the xvfb display
#
$XVFB +extension RANDR -extension GLX :$XVFB_DISP -screen 0 1900x1025x16 -nolisten inet6 -fp unix/:7100,built-ins,/usr/share/vnc/fonts/ -auth $AUTH_FILE > $XVFB_LOG_FILE 2>&1 &
#
# Sleep 5 seconds, there can be a delay between the command being
# fired off and the display becoming active due to system load
# and other factors
#
sleep 5
#
# Test if the display used is already in use, if so try another.
#
grep 'Server is already active for display' $XVFB_LOG_FILE > /dev/null 2>&1
if [ $? -eq 0 ] ; then
let attempts++
continue
fi
grep 'server already running' $XVFB_LOG_FILE > /dev/null 2>&1
if [ $? -eq 0 ] ; then
let attempts++
continue
fi
#
# Test if there was an error creating the display
#
grep 'Fatal server error' $XVFB_LOG_FILE > /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "Error starting Xvfb, please review $XVFB_LOG_FILE."
echo "Exiting."
exit 1
fi
break
fi
if [ $attempts -ge $attempts_max ] ; then
echo "Error in setting up Xvfb, exhausted available display range and no valid displays were available."
echo "Exiting."
exit 1
fi
done
echo $XVFB_DISP > $XVFB_DISP_FILE
#
# Wait to catch a SIGUSR2 so we can cleanup cleanly
#
[ -z "$XSCT_FAST_TRAP" ] && trap "{ cleanupXvfb; exit 1; }" SIGINT SIGTERM SIGUSR2
wait
}
#
# Kill the active Xvfb display, display info is contained in the cwd
#
stopXvfb() {
XVFBDISPLAY=`cat $XVFB_DISP_FILE`
XVFBPID=`ps -ef -u $USER | grep Xvfb | egrep ":$XVFBDISPLAY |:$XVFBDISPLAY$" | awk '{print $2}'`
if [ "x$XVFBPID" != x ] ; then
#echo " killing the xvfb process $XVFBPID"
kill -9 $XVFBPID > $XVFB_LOG_FILE 2>&1
# Clean up dbus-daemon and dbus-launch
if [ "$DBUS_EXISTS" = "1" ]; then
DBUS_DAEMON_PID=`sed -e 's,.*DBUS_SESSION_BUS_PID=,,g' -e 's,\;.*,,g' $DBUS_INFO_FILE`
#echo "Killing dbus daemon pid $DBUS_DAEMON_PID"
kill $DBUS_DAEMON_PID
DBUS_LAUNCH_PID=`cat $DBUS_PID_FILE`
#echo "Killing dbus pid $DBUS_LAUNCH_PID"
kill $DBUS_LAUNCH_PID
rm -Rf $DBUS_INFO_FILE
rm -Rf $DBUS_PID_FILE
fi
rm -Rf $XVFB_LOG_FILE
rm -Rf $AUTH_FILE
rm -Rf $XVFB_DISP_FILE
fi
}
#
# Main
#
if [ ! -z "$1" -o "$1" = "start" -o "$1" = "stop" ] ; then
if [[ $RDI_PLATFORM = *lnx* ]] ; then
randomIndex=$2
XVFB_DISP_FILE=/tmp/X.xvfb-display_$randomIndex.txt
XVFB_LOG_FILE=/tmp/X.setup-log_$randomIndex.txt
AUTH_FILE=/tmp/X.xvfb-auth_$randomIndex.txt
DBUS_INFO_FILE=/tmp/dbus-info_$randomIndex.txt
DBUS_PID_FILE=/tmp/dbus-launch-pid_$randomIndex.txt
DBUS_LAUNCH=`which dbus-launch`
if [ $? -ne 0 ]; then
DBUS_EXISTS=0
else
DBUS_EXISTS=1
fi
if [ "$1" = start ] ; then
startXvfb
fi
if [ "$1" = stop ] ; then
stopXvfb
fi
else
echo "Error: Xvfb is only supported on Linux"
exit 1
fi
else
echo "Usage: $0 [start|stop]"
echo "Start or stop an Xvfb session with a random display"
exit 1
fi
exit 0
没有合适的资源?快使用搜索试试~ 我知道了~
Xilinx Vitis运行报错:2022.2 Vitis: ERROR : Can't read "map":
共94个文件
tcl:72个
so:4个
bif:3个
需积分: 5 33 下载量 70 浏览量
2023-09-17
13:20:11
上传
评论
收藏 777KB ZIP 举报
温馨提示
Xilinx Vitis运行报错 2022.2 Vitis: ERROR : Can't read "map": no such variable when trying to launch application on my target
资源推荐
资源详情
资源评论
收起资源包目录
patch.zip (94个子文件)
patch
xsdb
hsi
pkgIndex.tcl 2KB
hsihelp.tcl 16KB
hsiutils.tcl 137KB
hsi.tcl 4KB
scw
cmdlist 6KB
scwutil.tcl 7KB
scw.tcl 99KB
pkgIndex.tcl 229B
xsdb
streamreader.tcl 6KB
cmdlist 936B
xsdbserver.tcl 8KB
tfile.tcl 22KB
gprof.tcl 13KB
elf.tcl 11KB
svf.tcl 58KB
mbtrace.tcl 55KB
jtag_uart_terminal.tcl 3KB
device.tcl 24KB
mbtrace_dis.tcl 66KB
xsdb_tcfinterp.tcl 42KB
sdk.tcl 87KB
jtag_sequence.tcl 6KB
stapl.tcl 12KB
pkgIndex.tcl 2KB
pkgIndex2.tcl 2KB
mbprofiler.tcl 28KB
bitfile.tcl 11KB
profiler.tcl 4KB
streamsock.tcl 7KB
jtag.tcl 47KB
xsdb.tcl 368KB
yaml.tcl 38KB
huddle.tcl 17KB
gdbremote.tcl 6KB
xsdb-server.tcl 6KB
tcf
pkgIndex.tcl 1KB
tcf.tcl 6KB
xsct
setup-xvfb.sh 7KB
hsi
pkgIndex.tcl 2KB
hsihelp.tcl 16KB
hsiutils.tcl 163KB
hsi.tcl 4KB
data
bif-templates
zcu102
linux.bif 326B
vck190
linux.bif 224B
zc706
linux.bif 128B
mpsoc-yocto
sds-lib
files
libsds_lib_dbg.so 232KB
libsds_lib.so 95KB
sds-lib.bb 496B
scw
project_template 451B
cproject_template 735B
old_project_template 288B
generic.readme 179B
hello.cxx 137B
xenhosted
lscripts
lscript.ld 6KB
armcc
standard
scatter.scat 533B
cardano-yocto
cardano-lib
files
readme 0B
cardano-lib.bb 417B
zynq-yocto
sds-lib
files
libsds_lib_dbg.so 227KB
libsds_lib.so 91KB
sds-lib.bb 496B
scw
scwutil.tcl 7KB
scw.tcl 173KB
pkgIndex.tcl 229B
xsdb
streamreader.tcl 6KB
cmdlist 3KB
xsdbserver.tcl 8KB
tfile.tcl 22KB
gprof.tcl 13KB
elf.tcl 11KB
svf.tcl 58KB
mbtrace.tcl 55KB
jtag_uart_terminal.tcl 3KB
device.tcl 24KB
mbtrace_dis.tcl 66KB
xsdb_tcfinterp.tcl 42KB
sdk.tcl 87KB
jtag_sequence.tcl 6KB
stapl.tcl 12KB
pkgIndex.tcl 2KB
pkgIndex2.tcl 2KB
mbprofiler.tcl 28KB
bitfile.tcl 11KB
profiler.tcl 4KB
streamsock.tcl 7KB
jtag.tcl 47KB
xsdb.tcl 368KB
yaml.tcl 38KB
huddle.tcl 17KB
gdbremote.tcl 6KB
xsdb-server.tcl 6KB
sdtgen
pkgIndex.tcl 628B
sdtgen.tcl 2KB
tcf
pkgIndex.tcl 1KB
tcf.tcl 6KB
共 94 条
- 1
资源评论
平平无奇哈斯特
- 粉丝: 85
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功