int get_preload_probe(struct msg_buf *mb, struct probe_info *pi)
{
u64 handler;
- u8 type;
+ u8 flags;
print_parse_debug("funct handler:");
if (get_u64(mb, &handler)) {
return -EINVAL;
}
- print_parse_debug("collect events type:");
- if (get_u8(mb, &type)) {
+ print_parse_debug("collect events flag:");
+ if (get_u8(mb, &flags)) {
print_err("failed to read collect events type\n");
return -EINVAL;
}
pi->probe_type = SWAP_PRELOAD_PROBE;
pi->size = sizeof(pi->pl_i) + sizeof(pi->probe_type) + sizeof(pi->size);
pi->pl_i.handler = handler;
- pi->pl_i.type = type;
+ pi->pl_i.flags = flags;
return 0;
}
if (__is_instrumented(caller))
return INTERNAL_CALL;
- if (ip->info->pl_i.type & SWAP_PRELOAD_ALWAYS)
+ if (ip->info->pl_i.flags & SWAP_PRELOAD_ALWAYS_RUN)
return EXTERNAL_CALL;
return NOT_INSTRUMENTED;
static inline bool __is_probe_non_block(struct us_ip *ip)
{
- if (!(ip->info->pl_i.type & (0x1 << 1)))
+ if (ip->info->pl_i.flags & SWAP_PRELOAD_NON_BLOCK_PROBE)
return true;
return false;
/* jump only if caller is instumented and it is not a system lib -
* this leads to some errors */
- if (__not_system_caller(current, cvma) && ct &&
+ if (__not_system_caller(current, cvma) && ct != NOT_INSTRUMENTED &&
!__is_handlers_call(cvma)) {
if (preload_threads_set_data(current,
caddr, ct,
#ifndef __PRELOAD_PROBE_H__
#define __PRELOAD_PROBE_H__
-/* Probe type, specifies when probe should be ran. */
-enum preload_probe_type_t {
- SWAP_PRELOAD_INTERNAL_CALL = 0, /* Run probe only when it is called from
- target binaries. */
- SWAP_PRELOAD_ALWAYS = 1, /* Run probe always. */
- SWAP_PRELOAD_DISABLE_HANDLING = 2 /* Disable handlers execution. */
+/* Probe flags description:
+ *
+ * 0 - handler is ran only when probe has fired from a target binary;
+ * 1 - handler is always ran;
+ *
+ * 00 - probe is disabling internal probes;
+ * 10 - probe is non blocking one;
+ */
+
+enum {
+ SWAP_PRELOAD_ALWAYS_RUN = (1 << 0),
+ SWAP_PRELOAD_NON_BLOCK_PROBE = (1 << 1)
};
/* Preload probe info. */
struct preload_info {
unsigned long handler; /* Handler offset in probe library. */
- enum preload_probe_type_t type; /* Preload probe type. */
+ unsigned char flags; /* Preload probe flags. */
};
/* Get caller probe info */