Subject: Re: LD_PRELOAD in linux emulation
To: =?UTF-8?Q?C=C3=A9sar_Catri=C3=A1n?= C. <ccatrian@eml.cc>
From: Urban Boquist <urban@boquist.net>
List: netbsd-help
Date: 08/30/2005 15:55:06
César> does someone know about the right way to preload a library in
César> the linux layer emulation? I want to preload libaudiooss to
César> linux firefox, but it doesn't work.

I haven't tried with oss or firefox but as far as I know LD_PRELOAD
should Just Work with the linux emulation (given that your binary is
dynamically linked of course).

For a long time I have used the small program below to run the
since-long expired beta of Linux Framemaker, and it still works... ;-)

Best regards,

        -- Urban

-----------------------------------------------
/*
 * Time-travel back to year 2000.
 *
 * This allows expired Linux FrameMaker beta to run again (on NetBSD).
 *
 * Compile:
 *     gcc -c lib2000.c
 *     gcc -shared -o lib2000.so lib2000.o
 *
 * Install:
 *     cp lib2000.so $FMHOME/bin/linuxm.glibc2.i386/
 *
 * Add to $FMHOME/bin/scripts/.maker_wrapper, just before the final "exec":
 *
 *     LD_PRELOAD=$FM_HOME/bin/linuxm.glibc2.i386/lib2000.so; export LD_PRELOAD
 *
 * Add to $FMHOME/bin/.wrapper, at the top:
 *     ulimit -n 1024 # avoid fm_flb crash
 *
 * Note: the machine must also run "rpcbind -i".
 */

#include <time.h>

struct tm *
localtime(const time_t *clock)
{
	struct tm *tm = gmtime(clock);
	tm->tm_year = 100;
	return(tm);
}

-----------------------------------------------