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, arg) InjectionPointRun(name, arg)
20#define INJECTION_POINT_CACHED(name, arg) InjectionPointCached(name, arg)
21#define IS_INJECTION_POINT_ATTACHED(name) IsInjectionPointAttached(name)
22#else
23#define INJECTION_POINT_LOAD(name) ((void) name)
24#define INJECTION_POINT(name, arg) ((void) name)
25#define INJECTION_POINT_CACHED(name, arg) ((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 void *arg);
35
36extern Size InjectionPointShmemSize(void);
37extern void InjectionPointShmemInit(void);
38
39extern void InjectionPointAttach(const char *name,
40 const char *library,
41 const char *function,
42 const void *private_data,
43 int private_data_size);
44extern void InjectionPointLoad(const char *name);
45extern void InjectionPointRun(const char *name, void *arg);
46extern void InjectionPointCached(const char *name, void *arg);
47extern bool IsInjectionPointAttached(const char *name);
48extern bool InjectionPointDetach(const char *name);
49
50#ifdef EXEC_BACKEND
51extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints;
52#endif
53
54#endif /* INJECTION_POINT_H */
#define PGDLLIMPORT
Definition: c.h:1291
size_t Size
Definition: c.h:576
void InjectionPointShmemInit(void)
Size InjectionPointShmemSize(void)
void InjectionPointLoad(const char *name)
bool InjectionPointDetach(const char *name)
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)
void InjectionPointCached(const char *name, void *arg)
on_exit_nicely_callback function
void * arg
const char * name