Question about LD_PRELOAD and /etc/ld.preload

Theodore Ts'o tytso at mit.edu
Sat May 8 06:33:32 EST 2004


I have an LD_PRELOAD shared library that accellerates programs that do
readdir/stat scans by intercepting the opendir() and readdir() calls,
reading all directory entries, sorting them in inode number, and then
returning the directory entries in sorted order.

The pathname to this shared library can be placed in /etc/ld.preload, or
by setting the LD_PRELOAD environment variable.  There's only one
problem.  On 32/64-bit platforms, you need to have a different preload
library depending on whether the executable is 32-bit or 64-bit.

So depending on whether I use LD_PRELOAD=/usr/local/lib/spd_readdir.so
or LD_PRELOAD=/usr/local/lib/spd_readdir.so.64, either /bin/ls (which is
a 32-bit executable) or /bin/ps (which is a 64-bit executable) will work
correctly.

This seems to be a real misfeature.  Is there a 32/64-bit sensitive
environment variable I can use?  What about for /etc/ld.preload?

Many thanks!!

						- Ted


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list