Solaris 64-bit Developer's Guide

Shell-Script Wrappers

In the case where 32-bit and 64-bit specific versions of applications are required, shell-script wrappers can make the version transparent to the user. This is the case with a number of tools in the Solaris operating environment, where 32-bit and 64-bit versions are needed. A wrapper can use the isalist command to determine the native instruction sets executable on a particular hardware platform, and run the appropriate version of the tool based on this.

This is an example of a native instruction set wrapper:

#! /bin/sh 
CMD=`basename $0`
DIR=`dirname $0`
for isa in `/usr/bin/isalist`; do	
	if [-x ${DIR}/${isa}/${CMD}]; then		
if [-z "${EXEC}"]; then	
		echo 1>&2 "$0: no executable for this architecture"
		exit 1
exec ${EXEC} "${@}"

One problem with this example is that it expects the $0 argument to be a full pathname to its own executable. For this reason, a generic wrapper, isaexec(), has been created to address the problem of 32-bit and 64-bit specific applications. A description of this wrapper follows.

/usr/lib/isaexec Binary File






Note –


isaexec(3c) Interface

Many applications already use startup wrapper programs to set environment variables, clear temporary files, start daemons, and so on. The isaexec(3C) interface in libc(3LIB) allows the same algorithm used in the shell-based wrapper example above to be invoked directly from a custom wrapper program.