Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

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#include "nodes/pg_list.h"
15
16/*
17 * Injection point data, used when retrieving a list of all the attached
18 * injection points.
19 */
20typedef struct InjectionPointData
21{
22 const char *name;
23 const char *library;
24 const char *function;
26
27/*
28 * Injection points require --enable-injection-points.
29 */
30#ifdef USE_INJECTION_POINTS
31#define INJECTION_POINT_LOAD(name) InjectionPointLoad(name)
32#define INJECTION_POINT(name, arg) InjectionPointRun(name, arg)
33#define INJECTION_POINT_CACHED(name, arg) InjectionPointCached(name, arg)
34#define IS_INJECTION_POINT_ATTACHED(name) IsInjectionPointAttached(name)
35#else
36#define INJECTION_POINT_LOAD(name) ((void) name)
37#define INJECTION_POINT(name, arg) ((void) name)
38#define INJECTION_POINT_CACHED(name, arg) ((void) name)
39#define IS_INJECTION_POINT_ATTACHED(name) (false)
40#endif
41
42/*
43 * Typedef for callback function launched by an injection point.
44 */
45typedef void (*InjectionPointCallback) (const char *name,
46 const void *private_data,
47 void *arg);
48
49extern Size InjectionPointShmemSize(void);
50extern void InjectionPointShmemInit(void);
51
52extern void InjectionPointAttach(const char *name,
53 const char *library,
54 const char *function,
55 const void *private_data,
56 int private_data_size);
57extern void InjectionPointLoad(const char *name);
58extern void InjectionPointRun(const char *name, void *arg);
59extern void InjectionPointCached(const char *name, void *arg);
60extern bool IsInjectionPointAttached(const char *name);
61extern bool InjectionPointDetach(const char *name);
62
63/* Get the current set of injection points attached */
64extern List *InjectionPointList(void);
65
66#ifdef EXEC_BACKEND
67extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints;
68#endif
69
70#endif /* INJECTION_POINT_H */
#define PGDLLIMPORT
Definition: c.h:1320
size_t Size
Definition: c.h:611
void InjectionPointShmemInit(void)
Size InjectionPointShmemSize(void)
void InjectionPointLoad(const char *name)
bool InjectionPointDetach(const char *name)
List * InjectionPointList(void)
void InjectionPointRun(const char *name, void *arg)
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, void *arg)
struct InjectionPointData InjectionPointData
void InjectionPointCached(const char *name, void *arg)
on_exit_nicely_callback function
void * arg
const char * library
const char * function
Definition: pg_list.h:54
const char * name