mirror of
https://github.com/postgres/postgres.git
synced 2026-04-24 07:40:59 -04:00
Use ShmemInitStruct to allocate shmem for semaphores
This makes them visible in pg_shmem_allocations Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi
This commit is contained in:
parent
378a216187
commit
40c41dc773
2 changed files with 7 additions and 2 deletions
|
|
@ -196,6 +196,7 @@ void
|
|||
PGReserveSemaphores(int maxSemas)
|
||||
{
|
||||
struct stat statbuf;
|
||||
bool found;
|
||||
|
||||
/*
|
||||
* We use the data directory's inode number to seed the search for free
|
||||
|
|
@ -216,7 +217,8 @@ PGReserveSemaphores(int maxSemas)
|
|||
#else
|
||||
|
||||
sharedSemas = (PGSemaphore)
|
||||
ShmemAlloc(PGSemaphoreShmemSize(maxSemas));
|
||||
ShmemInitStruct("Semaphores", PGSemaphoreShmemSize(maxSemas), &found);
|
||||
Assert(!found);
|
||||
#endif
|
||||
|
||||
numSems = 0;
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ void
|
|||
PGReserveSemaphores(int maxSemas)
|
||||
{
|
||||
struct stat statbuf;
|
||||
bool found;
|
||||
|
||||
/*
|
||||
* We use the data directory's inode number to seed the search for free
|
||||
|
|
@ -344,7 +345,9 @@ PGReserveSemaphores(int maxSemas)
|
|||
DataDir)));
|
||||
|
||||
sharedSemas = (PGSemaphore)
|
||||
ShmemAlloc(PGSemaphoreShmemSize(maxSemas));
|
||||
ShmemInitStruct("Semaphores", PGSemaphoreShmemSize(maxSemas), &found);
|
||||
Assert(!found);
|
||||
|
||||
numSharedSemas = 0;
|
||||
maxSharedSemas = maxSemas;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue