22#ifdef USE_INJECTION_POINTS
35#define INJ_NAME_MAXLEN 64
36#define INJ_LIB_MAXLEN 128
37#define INJ_FUNC_MAXLEN 128
38#define INJ_PRIVATE_MAXLEN 1024
74#define MAX_INJECTION_POINTS 128
122 const void *private_data)
148 entry->generation = generation;
186 elog(
ERROR,
"could not find library \"%s\" for injection point \"%s\"",
193 elog(
ERROR,
"could not find function \"%s\" in library \"%s\" for injection point \"%s\"",
194 entry->function, path, entry->name);
201 entry->private_data);
235#ifdef USE_INJECTION_POINTS
251#ifdef USE_INJECTION_POINTS
276 const void *private_data,
279#ifdef USE_INJECTION_POINTS
286 elog(
ERROR,
"injection point name %s too long (maximum of %u characters)",
289 elog(
ERROR,
"injection point library %s too long (maximum of %u characters)",
292 elog(
ERROR,
"injection point function %s too long (maximum of %u characters)",
295 elog(
ERROR,
"injection point data too long (maximum of %u bytes)",
310 if (generation % 2 == 0)
325 elog(
ERROR,
"too many injection points");
330 Assert(generation % 2 == 0);
334 strlcpy(entry->library, library,
sizeof(entry->library));
336 if (private_data !=
NULL)
348 elog(
ERROR,
"injection points are not supported by this build");
360#ifdef USE_INJECTION_POINTS
375 if (generation % 2 == 0)
396 if (generation % 2 != 0)
405 elog(
ERROR,
"Injection points are not supported by this build");
410#ifdef USE_INJECTION_POINTS
449 int idx = cached->slot_idx;
482 if (generation % 2 == 0)
487 if (
memcmp(entry->name,
name, namelen + 1) != 0)
530#ifdef USE_INJECTION_POINTS
533 elog(
ERROR,
"Injection points are not supported by this build");
543#ifdef USE_INJECTION_POINTS
550 elog(
ERROR,
"Injection points are not supported by this build");
560#ifdef USE_INJECTION_POINTS
567 elog(
ERROR,
"Injection points are not supported by this build");
577#ifdef USE_INJECTION_POINTS
580 elog(
ERROR,
"Injection points are not supported by this build");
593#ifdef USE_INJECTION_POINTS
611 if (generation % 2 == 0)
626 elog(
ERROR,
"Injection points are not supported by this build");
Datum idx(PG_FUNCTION_ARGS)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
#define pg_read_barrier()
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
#define pg_write_barrier()
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
void * load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void hash_destroy(HTAB *hashp)
bool pg_file_exists(const char *name)
#define palloc0_object(type)
char pkglib_path[MAXPGPATH]
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 InjectionPointCached(const char *name, void *arg)
void(* InjectionPointCallback)(const char *name, const void *private_data, void *arg)
List * lappend(List *list, void *datum)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
char * pstrdup(const char *in)
MemoryContext TopMemoryContext
on_exit_nicely_callback function
size_t strlcpy(char *dst, const char *src, size_t siz)
Size add_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)