pgsql: Add a crude facility for dealing with relative pointers.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add a crude facility for dealing with relative pointers.
Date: 2016-12-02 16:37:08
Message-ID: E1cCqpg-0007ge-Rf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a crude facility for dealing with relative pointers.

C doesn't have any sort of built-in understanding of a pointer
relative to some arbitrary base address, but dynamic shared memory
segments can be mapped at different addresses in different processes,
so any sort of shared data structure stored within a dynamic shared
memory segment can't use absolute pointers. We could use something
like Size to represent a relative pointer, but then the compiler
provides no type-checking. Use stupid macro tricks to get some
type-checking.

Patch originally by me. Concept suggested by Andres Freund. Recently
resubmitted as part of Thomas Munro's work on dynamic shared memory
allocation.

Discussion: 20131205144434(dot)GG12398(at)alap2(dot)anarazel(dot)de
Discussion: CAEepm=1z5WLuNoJ80PaCvz6EtG9dN0j-KuHcHtU6QEfcPP5-qA(at)mail(dot)gmail(dot)com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/fbc1c12a94a638cf4f577fef158175e22ab824a3

Modified Files
--------------
src/include/utils/relptr.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-12-02 17:15:59 pgsql: Management of free memory pages.
Previous Message Robert Haas 2016-12-02 14:51:49 Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013