pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve some global variable declarations
Date: Tue, 02 Jul 2024 05:26:50 +0000
Message-ID: <E1sOW2T-003tAe-FX@gemulon.postgresql.org> (raw)

Improve some global variable declarations

We have in launch_backend.c:

    /*
     * The following need to be available to the save/restore_backend_variables
     * functions.  They are marked NON_EXEC_STATIC in their home modules.
     */
    extern slock_t *ShmemLock;
    extern slock_t *ProcStructLock;
    extern PGPROC *AuxiliaryProcs;
    extern PMSignalData *PMSignalState;
    extern pg_time_t first_syslogger_file_time;
    extern struct bkend *ShmemBackendArray;
    extern bool redirection_done;

That comment is not completely true: ShmemLock, ShmemBackendArray, and
redirection_done are not in fact NON_EXEC_STATIC.  ShmemLock once was,
but was then needed elsewhere.  ShmemBackendArray was static inside
postmaster.c before launch_backend.c was created.  redirection_done
was never static.

This patch moves the declaration of ShmemLock and redirection_done to
a header file.

ShmemBackendArray gets a NON_EXEC_STATIC.  This doesn't make a
difference, since it only exists if EXEC_BACKEND anyway, but it makes
it consistent.

After that, the comment is now correct.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8f8bcb88833eecfffbbb0d048ff0b6c33e64f7ce

Modified Files
--------------
src/backend/postmaster/launch_backend.c | 2 --
src/backend/postmaster/postmaster.c     | 2 +-
src/backend/postmaster/syslogger.c      | 2 --
src/backend/storage/lmgr/lwlock.c       | 4 +---
src/backend/utils/error/elog.c          | 2 --
src/include/postmaster/postmaster.h     | 1 +
src/include/storage/shmem.h             | 2 ++
7 files changed, 5 insertions(+), 10 deletions(-)



Message-ID: <E1sOW2T-003tAe-FX@gemulon.postgresql.org>
Permalink:  ../E1sOW2T-003tAe-FX@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sOW2T-003tAe-FX@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve some global variable declarations
  In-Reply-To: <E1sOW2T-003tAe-FX@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox