3d.sh revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1989-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# David Korn <dgk@research.att.com> #
# Eduardo Krell <ekrell@adexus.cl> #
# #
########################################################################
# NOTE: retain this comment
dir=$_ # NOTE: this line must appear before any commands
command=3d
esac
USAGE=$'
[-?
@(#)$Id: 3d (AT&T Labs Research) 2006-10-01 $
]
[+NAME?3d - execute a command with nDFS filesystem services enabled]
[+DESCRIPTION?\b3d\b executes a dynamically linked \acommand\a
with \an\a\bDFS\b filesystem services enabled. It intercepts pathname
system calls and applies the \an\a\bDFS\b operations specified
by the \bVPATH\b environment variable, the command line mounts,
and the \bvpath\b command. If \acommand\a is omitted then an
interactive \bsh\b(1) is started. All processes executed by \acommand\a
also have \an\a\bDFS\b enabled.]
[+?The main \b3d\b service is \aviewpathing\a. A \aviewpath\a mounts one
directory tree on top of another. Files in the top level
(directory tree) obscure files in the lower level. Lower level files
have copy-on-write semantics to the top level. i.e., files in the lower
level are readonly; if a lower level file is modified it is first
copied to the top level before modification. Viewpath mounted
directories can be chained. All levels but the top in a chain are
readonly. The traditional \bVPATH=\b\ad1:d2:d3\a viewpathing is
specified by the two \b3d\b mounts "\ad1 d2\a" and "\ad2 d3\a".]
[+?The following service mounts are initialized by default:]{
in the current process.]
\aservice\a on the local host. The stream supports file
descriptor exchange.]
connection to \aservice\a on \ahost\a. \binetd\b(8) services
are named either by \binet.\b\aservice\a or by port number.]
connection to \aservice\a on \ahost\a. \binetd\b(8) services
are named either by \binet.\b\aservice\a or by port number.]
}
[c:command?Ignored; allows \b3d\b to be invoked like \bsh\b(1).]
[d:debug?Set the debug trace level to \alevel\a. Higher levels produce more
output.]#[level]
[l:lite?Disable the default service mounts.]
[m:mount?Mount the path \atop\a onto the path \abottom\a. If \abottom\a is a
directory then the directory \atop\a is viewpathed on top of \abottom\a.
Otherwise \abottom\a must match a \b3d\b \bfs\b path of the form
\b/#\b\aspecial\a.]:["top bottom"]
[n!:exec?Execute \acommand\a. \b--noexec\b shows how \acommand\a would be
invoked but does not execute.]
[o:output?\b--trace\b and \b--debug\b output is written to \afile\a instead
of the standard error.]:[file]
[s:shell?Sets the \bsh\b(1) executable path to \afile\a.]:[file:=ksh]
[t:trace?If \aid\a is \b1\b then intercepted system calls for all child
processes will be traced. If \aid\a is greater than \b1\b then
intercepted system calls for the current process and all
children will be traced.]#[id]
[v:version?Use \b3d\b version \amajor.minor\a instead of the latest
version.]:[major.minor]
[x:?Passed to the \b3d\b \bsh\b(1).]
[+FS PATHS?\b3d\b \bfs\b paths of the form \b/#\b\aspecial\a[\b/\b...]]
control the semantics of \b3d\b and allow services to be attached to
the file namespace. Unsupported \bfs\b paths are silently ignored. The
supported \bfs\b paths are:]{
[+/#fd? ]
[+/#fs/\aname\a[/\aoption\a/...]]? ]
[+/#map? ]
[+/#null? ]
[+/#option? ]{
[+2d? ]
[+3d? ]
[+boundary? ]
[+call=\avalue\a? ]
[+count=\avalue\a? ]
[+debug=\alevel\a? ]
[+dump=\b[\avalue\a]]? ]{
[+call=\avalue\a? ]
[+file=\avalue\a? ]
[+fs=\avalue\a? ]
[+map=\avalue\a? ]
[+mount=\avalue\a? ]
[+safe=\avalue\a? ]
[+state=\avalue\a? ]
[+view=\avalue\a? ]
}
[+file=\avalue\a? ]
[+fork? ]
[+init? ]
[+license=\apath\a? ]
[+mount=\avalue\a? ]
[+table=\avalue\a? ]
[+test=\abitmask\a? ]
[+timeout=\avalue\a? ]
[+timestamp? ]
[+trace=\avalue\a? ]
[+version=1? ]
}
[+/#pwd? ]
[+/#safe? ]
[+/#view? ]
}
[+DETAILS?\an\a\bDFS\b semantics are applied by intercepting system calls with
a dll that is preloaded at process startup before \amain\a() is called.
The interception mechanism may involve the environment on some systems;
in those cases commands like \benv\b(1) that clear the enviroment
before execution may defeat the \b3d\b intercepts. The intercepted
implementation system call names may differ from those listed in
section 2 of the manual; \bstat\b(2) is especially vulnerbale to
mangling.]
[+?\b3d\b ignores calls not present in a particular host system. In addition,
\b3d\b only works on dynamically linked executables that have neither
set-uid nor set-gid permissions. It may not have the intended effect
on programs written in a language or linked with a language runtime
that hides or mangles system call library symbols, or that
directly emit system call instruction sequences rather than using
the corresponding library functions, or that dynamically link
libraries outside of the scope of the \b3d\b intercepts.]
[+?Multi-process client-server applications may misbehave if the \b3d\b
environment between the related processes is not kept in sync.]
[ command [ arg ... ] ]
[+ENVIRONMENT?\b3d\b is implemented by four components: the \b3d\b script,
located on \b$PATH\b; the \b3d\b dll (shared library), located either
depending on local compilation system conventions; and the \b2d\b
\bsh\b(1) alias and \b_2d\b \bsh\b(1) function that allow commands
to be run with \an\a\bDFS\b semantics disabled. Systems like
versions of the \b3d\b dll. In all cases the \b3d\b script handles
the dll search.]
[+EXAMPLES?]{
[+\b$ 3d]
[+\b$ VPATH=$INSTALLROOT::$PACKAGEROOT 3d]
[+\b$ 3d ls -l]
[+\b$ 2d ls -l]
}
[+SEE ALSO?\benv\b(1), \bie\b(1), \bsh\b(1), \btrace\b(1), \bwarp\b(1),
\bstat\b(2)]
'
;;
*) ARGV0=""
USAGE='clnxd:m:o:s:t:v:[ command [ arg ... ] ]'
;;
esac
*/3d) ;;
*) case $0 in
*/*) dir=$0
;;
;;
esac
esac
esac
abi=
then d=${dir%-*}
d=${d%?}
do t=${a#*:}
a=${a%:*}
if test -d $d$a
fi
done
fi
;;
esac
full="/dev/fdp/local/nam/user /#fs/nam/name/unique /dev/fdp /#nam /dev/tcp /#nam /dev/udp /#nam /dev/fd /#fd"
mount="- -"
show=
'}
IFS=:
o=
do case $a in
""|-) ;;
*) case $o in
""|-) ;;
esac
;;
esac
o=$a
done
;;
esac
c) cflag=1; break ;;
l) full= ;;
n) show="print -u2 --" ;;
esac
;;
*) exit 2 ;;
esac
done
set x "$@"
shift $OPTIND
1) set -- -c "$@" ;;
esac
esac
esac
/*) ;;
d=${d##*,}
d=${d%%:*}
else d=lib
p=lib
s='.s[lo]'
fi
do case $x in
*/${p}3d${s}*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*|*/${p}3d$*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*${s})
;;
*) version=$x
break
;;
esac
done
;;
esac
exp=
if test -f "$version"
then if test -d $dir/3d
fi
esac
esac
?*:-:$dir/*)
v=${version#$dir/}
do d=${a%:*}
a=${a#*:}
done
;;
*) v=${version%.*}
s=${version##*.}
if test -f ${v}-n32.$s
then exp="$exp _RLD64_LIST=$version:DEFAULT _RLDN32_LIST=$version-n32.$s:DEFAULT _RLD_LIST=${v}-o32.$s:DEFAULT"
elif test -f ${v}-64.$s -o -f ${v}-o32.$s
then exp="$exp _RLD64_LIST=$version-64.$s:DEFAULT _RLDN32_LIST=$version:DEFAULT _RLD_LIST=${v}-o32.$s:DEFAULT"
fi
fi
;;
esac
export $exp
*) unset __ ;;
esac
unset VPATH
"*") ;;
*) exit 1 ;;
esac
fi
;;
esac
export SHELL
esac
-*) ;;
*:0:*|*:*:?*)
;;
case $t in
*) shell= ;;
esac
;;
esac
esac
;;
esac