22#ifdef USE_INJECTION_POINTS
36#define INJ_NAME_MAXLEN 64
37#define INJ_LIB_MAXLEN 128
38#define INJ_FUNC_MAXLEN 128
39#define INJ_PRIVATE_MAXLEN 1024
75#define MAX_INJECTION_POINTS 128
126 const void *private_data)
152 entry->generation = generation;
190 elog(
ERROR,
"could not find library \"%s\" for injection point \"%s\"",
197 elog(
ERROR,
"could not find function \"%s\" in library \"%s\" for injection point \"%s\"",
198 entry->function, path, entry->name);
205 entry->private_data);
265 const void *private_data,
268#ifdef USE_INJECTION_POINTS
275 elog(
ERROR,
"injection point name %s too long (maximum of %u characters)",
278 elog(
ERROR,
"injection point library %s too long (maximum of %u characters)",
281 elog(
ERROR,
"injection point function %s too long (maximum of %u characters)",
284 elog(
ERROR,
"injection point data too long (maximum of %u bytes)",
299 if (generation % 2 == 0)
314 elog(
ERROR,
"too many injection points");
319 Assert(generation % 2 == 0);
323 strlcpy(entry->library, library,
sizeof(entry->library));
326 if (private_data !=
NULL)
338 elog(
ERROR,
"injection points are not supported by this build");
350#ifdef USE_INJECTION_POINTS
365 if (generation % 2 == 0)
386 if (generation % 2 != 0)
395 elog(
ERROR,
"Injection points are not supported by this build");
400#ifdef USE_INJECTION_POINTS
439 int idx = cached->slot_idx;
472 if (generation % 2 == 0)
477 if (
memcmp(entry->name,
name, namelen + 1) != 0)
520#ifdef USE_INJECTION_POINTS
523 elog(
ERROR,
"Injection points are not supported by this build");
533#ifdef USE_INJECTION_POINTS
540 elog(
ERROR,
"Injection points are not supported by this build");
550#ifdef USE_INJECTION_POINTS
557 elog(
ERROR,
"Injection points are not supported by this build");
567#ifdef USE_INJECTION_POINTS
570 elog(
ERROR,
"Injection points are not supported by this build");
583#ifdef USE_INJECTION_POINTS
601 if (generation % 2 == 0)
616 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)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
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 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)
#define ShmemRequestStruct(...)
ShmemRequestCallback request_fn
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)