Public API header for Puk-ABI. More...
#include "Puk-ABI-internals.h"#include <sys/types.h>#include <errno.h>#include "Puk-ABI-symbols.h"

Go to the source code of this file.
Data Structures | |
| struct | puk_mem_reg_s |
| a registered memory entry More... | |
| struct | puk_mem_invalidate_hook_s |
Macros | |
| #define | PUK_ABI |
| #define | MKSYMFX(SYM, RETTYPE, ARGSDECL, ARGSUSE, PRE, POST, ISREAL) PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
| Generates symbol types, structures, stubs, and wrappers. | |
| #define | MKSYMVX1(SYM, RETTYPE, ARGSDECL, ARG1, PROCESSING, ISREAL) PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
| #define | MKSYMVX2(SYM, RETTYPE, ARGSDECL, ARG1, ARG2, PROCESSING, ISREAL) PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
| #define | MKSYMVX3(SYM, RETTYPE, ARGSDECL, ARG1, ARG2, ARG3, PROCESSING, ISREAL) PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
| #define | MKSYMPX(SYM, RETTYPE, ARGSDECL, ARGSUSE, PRE, POST, ISREAL) PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
| #define | MKSYMNOSUPPORT(SYM) PUK_ABI_MKTYPE(SYM, void, (void)) |
| #define | PUK_ABI_REAL(SYM) (*((_PASTE(SYM, _func_t))(PUK_ABI_SYM_REAL(SYM)))) |
| Call the real libc symbol (always REAL, no locking)- it is up to the user to appropriately puk_spinlock_{acquire|release}(). | |
| #define | PUK_ABI_VIRTUAL(SYM) (*((_PASTE(SYM, _func_t))(PUK_ABI_SYM_VIRTUAL(SYM)))) |
| Call the virtual symbol (always virtual). | |
| #define | PUK_ABI_STUB(SYM) (SYM) /* PUK_ABI_SYM_STUB(SYM) */ |
| Call the stub symbol (auto choice) | |
| #define | PUK_ABI_WRAP(SYM) PUK_ABI_SYM_WRAP(SYM) |
| Call the wrap symbol (real + puk_spinlock_{acquire|release}() ) | |
| #define | PUK_ABI_FSYS_REAL(SYM) SYM |
| #define | PUK_ABI_FSYS_WRAP(SYM) SYM |
| #define | PUK_ABI_PROC_REAL(SYM) SYM |
| #define | PUK_ABI_PROC_WRAP(SYM) SYM |
| #define | PUK_ABI_MEM_REAL(SYM) SYM |
| #define | PUK_ABI_MEM_WRAP(SYM) SYM |
| #define | PUK_ABI_RESOLV_REAL(SYM) SYM |
| #define | PUK_ABI_RESOLV_WRAP(SYM) SYM |
| #define | __puk_abi_wrap__errno errno |
| #define | puk_abi_seterrno(VAL) ( errno = (VAL) ) |
| #define | puk_abi_geterrno() (errno) |
| #define | puk_abi_real_errno() (errno) |
| #define | puk_abi_set_virtual(SYM, FUNC) { PUK_ABI_SYM_GETDESC(SYM)()->ptr_virtual = (FUNC); } |
| sets the handler for a virtual symbol | |
Typedefs | |
| typedef void *(* | puk_mem_register_t) (void *context, const void *ptr, size_t len) |
| hook to register memory- returned value is used as key | |
| typedef void(* | puk_mem_unregister_t) (void *context, const void *ptr, void *key) |
| hook to unregister memory | |
| typedef struct puk_mem_invalidate_hook_s * | puk_mem_invalidate_hook_t |
| typedef void(* | puk_mem_pre_hook_t) (void) |
| typedef void(* | puk_mem_post_hook_t) (void) |
Functions | |
| void | puk_mem_set_handlers (puk_mem_register_t reg, puk_mem_unregister_t unreg) |
| sets handlers to register memory | |
| const struct puk_mem_reg_s * | puk_mem_reg (void *context, const void *ptr, size_t len) |
| asks for memory registration- does nothing if registration has been cached | |
| void | puk_mem_unreg (const struct puk_mem_reg_s *reg) |
| marks registration entry as 'unused' | |
| void | puk_abi_mem_set_invalidate_hook (puk_mem_invalidate_hook_t hook) |
| set a hook called to invalidate memory | |
| void | puk_abi_mem_unset_invalidate_hook (puk_mem_invalidate_hook_t hook) |
| unset a hook called to invalidate memory | |
| void | puk_abi_mem_set_hooks (puk_mem_pre_hook_t pre_hook, puk_mem_post_hook_t post_hook) |
| set hooks called before & after memory operations | |
| int | puk_abi_vfd_alloc (void) |
| void | puk_abi_vfd_free (int abi_fd) |
| void | puk_abi_disable_preload (void) |
| disable LD_PRELOAD to prevent forked processes (xterm, gdb) from runnig with PukABI | |
| void | puk_abi_set_spinlock_handlers (void(*acquire)(void), void(*release)(void), int(*trylock)(void)) |
| sets the main spinlock handlers. | |
| void | puk_abi_set_errno_handler (int *(*errno_handler)(void)) |
| sets the errno location function | |
| void | puk_abi_unset_errno_handler (void) |
| remove the errno location function handler | |
Detailed Description
Public API header for Puk-ABI.
- Note
- Only stuff defined in this file is part of the API, even if internals are #include'd for inlined functions.
- Warning
- Do not include this file in PukABI itself! MKSYMxX macros have different declarations.
Definition in file Puk-ABI.h.
Macro Definition Documentation
◆ __puk_abi_wrap__errno
◆ MKSYMFX
| #define MKSYMFX | ( | SYM, | |
| RETTYPE, | |||
| ARGSDECL, | |||
| ARGSUSE, | |||
| PRE, | |||
| POST, | |||
| ISREAL | |||
| ) | PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
◆ MKSYMNOSUPPORT
| #define MKSYMNOSUPPORT | ( | SYM | ) | PUK_ABI_MKTYPE(SYM, void, (void)) |
◆ MKSYMPX
| #define MKSYMPX | ( | SYM, | |
| RETTYPE, | |||
| ARGSDECL, | |||
| ARGSUSE, | |||
| PRE, | |||
| POST, | |||
| ISREAL | |||
| ) | PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
◆ MKSYMVX1
| #define MKSYMVX1 | ( | SYM, | |
| RETTYPE, | |||
| ARGSDECL, | |||
| ARG1, | |||
| PROCESSING, | |||
| ISREAL | |||
| ) | PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
◆ MKSYMVX2
| #define MKSYMVX2 | ( | SYM, | |
| RETTYPE, | |||
| ARGSDECL, | |||
| ARG1, | |||
| ARG2, | |||
| PROCESSING, | |||
| ISREAL | |||
| ) | PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
◆ MKSYMVX3
| #define MKSYMVX3 | ( | SYM, | |
| RETTYPE, | |||
| ARGSDECL, | |||
| ARG1, | |||
| ARG2, | |||
| ARG3, | |||
| PROCESSING, | |||
| ISREAL | |||
| ) | PUK_ABI_MKTYPE(SYM, RETTYPE, ARGSDECL) |
◆ PUK_ABI
◆ PUK_ABI_FSYS_REAL
◆ PUK_ABI_FSYS_WRAP
◆ puk_abi_geterrno
◆ PUK_ABI_MEM_REAL
◆ PUK_ABI_MEM_WRAP
◆ PUK_ABI_PROC_REAL
◆ PUK_ABI_PROC_WRAP
◆ PUK_ABI_REAL
| #define PUK_ABI_REAL | ( | SYM | ) | (*((_PASTE(SYM, _func_t))(PUK_ABI_SYM_REAL(SYM)))) |
◆ puk_abi_real_errno
◆ PUK_ABI_RESOLV_REAL
◆ PUK_ABI_RESOLV_WRAP
◆ puk_abi_set_virtual
| #define puk_abi_set_virtual | ( | SYM, | |
| FUNC | |||
| ) | { PUK_ABI_SYM_GETDESC(SYM)()->ptr_virtual = (FUNC); } |
◆ puk_abi_seterrno
◆ PUK_ABI_STUB
| #define PUK_ABI_STUB | ( | SYM | ) | (SYM) /* PUK_ABI_SYM_STUB(SYM) */ |
◆ PUK_ABI_VIRTUAL
| #define PUK_ABI_VIRTUAL | ( | SYM | ) | (*((_PASTE(SYM, _func_t))(PUK_ABI_SYM_VIRTUAL(SYM)))) |
◆ PUK_ABI_WRAP
| #define PUK_ABI_WRAP | ( | SYM | ) | PUK_ABI_SYM_WRAP(SYM) |
Typedef Documentation
◆ puk_mem_invalidate_hook_t
| typedef struct puk_mem_invalidate_hook_s* puk_mem_invalidate_hook_t |
◆ puk_mem_post_hook_t
◆ puk_mem_pre_hook_t
◆ puk_mem_register_t
| typedef void *(* puk_mem_register_t) (void *context, const void *ptr, size_t len) |
◆ puk_mem_unregister_t
| typedef void(* puk_mem_unregister_t) (void *context, const void *ptr, void *key) |
Function Documentation
◆ puk_abi_disable_preload()
|
extern |
disable LD_PRELOAD to prevent forked processes (xterm, gdb) from runnig with PukABI
Definition at line 240 of file puk-abi-tools.c.
◆ puk_abi_mem_set_hooks()
| void puk_abi_mem_set_hooks | ( | puk_mem_pre_hook_t | pre_hook, |
| puk_mem_post_hook_t | post_hook | ||
| ) |
set hooks called before & after memory operations
◆ puk_abi_mem_set_invalidate_hook()
| void puk_abi_mem_set_invalidate_hook | ( | puk_mem_invalidate_hook_t | hook | ) |
set a hook called to invalidate memory
◆ puk_abi_mem_unset_invalidate_hook()
| void puk_abi_mem_unset_invalidate_hook | ( | puk_mem_invalidate_hook_t | hook | ) |
unset a hook called to invalidate memory
◆ puk_abi_set_errno_handler()
|
extern |
sets the errno location function
◆ puk_abi_set_spinlock_handlers()
|
extern |
sets the main spinlock handlers.
Set to NULL to cancel locks handlers.
Definition at line 231 of file puk-abi-tools.c.
References puk_spinlock_s::acquire, puk_spinlock, puk_spinlock_s::release, and puk_spinlock_s::trylock.
◆ puk_abi_unset_errno_handler()
|
extern |
remove the errno location function handler
◆ puk_abi_vfd_alloc()
|
extern |
◆ puk_abi_vfd_free()
|
extern |
◆ puk_mem_reg()
| const struct puk_mem_reg_s * puk_mem_reg | ( | void * | context, |
| const void * | ptr, | ||
| size_t | len | ||
| ) |
asks for memory registration- does nothing if registration has been cached
◆ puk_mem_set_handlers()
| void puk_mem_set_handlers | ( | puk_mem_register_t | reg, |
| puk_mem_unregister_t | unreg | ||
| ) |
sets handlers to register memory
◆ puk_mem_unreg()
| void puk_mem_unreg | ( | const struct puk_mem_reg_s * | reg | ) |
marks registration entry as 'unused'