Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> > Since mmap() is how everybody implements shared libraries,
> Now *there's* a sweeping generalization. Documentation of this
> claim, please?
I've seen a lot of shared library implementations (I used to be the
GNU binutils maintainer), and Nathan is approximately correct. Most
ELF systems use a dynamic linker inherited from the original SVR4
implementation, which uses mmap. You can see this by running strace
on an SVR4 system. The *BSD and GNU dynamic linker implementations
are of course independently derived, but they use mmap too.
mmap is the natural way to implement ELF style shared libraries. The
basic operation you have to do is to map the shared library into the
process memory space, and then to process a few relocations. Mapping
the shared library in can be done either using mmap, or using
open/read/close. For a large file, mmap is going to be much faster
than open/read/close, because it doesn't require actually reading the
There are, of course, many non-ELF shared libraries implementations.
SVR3 does not use mmap. SunOS does use mmap (SunOS shared libraries
were taken into SVR4 and the ELF standard). I don't know offhand
about AIX, Digital Unix, or Windows.
mmap is standardized by the most recent version of POSIX.1.
In response to
pgsql-hackers by date
|Next:||From: Jan Wieck||Date: 2001-02-26 17:16:19|
|Subject: Re: ExecOpenScanR: failed to open relation|
|Previous:||From: Tom Lane||Date: 2001-02-26 16:23:25|
|Subject: Re: Re: [PATCHES] A patch for xlog.c |