Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
dsm_impl.h80 linesDownload Raw Back to storage
1/*-------------------------------------------------------------------------2 *3 * dsm_impl.h4 *	  low-level dynamic shared memory primitives5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/storage/dsm_impl.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef DSM_IMPL_H14#define DSM_IMPL_H15 16/* Dynamic shared memory implementations. */17#define DSM_IMPL_POSIX			118#define DSM_IMPL_SYSV			219#define DSM_IMPL_WINDOWS		320#define DSM_IMPL_MMAP			421 22/*23 * Determine which dynamic shared memory implementations will be supported24 * on this platform, and which one will be the default.25 */26#ifdef WIN3227#define USE_DSM_WINDOWS28#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_WINDOWS29#else30#ifdef HAVE_SHM_OPEN31#define USE_DSM_POSIX32#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_POSIX33#endif34#define USE_DSM_SYSV35#ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE36#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE		DSM_IMPL_SYSV37#endif38#define USE_DSM_MMAP39#endif40 41/* GUC. */42extern PGDLLIMPORT int dynamic_shared_memory_type;43extern PGDLLIMPORT int min_dynamic_shared_memory;44 45/*46 * Directory for on-disk state.47 *48 * This is used by all implementations for crash recovery and by the mmap49 * implementation for storage.50 */51#define PG_DYNSHMEM_DIR					"pg_dynshmem"52#define PG_DYNSHMEM_MMAP_FILE_PREFIX	"mmap."53 54/* A "name" for a dynamic shared memory segment. */55typedef uint32 dsm_handle;56 57/* Sentinel value to use for invalid DSM handles. */58#define DSM_HANDLE_INVALID ((dsm_handle) 0)59 60/* All the shared-memory operations we know about. */61typedef enum62{63	DSM_OP_CREATE,64	DSM_OP_ATTACH,65	DSM_OP_DETACH,66	DSM_OP_DESTROY67} dsm_op;68 69/* Create, attach to, detach from, resize, or destroy a segment. */70extern bool dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size,71						void **impl_private, void **mapped_address, Size *mapped_size,72						int elevel);73 74/* Implementation-dependent actions required to keep segment until shutdown. */75extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private,76								 void **impl_private_pm_handle);77extern void dsm_impl_unpin_segment(dsm_handle handle, void **impl_private);78 79#endif							/* DSM_IMPL_H */80 
codekingpro/portable-devtools · Team Ai