[daip] total incomprehension of TVDEVS.SH
Vincent McIntyre
Vince.McIntyre at atnf.CSIRO.AU
Sun Jul 15 20:05:29 EDT 2001
Dear AIPS
I'm trying to understand the purpose of the NEWUNIXSOCK variable in
the aips startup, and how it interacts with USEUNIXSOCK.
I understand the need for USEUNIXSOCK=YES, and I can see how turning on
NEWUNIXSOCK creates a new TV for every aips session.
I have a server machine with multiple users displaying to different client
machines. some run tv servers on their local machine, but some cannot.
So USEUNIXSOCK=NO + NEWUNIXSOCK=NO isn't the right solution.
I tried out USEUNIXSOCK=YES + NEWUNIXSOCK=YES but that creates a new tv for
every aips session - ie when one starts/exits/reenters aips, a new tv appears
rather than the old one being reused. Not quite right either.
But when I start up with USEUNIXSOCK=YES + NEWUNIXSOCK=NO, I seem to get
collisions between the various TVSERVn and XASn; ie the startup script fails
to do the obvious thing of finding a free number for a tvserv.
This is related to the somewhat crufty-looking code that messes with the $tvn
variable and overrides the first guess at TVDEV, TVLOK etc.
As far as I can tell it doesn't really override things, because it never
updates TVN.
Here's an example for a small network with three hosts (ie TVSERVS is 3).
I've included the 'sh -x START_AIPS' output, with comments.
The relevant TVSERVS.SH code is excerpted below.
TVD= #TVD=""
+ [ = ] #if [ "$TVD" = "" ] ; then
+ [ = YES ] # [ "$DEBUG" = "YES" ]
i=1
+ [ -s /local/AIPS99/STARTING_TV_NUMBER ]
+ [ 1 -lt 36 ] #why is the maximum 36?
+ EHEX 1
ei=1
+ ls /tmp/XAS.1.warrum /tmp/LOK.1.warrum /tmp/TKS.1.warrum /tmp/MSS.1.warrum
+ head -1
OTH=/tmp/LOK.1.warrum
+ [ /tmp/LOK.1.warrum = ] #ok, we found one socket. is number 2 free?
+ expr 1 + 1
i=2
+ [ 2 -lt 36 ]
+ EHEX 2
ei=2
+ ls /tmp/XAS.2.* /tmp/LOK.2.* /tmp/TKS.2.* /tmp/MSS.2.*
+ head -1
OTH=
+ [ = ] #yup, it's free
TVN=2
+ [ = YES ] #[ "$DEBUG" "YES" ]
+ break
+ REHEX 2
+ [ 2 -eq 0 ]
+ REHEX 2
tvn=2 # this is the weird bit
+ expr 2 + 3 #
tvn=5 #
+ EHEX 5 #
tvhex=5 #
tvhex=05 #
TVDEV=TVDEV05
TKDEV=TKDEV05
TTDEV=TTDEV05
TVLOK=TVLOK05
+ eval TVDEV05=/tmp/XAS.2.warrum
TVDEV05=/tmp/XAS.2.warrum
+ eval TTDEV05=/tmp/MSS.2.warrum
TTDEV05=/tmp/MSS.2.warrum
+ eval TKDEV05=/tmp/TKS.2.warrum
TKDEV05=/tmp/TKS.2.warrum
+ eval TVLOK05=/tmp/LOK.2.warrum
TVLOK05=/tmp/LOK.2.warrum
+ eval export TVDEV05 TTDEV05 TKDEV05 TVLOK05
+ export TVDEV05 TTDEV05 TKDEV05 TVLOK05
The thing I don't understand is the business of the tvn variable,
particularly adding $AIPSTVS to it and defining TVDEV$tvhex.
The latter seems never to be reused later on in TVDEVS.SH, nor in START_AIPS,
nor START_TVSERVERS. In UNIXSERVERS it is only tested that
[ "$TVDEV" != "TVDEV00" ]
here is the code.
TVDEVS.SH, about line 290
case $TVALT in
...
*)
if [ "$USEUNIXSOCK" = YES ] ; then
...
TVN=0
TVD=""
if [ "$UNIXTVN" != "0" ] ; then
...
elif [ "$NEWUNIXSOCK" != YES ] ; then
...
else
TVD=""
fi
if [ "$TVD" = "" ] ; then
# Find first free slot for socket.
i=1
if [ -s $AIPS_ROOT/STARTING_TV_NUMBER ] ; then
...
fi
while [ $i -lt 36 ] ; do
ei=`EHEX $i`
OTH=`ls $TMPDIR/XAS.${ei}.* \
$TMPDIR/LOK.${ei}.* \
$TMPDIR/TKS.${ei}.* \
$TMPDIR/MSS.${ei}.* 2>/dev/null | head -1`
if [ "$OTH" = "" ] ; then
TVN=$ei
[ "$DEBUG" = YES ] && ei1 "first free slot is $TVN"
break
fi
i=`expr $i + 1`
done
#2001-07-03 VJM this is a bug for > 9 tvs; compares HEX to DEC
#if [ $TVN -eq 0 ] ; then
if [ `REHEX $TVN` -eq 0 ] ; then
ei1 "No free socket slots left!"
exit 1
fi
else
[ "$DEBUG" = YES ] && ei1 "found existing $TVD socket"
TVN=$TVD
fi
tvn=`REHEX $TVN`
tvn=`expr $tvn + $AIPSTVS`
tvhex=`EHEX $tvn`
case $tvhex in
[0-9A-Z]) tvhex="0$tvhex";;
esac
TVDEV=TVDEV$tvhex
TKDEV=TKDEV$tvhex
TTDEV=TTDEV$tvhex
TVLOK=TVLOK$tvhex
eval "$TVDEV=$TMPDIR/XAS.$TVN.$TVDISP"
eval "$TTDEV=$TMPDIR/MSS.$TVN.$TVDISP"
eval "$TKDEV=$TMPDIR/TKS.$TVN.$TVDISP"
eval "$TVLOK=$TMPDIR/LOK.$TVN.$TVDISP"
eval "export $TVDEV $TTDEV $TKDEV $TVLOK"
Any illumination would be much appreciated.
Vincent McIntyre vmcintyr at atnf.csiro.au
Australia Telescope National Facility, CSIRO voice:+61-2-9372-4643
PO Box 76, Epping, NSW 1710, AUSTRALIA fax:+61-2-9372-4442
More information about the Daip
mailing list