|
|
Shared libraries (XLs) can also be used for resolving external function calls
from a DSO. One method is to relink the Apache program with an XL list of the
required shared libraries and to copy each shared library into MPE/iX
namespace. Another method is to link a DSO using dependent libraries the
(altxl option to the LinkEditor) and to copy each shared library
into MPE/iX namespace. Either way, all shared libraries must reside in an
MPE/iX group and account and must follow the MPE/iX naming conventions. This
is necessary because Apache is a Privileged Mode (PM) program.
Symbolic links from the MPE/iX namespace to a shared library in the HFS
namespace will not satisfy the PM capability constraint. Each shared library
must actually reside in MPE/iX namespace. The following commands show how to
copy the libm and libc system shared libraries into MPE/iX
namespace and how to use the altprog option to LinkEditor to
add these shared libraries to the Apache program file:
:HELLO MGR.APACHE
:XEQ SH.HPBIN.SYS -L
shell/iX> cp /lib/libm.sl XLM
shell/iX> cp /lib/libc.sl XLC
shell/iX> callci linkedit
LinkEd> buildxl xl=./hw/mod_hw.so;limit=10
LinkEd> addxl from=./hw/mod_hw.o,./hw/hw.o;to=./hw/mod_hw.so;merge;share
LinkEd> altprog ./HTTPD;cap=ia,ba,ph,pm;xl=XLM,XLC
When using system libraries as XLs, such as libm.sl and libc.sl,
remember to recopy these libraries after a system update in order
to get their new versions. To verify that HTTPD has been successfully
relinked with your NMXL(s):
LinkEd> listprog ./HTTPD
PROGRAM : ./HTTPD
XL LIST : XLM XLC
CAPABILITIES : BA, IA, PM, PH
Here is a POSIX script that shows how libraries might be set up
programmatically. It uses hw.o as the archive library, hw.a:
shell/iX> cat xlbuild.sh
#!/bin/sh
#
# set the location of Apache
AP=/APACHE/PUB
#
# create the old libraries
rm -f ${AP}/XLC ${AP}/XLM ${AP}/XLHW
#
# copy the latest versions
cp /lib/libc.sl ${AP}/XLC
cp /lib/libm.sl ${AP}/XLM
#
#create a custom XL
callci "xeq linkedit.pub.sys 'buildxl xl=${AP}/XLHW'"
callci "xeq linkedit.pub.sys 'addxl from=${AP}/hw/hw.a;\
to=${AP}/XLHW;share;merge'"
#
# remove fragmentation and minimize the internal tables
callci "xeq linkedit.pub.sys 'cleanxl ${AP}/XLHW;compact'"
#
# Relink Apache with the new NMXL list
callci "xeq linkedit.pub.sys 'altprog ${AP}/HTTPD;cap=ia,ba,ph,pm\
;xl=\"${AP}/XLHW,${AP}/XLM,${AP}/XLC\"'"
|