PostgreSQL Source Code git master
injection_point.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 * injection_point.h
3 * Definitions related to injection points.
4 *
5 * Copyright (c) 2001-2025, PostgreSQL Global Development Group
6 *
7 * src/include/utils/injection_point.h
8 *-------------------------------------------------------------------------
9 */
10
11#ifndef INJECTION_POINT_H
12#define INJECTION_POINT_H
13
14/*
15 * Injection points require --enable-injection-points.
16 */
17#ifdef USE_INJECTION_POINTS
18#define INJECTION_POINT_LOAD(name) InjectionPointLoad(name)
19#define INJECTION_POINT(name) InjectionPointRun(name)
20#define INJECTION_POINT_CACHED(name) InjectionPointCached(name)
21#define IS_INJECTION_POINT_ATTACHED(name) IsInjectionPointAttached(name)
22#else
23#define INJECTION_POINT_LOAD(name) ((void) name)
24#define INJECTION_POINT(name) ((void) name)
25#define INJECTION_POINT_CACHED(name) ((void) name)
26#define IS_INJECTION_POINT_ATTACHED(name) (false)
27#endif
28
29/*
30 * Typedef for callback function launched by an injection point.
31 */
32typedef void (*InjectionPointCallback) (const char *name,
33 const void *private_data);
34
35extern Size InjectionPointShmemSize(void);
36extern void InjectionPointShmemInit(void);
37
38extern void InjectionPointAttach(const char *name,
39 const char *library,
40 const char *function,
41 const void *private_data,
42 int private_data_size);
43extern void InjectionPointLoad(const char *name);
44extern void InjectionPointRun(const char *name);
45extern void InjectionPointCached(const char *name);
46extern bool IsInjectionPointAttached(const char *name);
47extern bool InjectionPointDetach(const char *name);
48
49#ifdef EXEC_BACKEND
50extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints;
51#endif
52
53#endif /* INJECTION_POINT_H */
#define PGDLLIMPORT
Definition: c.h:1277
size_t Size
Definition: c.h:562
void InjectionPointShmemInit(void)
Size InjectionPointShmemSize(void)
void InjectionPointCached(const char *name)
void InjectionPointLoad(const char *name)
bool InjectionPointDetach(const char *name)
void InjectionPointRun(const char *name)
bool IsInjectionPointAttached(const char *name)
void InjectionPointAttach(const char *name, const char *library, const char *function, const void *private_data, int private_data_size)
void(* InjectionPointCallback)(const char *name, const void *private_data)
on_exit_nicely_callback function
const char * name