#!/bin/sh # # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # # # This script is invoked by isaexec-governed executable wrappers from within # s10-branded zones. It circumvents the native isaexec so that native wrappers # will function correctly. # # All native executables must be run using the native linker. # By default, the kernel loads the linker at /lib/ld.so.1, which # in an s10 zone is the s10 linker. Hence when we run the native # executable below, we explicitly specify /.SUNWnative/lib/ld.so.1 as our 32- # bit linker and /.SUNWnative/lib/64/ld.so.1 as our 64-bit linker. # For convience we define "n" to be the native path prefix. # The initial s10_native argument is used as a way to tell the brand # emulation that it needs to set up the process to run as an unbranded # process. # # If this script gets setup with a mode that makes it suid, then things won't # work because the script will be running with the incorrect name. # n=/.SUNWnative npath=$__S10_BRAND_NATIVE_PATH bname=`/usr/bin/basename $0` dname=`/usr/bin/dirname $0` echo $dname | /usr/bin/grep "^/" >/dev/null || dname=`/bin/pwd`/$dname dname=`(cd $dname 2>/dev/null && /bin/pwd 2>/dev/null)` arch64=/ if [ -n "$npath" ]; then ename=$n$npath/$bname else ename=$n$dname/$bname fi LC_ALL=C /usr/bin/file $ename | /usr/bin/grep "64-bit" \ >/dev/null && arch64=/64/ # This wrapper is running in the S10 zone so there is no L10N for the # following error msg. if [ ! -f $ename ]; then echo "Error: \"$dname/$bname\" is not installed in the global zone" exit 1 fi # # These variables are used by the s10_npreload library to determine the # process name to set for the target binary. # __S10_BRAND_ARG0="$0" __S10_BRAND_EXECNAME="$dname/$bname" export __S10_BRAND_ARG0 export __S10_BRAND_EXECNAME exec $n/usr/lib/brand/solaris10/s10_native \ $n/lib${arch64}ld.so.1 \ -e LD_NOENVIRON=1 \ -e LD_NOCONFIG=1 \ -e LD_PRELOAD_32=$n/usr/lib/s10_npreload.so.1 \ -e LD_PRELOAD_64=$n/usr/lib/64/s10_npreload.so.1 \ -e LD_AUDIT_32=$n/usr/lib/s10_nlibchroot.so.1 \ -e LD_AUDIT_64=$n/usr/lib/64/s10_nlibchroot.so.1 \ $ename "$@"