PostgreSQL Source Code git master
|
#include "postgres.h"
#include <fcntl.h>
#include <semaphore.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include "miscadmin.h"
#include "storage/ipc.h"
#include "storage/pg_sema.h"
#include "storage/shmem.h"
Go to the source code of this file.
Data Structures | |
union | SemTPadded |
struct | PGSemaphoreData |
Macros | |
#define | PG_SEM_REF(x) (&(x)->sem_padded.pgsem) |
#define | IPCProtection (0600) /* access/modify by user only */ |
Typedefs | |
typedef union SemTPadded | SemTPadded |
typedef struct PGSemaphoreData | PGSemaphoreData |
Functions | |
static void | ReleaseSemaphores (int status, Datum arg) |
static void | PosixSemaphoreCreate (sem_t *sem) |
static void | PosixSemaphoreKill (sem_t *sem) |
Size | PGSemaphoreShmemSize (int maxSemas) |
void | PGReserveSemaphores (int maxSemas) |
PGSemaphore | PGSemaphoreCreate (void) |
void | PGSemaphoreReset (PGSemaphore sema) |
void | PGSemaphoreLock (PGSemaphore sema) |
void | PGSemaphoreUnlock (PGSemaphore sema) |
bool | PGSemaphoreTryLock (PGSemaphore sema) |
Variables | |
static PGSemaphore | sharedSemas |
static int | numSems |
static int | maxSems |
static int | nextSemKey |
Definition at line 59 of file posix_sema.c.
Definition at line 57 of file posix_sema.c.
typedef struct PGSemaphoreData PGSemaphoreData |
typedef union SemTPadded SemTPadded |
void PGReserveSemaphores | ( | int | maxSemas | ) |
Definition at line 196 of file posix_sema.c.
References DataDir, elog, ereport, errcode_for_file_access(), errmsg(), FATAL, malloc, maxSems, nextSemKey, numSems, on_shmem_exit(), PANIC, PGSemaphoreShmemSize(), ReleaseSemaphores(), sharedSemas, ShmemAllocUnlocked(), stat::st_ino, and stat.
Referenced by CreateSharedMemoryAndSemaphores().
PGSemaphore PGSemaphoreCreate | ( | void | ) |
Definition at line 261 of file posix_sema.c.
References Assert, elog, IsUnderPostmaster, maxSems, numSems, PANIC, PG_SEM_REF, PosixSemaphoreCreate(), and sharedSemas.
Referenced by InitProcGlobal().
void PGSemaphoreLock | ( | PGSemaphore | sema | ) |
Definition at line 319 of file posix_sema.c.
References EINTR, elog, FATAL, and PG_SEM_REF.
Referenced by LWLockAcquire(), LWLockAcquireOrWait(), LWLockDequeueSelf(), LWLockWaitForVar(), ProcArrayGroupClearXid(), and TransactionGroupUpdateXidStatus().
void PGSemaphoreReset | ( | PGSemaphore | sema | ) |
Definition at line 294 of file posix_sema.c.
References EAGAIN, EINTR, elog, FATAL, and PG_SEM_REF.
Referenced by InitAuxiliaryProcess(), and InitProcess().
Size PGSemaphoreShmemSize | ( | int | maxSemas | ) |
Definition at line 165 of file posix_sema.c.
References mul_size().
Referenced by CalculateShmemSize(), and PGReserveSemaphores().
bool PGSemaphoreTryLock | ( | PGSemaphore | sema | ) |
Definition at line 364 of file posix_sema.c.
References EAGAIN, EINTR, elog, FATAL, and PG_SEM_REF.
void PGSemaphoreUnlock | ( | PGSemaphore | sema | ) |
Definition at line 339 of file posix_sema.c.
References EINTR, elog, FATAL, and PG_SEM_REF.
Referenced by LWLockAcquire(), LWLockAcquireOrWait(), LWLockDequeueSelf(), LWLockUpdateVar(), LWLockWaitForVar(), LWLockWakeup(), ProcArrayGroupClearXid(), and TransactionGroupUpdateXidStatus().
|
static |
Definition at line 135 of file posix_sema.c.
References elog, FATAL, and sem.
Referenced by PGSemaphoreCreate().
|
static |
Definition at line 147 of file posix_sema.c.
References elog, LOG, and sem.
Referenced by ReleaseSemaphores().
|
static |
Definition at line 239 of file posix_sema.c.
References free, i, numSems, PG_SEM_REF, PosixSemaphoreKill(), and sharedSemas.
Referenced by PGReserveSemaphores().
|
static |
Definition at line 67 of file posix_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().
|
static |
Definition at line 68 of file posix_sema.c.
Referenced by PGReserveSemaphores().
|
static |
Definition at line 66 of file posix_sema.c.
Referenced by InternalIpcSemaphoreCreate(), IpcSemaphoreCreate(), PGReserveSemaphores(), PGSemaphoreCreate(), and ReleaseSemaphores().
|
static |
Definition at line 64 of file posix_sema.c.
Referenced by PGReserveSemaphores(), PGSemaphoreCreate(), and ReleaseSemaphores().