Re: fork/exec patch - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: fork/exec patch
Date
Msg-id 200312160506.hBG563Z21654@candle.pha.pa.us
Whole thread Raw
In response to Re: fork/exec patch  (Neil Conway <neilc@samurai.com>)
List pgsql-patches
Neil Conway wrote:
> + /*
> +  * The following need to be available to the read/write_backend_variables
> +  * functions
> +  */
> + extern XLogRecPtr RedoRecPtr;
> + extern XLogwrtResult LogwrtResult;
> + extern slock_t *ShmemLock;
> + extern slock_t *ShmemIndexLock;
> + extern void *ShmemIndexAlloc;
> + typedef struct LWLock LWLock;
> + extern LWLock *LWLockArray;
> + extern slock_t  *ProcStructLock;
> + extern int    pgStatSock;
>
> I wonder whether it is cleaner to make these properly public, rather
> than using the NON_EXEC_STATIC #ifdef... (I'm not necessarily saying
> it is, I'm just tossing it out there).

This was my idea.  Rather than making statics as globals, they are
global only for exec() builds.  This seemed safest.  They need to be
extern for exec() because we need to reference them in a function that
writes all the postmaster globals to a file.  We could have had a write
function in every C file that needed it and call the write function from
postmaster.c, but that seems like too much bloat.  If we make them
extern in all builds we lose the safety of a static.

Your other comments are good and I will wait for Claudio to respond.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: fork/exec patch
Next
From: Tom Lane
Date:
Subject: Re: fork/exec patch