|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <signal.h>#include <unistd.h>#include <sys/file.h>#include <sys/ipc.h>#include <sys/mman.h>#include <sys/shm.h>#include <sys/stat.h>#include "miscadmin.h"#include "port/pg_bitutils.h"#include "portability/mem.h"#include "storage/dsm.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/pg_shmem.h"#include "storage/shmem.h"#include "utils/guc.h"#include "utils/guc_hooks.h"#include "utils/pidfile.h"
Go to the source code of this file.
Typedefs | |
| typedef key_t | IpcMemoryKey |
| typedef int | IpcMemoryId |
Enumerations | |
| enum | IpcMemoryState { SHMSTATE_ANALYSIS_FAILURE , SHMSTATE_ATTACHED , SHMSTATE_ENOENT , SHMSTATE_FOREIGN , SHMSTATE_UNATTACHED } |
Functions | |
| static void * | InternalIpcMemoryCreate (IpcMemoryKey memKey, Size size) |
| static void | IpcMemoryDetach (int status, Datum shmaddr) |
| static void | IpcMemoryDelete (int status, Datum shmId) |
| static IpcMemoryState | PGSharedMemoryAttach (IpcMemoryId shmId, void *attachAt, PGShmemHeader **addr) |
| bool | PGSharedMemoryIsInUse (unsigned long id1, unsigned long id2) |
| void | GetHugePageSize (Size *hugepagesize, int *mmap_flags) |
| bool | check_huge_page_size (int *newval, void **extra, GucSource source) |
| static void * | CreateAnonymousSegment (Size *size) |
| static void | AnonymousShmemDetach (int status, Datum arg) |
| PGShmemHeader * | PGSharedMemoryCreate (Size size, PGShmemHeader **shim) |
| void | PGSharedMemoryDetach (void) |
Variables | |
| unsigned long | UsedShmemSegID = 0 |
| void * | UsedShmemSegAddr = NULL |
| static Size | AnonymousShmemSize |
| static void * | AnonymousShmem = NULL |
Definition at line 72 of file sysv_shmem.c.
Definition at line 71 of file sysv_shmem.c.
| Enumerator | |
|---|---|
| SHMSTATE_ANALYSIS_FAILURE | |
| SHMSTATE_ATTACHED | |
| SHMSTATE_ENOENT | |
| SHMSTATE_FOREIGN | |
| SHMSTATE_UNATTACHED | |
Definition at line 85 of file sysv_shmem.c.
Definition at line 677 of file sysv_shmem.c.
References AnonymousShmem, AnonymousShmemSize, elog, fb(), and LOG.
Referenced by PGSharedMemoryCreate().
Definition at line 579 of file sysv_shmem.c.
References GUC_check_errdetail, and newval.
Definition at line 600 of file sysv_shmem.c.
References add_size(), Assert, DEBUG1, elog, ereport, errhint(), errmsg(), FATAL, fb(), GetHugePageSize(), huge_pages, HUGE_PAGES_ON, HUGE_PAGES_TRY, MAP_ANONYMOUS, MAP_FAILED, MAP_HASSEMAPHORE, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, and SetConfigOption().
Referenced by PGSharedMemoryCreate().
Definition at line 480 of file sysv_shmem.c.
References AllocateFile(), buf, fb(), FreeFile(), huge_page_size, and pg_ceil_log2_64().
Referenced by CreateAnonymousSegment(), InitializeShmemGUCs(), and pg_get_shmem_pagesize().
|
static |
Definition at line 122 of file sysv_shmem.c.
References AddToDataDirLockFile(), EIDRM, elog, ereport, errdetail(), errhint(), errmsg(), FATAL, fb(), Int32GetDatum(), IPC_CREAT, IPC_EXCL, IPC_RMID, IpcMemoryDelete(), IpcMemoryDetach(), IPCProtection, LOCK_FILE_LINE_SHMEM_KEY, LOG, on_shmem_exit(), PG_SHMAT_FLAGS, PointerGetDatum(), and sprintf.
Referenced by PGSharedMemoryCreate().
Definition at line 299 of file sysv_shmem.c.
References DatumGetInt32(), elog, fb(), IPC_RMID, and LOG.
Referenced by InternalIpcMemoryCreate().
Definition at line 287 of file sysv_shmem.c.
References DatumGetPointer(), elog, fb(), and LOG.
Referenced by InternalIpcMemoryCreate().
|
static |
Definition at line 348 of file sysv_shmem.c.
References DataDir, EIDRM, fb(), IPC_STAT, PG_SHMAT_FLAGS, PGShmemMagic, SHMSTATE_ANALYSIS_FAILURE, SHMSTATE_ATTACHED, SHMSTATE_ENOENT, SHMSTATE_FOREIGN, SHMSTATE_UNATTACHED, and stat.
Referenced by PGSharedMemoryCreate(), and PGSharedMemoryIsInUse().
| PGShmemHeader * PGSharedMemoryCreate | ( | Size | size, |
| PGShmemHeader ** | shim | ||
| ) |
Definition at line 702 of file sysv_shmem.c.
References AnonymousShmem, AnonymousShmemDetach(), AnonymousShmemSize, Assert, PGShmemHeader::content_offset, CreateAnonymousSegment(), PGShmemHeader::creatorPID, DataDir, PGShmemHeader::device, dsm_cleanup_using_control_segment(), PGShmemHeader::dsm_control, elog, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, FATAL, fb(), huge_pages, HUGE_PAGES_ON, PGShmemHeader::inode, InternalIpcMemoryCreate(), IPC_RMID, LOG, PGShmemHeader::magic, MAXALIGN, on_shmem_exit(), PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, PGSharedMemoryAttach(), PGShmemMagic, SetConfigOption(), shared_memory_type, SHMEM_TYPE_MMAP, SHMSTATE_ANALYSIS_FAILURE, SHMSTATE_ATTACHED, SHMSTATE_ENOENT, SHMSTATE_FOREIGN, SHMSTATE_UNATTACHED, stat, PGShmemHeader::totalsize, UsedShmemSegAddr, and UsedShmemSegID.
Referenced by CreateSharedMemoryAndSemaphores().
Definition at line 972 of file sysv_shmem.c.
References AnonymousShmem, AnonymousShmemSize, elog, fb(), LOG, and UsedShmemSegAddr.
Referenced by postmaster_child_launch().
Definition at line 318 of file sysv_shmem.c.
References elog, fb(), LOG, PGSharedMemoryAttach(), SHMSTATE_ANALYSIS_FAILURE, SHMSTATE_ATTACHED, SHMSTATE_ENOENT, SHMSTATE_FOREIGN, and SHMSTATE_UNATTACHED.
Referenced by CreateLockFile().
Definition at line 99 of file sysv_shmem.c.
Referenced by AnonymousShmemDetach(), PGSharedMemoryCreate(), and PGSharedMemoryDetach().
|
static |
Definition at line 98 of file sysv_shmem.c.
Referenced by AnonymousShmemDetach(), PGSharedMemoryCreate(), and PGSharedMemoryDetach().
Definition at line 96 of file sysv_shmem.c.
Referenced by PGSharedMemoryCreate(), and PGSharedMemoryDetach().
Definition at line 95 of file sysv_shmem.c.
Referenced by PGSharedMemoryCreate().