diff options
author | Robert Haas | 2010-12-13 23:58:31 +0000 |
---|---|---|
committer | Robert Haas | 2010-12-14 00:15:53 +0000 |
commit | d368e1a2a7afad5a0fc711a2ab70a83c36fa57af (patch) | |
tree | 7536290197c79f079e1a9938a218ac632e34b134 /src/include/fmgr.h | |
parent | 843a490f0aeccd5b61a30c37d2ffaae26d192329 (diff) |
Allow plugins to suppress inlining and hook function entry/exit/abort.
This is intended as infrastructure to allow an eventual SE-Linux plugin to
support trusted procedures.
KaiGai Kohei
Diffstat (limited to 'src/include/fmgr.h')
-rw-r--r-- | src/include/fmgr.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h index ca5a5eacf79..99213bc1179 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -544,6 +544,32 @@ extern void **find_rendezvous_variable(const char *varName); extern int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext); +/* + * We allow plugin modules to hook function entry/exit. This is intended + * as support for loadable security policy modules, which may want to + * perform additional privilege checks on function entry or exit, or to do + * other internal bookkeeping. To make this possible, such modules must be + * able not only to support normal function entry and exit, but also to trap + * the case where we bail out due to an error; and they must also be able to + * prevent inlining. + */ +typedef enum FmgrHookEventType +{ + FHET_START, + FHET_END, + FHET_ABORT +} FmgrHookEventType; + +typedef bool (*needs_fmgr_hook_type)(Oid fn_oid); + +typedef void (*fmgr_hook_type)(FmgrHookEventType event, + FmgrInfo *flinfo, Datum *private); + +extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; +extern PGDLLIMPORT fmgr_hook_type fmgr_hook; + +#define FmgrHookIsNeeded(fn_oid) \ + (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid)) /* * !!! OLD INTERFACE !!! |