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-2024, 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  * Injections 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  */
32 typedef void (*InjectionPointCallback) (const char *name,
33  const void *private_data);
34 
35 extern Size InjectionPointShmemSize(void);
36 extern void InjectionPointShmemInit(void);
37 
38 extern void InjectionPointAttach(const char *name,
39  const char *library,
40  const char *function,
41  const void *private_data,
42  int private_data_size);
43 extern void InjectionPointLoad(const char *name);
44 extern void InjectionPointRun(const char *name);
45 extern void InjectionPointCached(const char *name);
46 extern bool IsInjectionPointAttached(const char *name);
47 extern bool InjectionPointDetach(const char *name);
48 
49 #ifdef EXEC_BACKEND
50 extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints;
51 #endif
52 
53 #endif /* INJECTION_POINT_H */
#define PGDLLIMPORT
Definition: c.h:1316
size_t Size
Definition: c.h:605
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)
const char * name