Unmark gen_random_uuid() function leakproof.
[pgsql.git] / src / include / storage / dsm.h
blob1a22b32df1a4d3851bf5c8ae552149d5d121a893
1 /*-------------------------------------------------------------------------
3 * dsm.h
4 * manage dynamic shared memory segments
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/storage/dsm.h
11 *-------------------------------------------------------------------------
13 #ifndef DSM_H
14 #define DSM_H
16 #include "storage/dsm_impl.h"
18 typedef struct dsm_segment dsm_segment;
20 #define DSM_CREATE_NULL_IF_MAXSEGMENTS 0x0001
22 /* Startup and shutdown functions. */
23 struct PGShmemHeader; /* avoid including pg_shmem.h */
24 extern void dsm_cleanup_using_control_segment(dsm_handle old_control_handle);
25 extern void dsm_postmaster_startup(struct PGShmemHeader *);
26 extern void dsm_backend_shutdown(void);
27 extern void dsm_detach_all(void);
29 extern size_t dsm_estimate_size(void);
30 extern void dsm_shmem_init(void);
32 #ifdef EXEC_BACKEND
33 extern void dsm_set_control_handle(dsm_handle h);
34 #endif
36 /* Functions that create or remove mappings. */
37 extern dsm_segment *dsm_create(Size size, int flags);
38 extern dsm_segment *dsm_attach(dsm_handle h);
39 extern void dsm_detach(dsm_segment *seg);
41 /* Resource management functions. */
42 extern void dsm_pin_mapping(dsm_segment *seg);
43 extern void dsm_unpin_mapping(dsm_segment *seg);
44 extern void dsm_pin_segment(dsm_segment *seg);
45 extern void dsm_unpin_segment(dsm_handle handle);
46 extern dsm_segment *dsm_find_mapping(dsm_handle handle);
48 /* Informational functions. */
49 extern void *dsm_segment_address(dsm_segment *seg);
50 extern Size dsm_segment_map_length(dsm_segment *seg);
51 extern dsm_handle dsm_segment_handle(dsm_segment *seg);
53 /* Cleanup hooks. */
54 typedef void (*on_dsm_detach_callback) (dsm_segment *, Datum arg);
55 extern void on_dsm_detach(dsm_segment *seg,
56 on_dsm_detach_callback function, Datum arg);
57 extern void cancel_on_dsm_detach(dsm_segment *seg,
58 on_dsm_detach_callback function, Datum arg);
59 extern void reset_on_dsm_detach(void);
61 #endif /* DSM_H */