Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f8bcb8

Browse files
committed
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, andredirection_done are not in fact NON_EXEC_STATIC. ShmemLock once was,but was then needed elsewhere. ShmemBackendArray was static insidepostmaster.c before launch_backend.c was created. redirection_donewas never static.This patch moves the declaration of ShmemLock and redirection_done toa header file.ShmemBackendArray gets a NON_EXEC_STATIC. This doesn't make adifference, since it only exists if EXEC_BACKEND anyway, but it makesit 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
1 parent881455e commit8f8bcb8

File tree

7 files changed

+5
-10
lines changed

7 files changed

+5
-10
lines changed

‎src/backend/postmaster/launch_backend.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,13 +672,11 @@ SubPostmasterMain(int argc, char *argv[])
672672
* The following need to be available to the save/restore_backend_variables
673673
* functions. They are marked NON_EXEC_STATIC in their home modules.
674674
*/
675-
externslock_t*ShmemLock;
676675
externslock_t*ProcStructLock;
677676
externPGPROC*AuxiliaryProcs;
678677
externPMSignalData*PMSignalState;
679678
externpg_time_tfirst_syslogger_file_time;
680679
externstructbkend*ShmemBackendArray;
681-
externboolredirection_done;
682680

683681
#ifndefWIN32
684682
#definewrite_inheritable_socket(dest,src,childpid) ((*(dest) = (src)), true)

‎src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ typedef struct bkend
179179
staticdlist_headBackendList=DLIST_STATIC_INIT(BackendList);
180180

181181
#ifdefEXEC_BACKEND
182-
Backend*ShmemBackendArray;
182+
NON_EXEC_STATICBackend*ShmemBackendArray;
183183
#endif
184184

185185
BackgroundWorker*MyBgworkerEntry=NULL;

‎src/backend/postmaster/syslogger.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ char *Log_filename = NULL;
7575
boolLog_truncate_on_rotation= false;
7676
intLog_file_mode=S_IRUSR |S_IWUSR;
7777

78-
externboolredirection_done;
79-
8078
/*
8179
* Private state
8280
*/

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@
9191
#endif
9292

9393

94-
/* We use the ShmemLock spinlock to protect LWLockCounter */
95-
externslock_t*ShmemLock;
96-
9794
#defineLW_FLAG_HAS_WAITERS((uint32) 1 << 30)
9895
#defineLW_FLAG_RELEASE_OK((uint32) 1 << 29)
9996
#defineLW_FLAG_LOCKED((uint32) 1 << 28)
@@ -609,6 +606,7 @@ LWLockNewTrancheId(void)
609606
int*LWLockCounter;
610607

611608
LWLockCounter= (int*) ((char*)MainLWLockArray-sizeof(int));
609+
/* We use the ShmemLock spinlock to protect LWLockCounter */
612610
SpinLockAcquire(ShmemLock);
613611
result= (*LWLockCounter)++;
614612
SpinLockRelease(ShmemLock);

‎src/backend/utils/error/elog.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ ErrorContextCallback *error_context_stack = NULL;
9595

9696
sigjmp_buf*PG_exception_stack=NULL;
9797

98-
externboolredirection_done;
99-
10098
/*
10199
* Hook for intercepting messages before they are sent to the server log.
102100
* Note that the hook will not get called for messages that are suppressed

‎src/include/postmaster/postmaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ extern PGDLLIMPORT int postmaster_alive_fds[2];
5252

5353
externPGDLLIMPORTconstchar*progname;
5454

55+
externPGDLLIMPORTboolredirection_done;
5556
externPGDLLIMPORTboolLoadedSSL;
5657

5758
externvoidPostmasterMain(intargc,char*argv[])pg_attribute_noreturn();

‎src/include/storage/shmem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
#ifndefSHMEM_H
2222
#defineSHMEM_H
2323

24+
#include"storage/spin.h"
2425
#include"utils/hsearch.h"
2526

2627

2728
/* shmem.c */
29+
externPGDLLIMPORTslock_t*ShmemLock;
2830
externvoidInitShmemAccess(void*seghdr);
2931
externvoidInitShmemAllocation(void);
3032
externvoid*ShmemAlloc(Sizesize);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp