Re: Re: [PATCHES] A patch for xlog.c

From: Ian Lance Taylor <ian(at)airs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [PATCHES] A patch for xlog.c
Date: 2001-02-26 16:57:08
Message-ID: sibsrpqt5n.fsf@daffy.airs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
file.

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.

Ian

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2001-02-26 17:16:19 Re: ExecOpenScanR: failed to open relation
Previous Message Tom Lane 2001-02-26 16:23:25 Re: Re: [PATCHES] A patch for xlog.c