PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include "common/file_perm.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "portability/mem.h"
#include "postmaster/postmaster.h"
#include "storage/dsm_impl.h"
#include "storage/fd.h"
#include "utils/guc.h"
#include "utils/memutils.h"
Go to the source code of this file.
Macros | |
#define | ZBUFFER_SIZE 8192 |
#define | SEGMENT_NAME_PREFIX "Global/PostgreSQL" |
Functions | |
static bool | dsm_impl_posix (dsm_op op, dsm_handle handle, Size request_size, void **impl_private, void **mapped_address, Size *mapped_size, int elevel) |
static int | dsm_impl_posix_resize (int fd, off_t size) |
static bool | dsm_impl_sysv (dsm_op op, dsm_handle handle, Size request_size, void **impl_private, void **mapped_address, Size *mapped_size, int elevel) |
static bool | dsm_impl_mmap (dsm_op op, dsm_handle handle, Size request_size, void **impl_private, void **mapped_address, Size *mapped_size, int elevel) |
static int | errcode_for_dynamic_shared_memory (void) |
bool | dsm_impl_op (dsm_op op, dsm_handle handle, Size request_size, void **impl_private, void **mapped_address, Size *mapped_size, int elevel) |
void | dsm_impl_pin_segment (dsm_handle handle, void *impl_private, void **impl_private_pm_handle) |
void | dsm_impl_unpin_segment (dsm_handle handle, void **impl_private) |
Variables | |
const struct config_enum_entry | dynamic_shared_memory_options [] |
int | dynamic_shared_memory_type = DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE |
int | min_dynamic_shared_memory |
#define SEGMENT_NAME_PREFIX "Global/PostgreSQL" |
Definition at line 120 of file dsm_impl.c.
#define ZBUFFER_SIZE 8192 |
Definition at line 118 of file dsm_impl.c.
|
static |
Definition at line 792 of file dsm_impl.c.
References CloseTransientFile(), DSM_OP_ATTACH, DSM_OP_CREATE, DSM_OP_DESTROY, DSM_OP_DETACH, ereport, errcode_for_dynamic_shared_memory(), errcode_for_file_access(), errmsg(), fd(), fstat, MAP_FAILED, MAP_HASSEMAPHORE, MAP_NOSYNC, name, OpenTransientFile(), palloc0(), PG_DYNSHMEM_DIR, PG_DYNSHMEM_MMAP_FILE_PREFIX, pgstat_report_wait_end(), pgstat_report_wait_start(), remaining, snprintf, stat::st_size, success, write, and ZBUFFER_SIZE.
Referenced by dsm_impl_op().
bool dsm_impl_op | ( | dsm_op | op, |
dsm_handle | handle, | ||
Size | request_size, | ||
void ** | impl_private, | ||
void ** | mapped_address, | ||
Size * | mapped_size, | ||
int | elevel | ||
) |
Definition at line 159 of file dsm_impl.c.
References Assert, dsm_impl_mmap(), DSM_IMPL_MMAP, dsm_impl_posix(), DSM_IMPL_POSIX, dsm_impl_sysv(), DSM_IMPL_SYSV, DSM_IMPL_WINDOWS, DSM_OP_ATTACH, DSM_OP_CREATE, dynamic_shared_memory_type, elog, and ERROR.
Referenced by dsm_attach(), dsm_backend_startup(), dsm_cleanup_using_control_segment(), dsm_create(), dsm_detach(), dsm_detach_all(), dsm_postmaster_shutdown(), dsm_postmaster_startup(), and dsm_unpin_segment().
void dsm_impl_pin_segment | ( | dsm_handle | handle, |
void * | impl_private, | ||
void ** | impl_private_pm_handle | ||
) |
Definition at line 963 of file dsm_impl.c.
References _dosmaperr(), DSM_IMPL_WINDOWS, dynamic_shared_memory_type, ereport, errcode_for_dynamic_shared_memory(), errmsg(), ERROR, IsUnderPostmaster, name, SEGMENT_NAME_PREFIX, and snprintf.
Referenced by dsm_pin_segment().
|
static |
Definition at line 212 of file dsm_impl.c.
References close, dsm_impl_posix_resize(), DSM_OP_ATTACH, DSM_OP_CREATE, DSM_OP_DESTROY, DSM_OP_DETACH, ereport, errcode_for_dynamic_shared_memory(), errmsg(), fd(), fstat, MAP_FAILED, MAP_HASSEMAPHORE, MAP_NOSYNC, name, PG_FILE_MODE_OWNER, ReleaseExternalFD(), ReserveExternalFD(), snprintf, and stat::st_size.
Referenced by dsm_impl_op().
|
static |
Definition at line 351 of file dsm_impl.c.
References BlockSig, EINTR, fd(), ftruncate, IsUnderPostmaster, pgstat_report_wait_end(), pgstat_report_wait_start(), and size.
Referenced by dsm_impl_posix().
|
static |
Definition at line 423 of file dsm_impl.c.
References DEBUG4, DSM_OP_ATTACH, DSM_OP_CREATE, DSM_OP_DESTROY, DSM_OP_DETACH, elog, ereport, errcode_for_dynamic_shared_memory(), errmsg(), ident, IPC_CREAT, IPC_EXCL, IPC_PRIVATE, IPC_RMID, IPC_STAT, IPCProtection, sort-test::key, MemoryContextAlloc(), name, pfree(), PG_SHMAT_FLAGS, snprintf, and TopMemoryContext.
Referenced by dsm_impl_op().
void dsm_impl_unpin_segment | ( | dsm_handle | handle, |
void ** | impl_private | ||
) |
Definition at line 1014 of file dsm_impl.c.
References _dosmaperr(), DSM_IMPL_WINDOWS, dynamic_shared_memory_type, ereport, errcode_for_dynamic_shared_memory(), errmsg(), ERROR, IsUnderPostmaster, name, SEGMENT_NAME_PREFIX, and snprintf.
Referenced by dsm_unpin_segment().
|
static |
Definition at line 1047 of file dsm_impl.c.
References errcode(), and errcode_for_file_access().
Referenced by dsm_impl_mmap(), dsm_impl_pin_segment(), dsm_impl_posix(), dsm_impl_sysv(), and dsm_impl_unpin_segment().
const struct config_enum_entry dynamic_shared_memory_options[] |
Definition at line 93 of file dsm_impl.c.
int dynamic_shared_memory_type = DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE |
Definition at line 112 of file dsm_impl.c.
Referenced by dsm_impl_op(), dsm_impl_pin_segment(), dsm_impl_unpin_segment(), and dsm_postmaster_startup().
int min_dynamic_shared_memory |
Definition at line 115 of file dsm_impl.c.
Referenced by dsm_estimate_size().