diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-02-22 01:21:34 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-02-22 01:21:34 +0200 |
commit | 28f3915b73f75bd1b50ba070f56b34241fe53fd1 (patch) | |
tree | 10d305f3f98af6cfae7d683ce9b13c449d8e8796 /src/include/storage/proc.h | |
parent | 4989ce72644b9d636b9b23c7a1719a405e62670b (diff) | |
download | postgresql-28f3915b73f75bd1b50ba070f56b34241fe53fd1.tar.gz postgresql-28f3915b73f75bd1b50ba070f56b34241fe53fd1.zip |
Remove superfluous 'pgprocno' field from PGPROC
It was always just the index of the PGPROC entry from the beginning of
the proc array. Introduce a macro to compute it from the pointer
instead.
Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi
Diffstat (limited to 'src/include/storage/proc.h')
-rw-r--r-- | src/include/storage/proc.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 20d6fa652dc..4453c6df877 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -194,11 +194,6 @@ struct PGPROC int pgxactoff; /* offset into various ProcGlobal->arrays with * data mirrored from this PGPROC */ - int pgprocno; /* Number of this PGPROC in - * ProcGlobal->allProcs array. This is set - * once by InitProcGlobal(). - * ProcGlobal->allProcs[n].pgprocno == n */ - /* These fields are zero while a backend is still starting up: */ BackendId backendId; /* This backend's backend ID (if assigned) */ Oid databaseId; /* OID of database this backend is using */ @@ -307,6 +302,7 @@ struct PGPROC extern PGDLLIMPORT PGPROC *MyProc; +extern PGDLLIMPORT int MyProcNumber; /* same as GetNumberFromPGProc(MyProc) */ /* * There is one ProcGlobal struct for the whole database cluster. @@ -410,8 +406,9 @@ extern PGDLLIMPORT PROC_HDR *ProcGlobal; extern PGDLLIMPORT PGPROC *PreparedXactProcs; -/* Accessor for PGPROC given a pgprocno. */ +/* Accessor for PGPROC given a pgprocno, and vice versa. */ #define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)]) +#define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0]) /* * We set aside some extra PGPROC structures for auxiliary processes, |