staticint
trace_inject_entry(struct trace_event_file *file, void *rec, int len)
{ struct trace_event_buffer fbuffer; int written = 0; void *entry;
rcu_read_lock_sched();
entry = trace_event_buffer_reserve(&fbuffer, file, len); if (entry) {
memcpy(entry, rec, len);
written = len;
trace_event_buffer_commit(&fbuffer);
}
rcu_read_unlock_sched();
return written;
}
staticint
parse_field(char *str, struct trace_event_call *call, struct ftrace_event_field **pf, u64 *pv)
{ struct ftrace_event_field *field; char *field_name; int s, i = 0; int len;
u64 val;
if (!str[i]) return 0; /* First find the field to associate to */ while (isspace(str[i]))
i++;
s = i; while (isalnum(str[i]) || str[i] == '_')
i++;
len = i - s; if (!len) return -EINVAL;
field_name = kmemdup_nul(str + s, len, GFP_KERNEL); if (!field_name) return -ENOMEM;
field = trace_find_event_field(call, field_name);
kfree(field_name); if (!field) return -ENOENT;
*pf = field; while (isspace(str[i]))
i++; if (str[i] != '=') return -EINVAL;
i++; while (isspace(str[i]))
i++;
s = i; if (isdigit(str[i]) || str[i] == '-') { char *num, c; int ret;
/* Make sure the field is not a string */ if (is_string_field(field)) return -EINVAL;
if (str[i] == '-')
i++;
/* We allow 0xDEADBEEF */ while (isalnum(str[i]))
i++;
num = str + s;
c = str[i]; if (c != '\0' && !isspace(c)) return -EINVAL;
str[i] = '\0'; /* Make sure it is a value */ if (field->is_signed)
ret = kstrtoll(num, 0, &val); else
ret = kstrtoull(num, 0, &val);
str[i] = c; if (ret) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.