summaryrefslogtreecommitdiffstats
path: root/translate.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-08-31 19:29:55 +0000
committerfche <fche>2005-08-31 19:29:55 +0000
commitf9f77dcebfbee6d977e67510f8a1ec7f40d88899 (patch)
tree4a60ac2c4b7b08e99499a6f92374ffd29c31237b /translate.cxx
parent66c2c709aea4f049513c02b5f7c6174f1b7a50e8 (diff)
downloadsystemtap-steved-f9f77dcebfbee6d977e67510f8a1ec7f40d88899.tar.gz
systemtap-steved-f9f77dcebfbee6d977e67510f8a1ec7f40d88899.tar.xz
systemtap-steved-f9f77dcebfbee6d977e67510f8a1ec7f40d88899.zip
2005-08-31 Frank Ch. Eigler <fche@redhat.com>
* translate.cxx (visit_array_in, visit_arrayindex): Use write locks even for array reads, until PR 1275. (translate_pass): Add read_trylock -> write_trylock escalation.
Diffstat (limited to 'translate.cxx')
-rw-r--r--translate.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/translate.cxx b/translate.cxx
index 6e68e7e3..8c29b020 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1785,7 +1785,8 @@ c_unparser::visit_array_in (array_in* e)
{ // block used to control varlock_r lifespan
mapvar mvar = getmap (e->operand->referent, e->tok);
- varlock_r guard (*this, mvar);
+ // XXX: should be varlock_r, but runtime arrays reads mutate
+ varlock_w guard (*this, mvar);
o->newline() << mvar.seek (idx) << ";";
c_assign (res, mvar.exists(), e->tok);
}
@@ -2119,7 +2120,8 @@ c_unparser::visit_arrayindex (arrayindex* e)
{ // block used to control varlock_r lifespan
mapvar mvar = getmap (e->referent, e->tok);
- varlock_r guard (*this, mvar);
+ // XXX: should be varlock_r, but runtime arrays reads mutate
+ varlock_w guard (*this, mvar);
o->newline() << mvar.seek (idx) << ";";
c_assign (res, mvar.get(), e->tok);
}
@@ -2320,6 +2322,12 @@ translate_pass (systemtap_session& s)
// XXX
s.op->newline() << "#define KALLSYMS_LOOKUP_NAME \"\"";
s.op->newline() << "#define KALLSYMS_LOOKUP 0";
+ // some older kernels don't have read_trylock, so pessimize.
+ // XXX: maybe read_trylock is never actually necessary
+ // for deadlock avoidance
+ s.op->newline() << "#ifndef read_trylock";
+ s.op->newline() << "#define read_trylock write_trylock";
+ s.op->newline() << "#endif";
s.op->newline() << "#endif";
s.up->emit_common_header ();