INIT_LIST_HEAD(&ut->consumers);
INIT_LIST_HEAD(&ut->processes);
ret = stap_register_task_finder_target(&ut->finder);
- if (!ret)
- ret = kern_path(ut->filename, LOOKUP_FOLLOW, &path);
- if (!ret) {
- ut->inode = igrab(path.dentry->d_inode);
- if (!ut->inode)
- ret = -EINVAL;
+ if (ret != 0) {
+ _stp_error("Couldn't register task finder target for file '%s': %d\n",
+ ut->filename, ret);
+ break;
}
- if (ret)
+
+ ret = kern_path(ut->filename, LOOKUP_FOLLOW, &path);
+ if (ret != 0) {
+ _stp_error("Couldn't lookup file '%s': %d\n",
+ ut->filename, ret);
break;
+ }
+
+ ut->inode = igrab(path.dentry->d_inode);
+ if (!ut->inode) {
+ _stp_error("Couldn't get inode for file '%s'\n",
+ ut->filename);
+ ret = -EINVAL;
+ break;
+ }
}
if (ret)
stapiu_put(targets, i);
struct stapiu_consumer *uc = &consumers[i];
ret = uprobe_register(uc->target->inode, uc->offset,
&uc->consumer);
- if (ret)
+ if (ret) {
+ _stp_error("probe %s registration error (rc %d)",
+ uc->probe->pp, ret);
break;
+ }
list_add(&uc->target_consumer, &uc->target->consumers);
}
if (ret)
{
if (probes.empty()) return;
s.op->newline() << "/* ---- inode uprobes ---- */";
+ // Let stapiu_init() handle reporting errors by setting probe_point
+ // to NULL.
+ s.op->newline() << "probe_point = NULL;";
s.op->newline() << "rc = stapiu_init ("
<< "stap_inode_uprobe_targets, "
<< "ARRAY_SIZE(stap_inode_uprobe_targets), "
// NB: this gives O(N**2) amount of code, but luckily there
// are only seven or eight derived_probe_groups, so it's ok.
o->newline() << "if (rc) {";
+ // If a probe types's emit_module_init() wants to handle error
+ // messages itself, it should set probe_point to NULL,
+ o->newline(1) << "if (probe_point)";
o->newline(1) << "_stp_error (\"probe %s registration error (rc %d)\", probe_point, rc);";
+ o->indent(-1);
// NB: we need to be in the error state so timers can shutdown cleanly,
// and so end probes don't run. OTOH, error probes can run.
o->newline() << "atomic_set (&session_state, STAP_SESSION_ERROR);";