|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <signal.h>#include <unistd.h>#include <sys/file.h>#include <sys/ipc.h>#include <sys/sem.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 | |
| struct | PGSemaphoreData |
| union | semun |
Macros | |
| #define | SEMAS_PER_SET 16 |
| #define | IPCProtection (0600) /* access/modify by user only */ |
| #define | PGSemaMagic 537 /* must be less than SEMVMX */ |
Typedefs | |
| typedef struct PGSemaphoreData | PGSemaphoreData |
| typedef key_t | IpcSemaphoreKey |
| typedef int | IpcSemaphoreId |
Functions | |
| static IpcSemaphoreId | InternalIpcSemaphoreCreate (IpcSemaphoreKey semKey, int numSems, bool retry_ok) |
| static void | IpcSemaphoreInitialize (IpcSemaphoreId semId, int semNum, int value) |
| static void | IpcSemaphoreKill (IpcSemaphoreId semId) |
| static int | IpcSemaphoreGetValue (IpcSemaphoreId semId, int semNum) |
| static pid_t | IpcSemaphoreGetLastPID (IpcSemaphoreId semId, int semNum) |
| static IpcSemaphoreId | IpcSemaphoreCreate (int numSems) |
| static void | ReleaseSemaphores (int status, Datum arg) |
| 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 | numSharedSemas |
| static int | maxSharedSemas |
| static IpcSemaphoreId * | mySemaSets |
| static int | numSemaSets |
| static int | maxSemaSets |
| static IpcSemaphoreKey | nextSemaKey |
| static int | nextSemaNumber |
Definition at line 56 of file sysv_sema.c.
| #define PGSemaMagic 537 /* must be less than SEMVMX */ |
Definition at line 58 of file sysv_sema.c.
| #define SEMAS_PER_SET 16 |
Definition at line 54 of file sysv_sema.c.
| typedef int IpcSemaphoreId |
Definition at line 46 of file sysv_sema.c.
| typedef key_t IpcSemaphoreKey |
Definition at line 45 of file sysv_sema.c.
| typedef struct PGSemaphoreData PGSemaphoreData |
|
static |
Definition at line 97 of file sysv_sema.c.
References EIDRM, ereport, errdetail(), errhint(), errmsg(), FATAL, IPC_CREAT, IPC_EXCL, IPCProtection, and numSems.
Referenced by IpcSemaphoreCreate().
|
static |
Definition at line 223 of file sysv_sema.c.
References InternalIpcSemaphoreCreate(), IPC_RMID, IpcSemaphoreGetLastPID(), IpcSemaphoreGetValue(), IpcSemaphoreInitialize(), kill, nextSemaKey, numSems, PGSemaMagic, PGSemaphoreUnlock(), and semun::val.
Referenced by PGSemaphoreCreate().
|
static |
Definition at line 203 of file sysv_sema.c.
References GETPID, and semun::val.
Referenced by IpcSemaphoreCreate().
|
static |
Definition at line 192 of file sysv_sema.c.
References GETVAL, and semun::val.
Referenced by IpcSemaphoreCreate().
|
static |
Definition at line 157 of file sysv_sema.c.
References ereport, errhint(), errmsg_internal(), FATAL, SETVAL, semun::val, and value.
Referenced by IpcSemaphoreCreate(), PGSemaphoreCreate(), and PGSemaphoreReset().
|
static |
Definition at line 180 of file sysv_sema.c.
References elog, IPC_RMID, LOG, and semun::val.
Referenced by ReleaseSemaphores().
| void PGReserveSemaphores | ( | int | maxSemas | ) |
Definition at line 330 of file sysv_sema.c.
References DataDir, elog, ereport, errcode_for_file_access(), errmsg(), FATAL, malloc, maxSemaSets, maxSharedSemas, mySemaSets, nextSemaKey, nextSemaNumber, numSemaSets, numSharedSemas, on_shmem_exit(), PANIC, PGSemaphoreShmemSize(), ReleaseSemaphores(), SEMAS_PER_SET, sharedSemas, ShmemAlloc(), stat::st_ino, and stat.
| PGSemaphore PGSemaphoreCreate | ( | void | ) |
Definition at line 384 of file sysv_sema.c.
References Assert(), elog, IpcSemaphoreCreate(), IpcSemaphoreInitialize(), IsUnderPostmaster, maxSemaSets, maxSharedSemas, mySemaSets, nextSemaNumber, numSemaSets, numSharedSemas, PANIC, SEMAS_PER_SET, PGSemaphoreData::semId, PGSemaphoreData::semNum, and sharedSemas.
| void PGSemaphoreLock | ( | PGSemaphore | sema | ) |
Definition at line 430 of file sysv_sema.c.
References EINTR, elog, FATAL, PGSemaphoreData::semId, and PGSemaphoreData::semNum.
| void PGSemaphoreReset | ( | PGSemaphore | sema | ) |
Definition at line 419 of file sysv_sema.c.
References IpcSemaphoreInitialize(), PGSemaphoreData::semId, and PGSemaphoreData::semNum.
| Size PGSemaphoreShmemSize | ( | int | maxSemas | ) |
Definition at line 307 of file sysv_sema.c.
References mul_size().
Referenced by PGReserveSemaphores().
| bool PGSemaphoreTryLock | ( | PGSemaphore | sema | ) |
Definition at line 493 of file sysv_sema.c.
References EAGAIN, EINTR, elog, EWOULDBLOCK, FATAL, IPC_NOWAIT, PGSemaphoreData::semId, and PGSemaphoreData::semNum.
| void PGSemaphoreUnlock | ( | PGSemaphore | sema | ) |
Definition at line 463 of file sysv_sema.c.
References EINTR, elog, FATAL, PGSemaphoreData::semId, and PGSemaphoreData::semNum.
Referenced by IpcSemaphoreCreate().
|
static |
Definition at line 369 of file sysv_sema.c.
References free, i, IpcSemaphoreKill(), mySemaSets, and numSemaSets.
Referenced by PGReserveSemaphores().
|
static |
Definition at line 66 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().
|
static |
Definition at line 63 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().
|
static |
Definition at line 64 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), PGSemaphoreCreate(), and ReleaseSemaphores().
|
static |
Definition at line 67 of file sysv_sema.c.
Referenced by IpcSemaphoreCreate(), and PGReserveSemaphores().
|
static |
Definition at line 68 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().
|
static |
Definition at line 65 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), PGSemaphoreCreate(), and ReleaseSemaphores().
|
static |
Definition at line 62 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().
|
static |
Definition at line 61 of file sysv_sema.c.
Referenced by PGReserveSemaphores(), and PGSemaphoreCreate().