// tapset for begin/end/error/never
-// Copyright (C) 2005-2009 Red Hat Inc.
+// Copyright (C) 2005-2011 Red Hat Inc.
// Copyright (C) 2005-2007 Intel Corporation.
-// Copyright (C) 2008 James.Bottomley@HansenPartnership.com
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
return a->priority < b->priority;
}
+ // No assertion need be emitted, since these probes are allowed for
+ // unprivileged users.
+ void emit_privilege_assertion (translator_output*) {}
+
+ void print_dupe_stamp(ostream& o) { print_dupe_stamp_unprivileged (o); }
+
bool needs_global_locks () { return false; }
// begin/end probes don't need locks around global variables, since
// they aren't run concurrently with any other probes
literal_map_t const & parameters,
vector<derived_probe *> & finished_results)
{
- int64_t priority;
- if ((type == BEGIN && !get_param(parameters, TOK_BEGIN, priority)) ||
- (type == END && !get_param(parameters, TOK_END, priority)) ||
- (type == ERROR && !get_param(parameters, TOK_ERROR, priority)))
- priority = 0;
+ int64_t priority = 0;
+ if (type == BEGIN)
+ get_param(parameters, TOK_BEGIN, priority);
+ else if (type == END)
+ get_param(parameters, TOK_END, priority);
+ else if (type == ERROR)
+ get_param(parameters, TOK_ERROR, priority);
+
finished_results.push_back
(new be_derived_probe(base, location, type, priority));
}
+
+ virtual string name() { return "begin/end builder"; }
};
if (! s.be_derived_probes)
s.be_derived_probes = new be_derived_probe_group ();
s.be_derived_probes->enroll (this);
+ this->group = s.be_derived_probes;
}
sort(probes.begin(), probes.end(), be_derived_probe::comp);
s.op->newline() << "static struct stap_be_probe {";
- s.op->newline(1) << "void (*ph)(struct context*);";
- s.op->newline() << "const char* pp;";
+ s.op->newline(1) << "const struct stap_probe * const probe;";
s.op->newline() << "int state, type;";
s.op->newline(-1) << "} stap_be_probes[] = {";
s.op->indent(1);
for (unsigned i=0; i < probes.size(); i++)
{
s.op->newline () << "{";
- s.op->line() << " .pp="
- << lex_cast_qstring (*probes[i]->sole_location()) << ",";
- s.op->line() << " .ph=&" << probes[i]->name << ",";
+ s.op->line() << " .probe=" << common_probe_init (probes[i]) << ",";
s.op->line() << " .state=" << states[probes[i]->type] << ",";
s.op->line() << " .type=" << probes[i]->type;
s.op->line() << " },";
s.op->newline() << "static void enter_be_probe (struct stap_be_probe *stp) {";
s.op->indent(1);
- common_probe_entryfn_prologue (s.op, "stp->state", "stp->pp", false);
- s.op->newline() << "(*stp->ph) (c);";
- common_probe_entryfn_epilogue (s.op, false);
+ common_probe_entryfn_prologue (s, "stp->state", "stp->probe",
+ "stp_probe_type_been", false);
+ s.op->newline() << "(*stp->probe->ph) (c);";
+ common_probe_entryfn_epilogue (s, false, otf_safe_context(s));
s.op->newline(-1) << "}";
}
struct never_derived_probe: public derived_probe
{
- never_derived_probe (probe* p): derived_probe (p) {}
never_derived_probe (probe* p, probe_point* l): derived_probe (p, l) {}
void join_group (systemtap_session&) { /* thus no probe_group */ }
+ void emit_privilege_assertion (translator_output*) {}
+ void print_dupe_stamp(ostream& o) { print_dupe_stamp_unprivileged (o); }
};
{
finished_results.push_back(new never_derived_probe(base, location));
}
+
+ virtual string name() { return "never builder"; }
};
match_node* root = s.pattern_root;
root->bind(TOK_BEGIN)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(BEGIN));
root->bind_num(TOK_BEGIN)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(BEGIN));
root->bind(TOK_END)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(END));
root->bind_num(TOK_END)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(END));
root->bind(TOK_ERROR)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(ERROR));
root->bind_num(TOK_ERROR)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new be_builder(ERROR));
root->bind(TOK_NEVER)
- ->allow_unprivileged()
+ ->bind_privilege(pr_all)
->bind(new never_builder());
}