Re: [Summary] Meta-data/filesystem-encapsulation



On Mon, 17 Aug 1998, Keith Wright wrote:

> I've been lurking here for a while, following the discussion.
> (Or sometimes reading but not following.)
> So here's my stupid question: What is LD_PRELOAD?

LD_PRELOAD is an environment variable you can set.  The libraries you
specify in this path will be loaded before any other libraries, even
before the standard C library.  It's not used often; I only know of one
program that makes use of it (it's called VFS or something).  What this
program does is put a library in front of the standard C library so that
programs can, for instance, call opendir()/readdir() on .tar.gz files.
This allows every program you ever run to be able to peruse .tar.gz files
as directories without having to have explicitly been compiled to do so.

The way I would see this used in GNOME is that a "attribute-aware" library 
would be specified in LD_PRELOAD so that standard shell commands such as
"mv" or "cp" could also, automatically, handle attribute data.  (Actually,
*any* program would become GNOME-data-sensitive, whether it was compiled
to be so or not.  It won't be GNOME compliant becuase the interface won't
change (ie, fopen() still takes two args, fwrite() still take four) but it
won't disassociate the data either -- for example, imagine you compile a
program called "foo" and give it some object properties stored in the file
"foo.bar" - then, by using LD_PRELOAD, if you do a "mv foo bar", "foo.bar"
automagically becomes "bar.bar".  This is most important if the object
data can be a hidden struct in the inode because without it, filesystem
corruption (not *really* corruption, but data blocks would not be freed
but not be referenced) could occur.)

"man ld" will probably tell you more than you ever wanted to know if you
can find access to a Sun.  The Linux manpage doesn't say anything about it
and I've never figured out how to use "info"... 

Interesting thing I didn't realize: LD_PRELOAD is ignored for s{g,u}id. 
Does make perfect sense though. 

--
Christopher Curtis               - http://www.ee.fit.edu/users/ccurtis
                                 - System Administrator, Programmer
Melbourne, Florida  USA          - http://www.lp.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]