usdt: Have Context::addsem_probe() nop if pid not specified
This makes bcc_usdt_addsem*() more consistent with the bcc_usdt_enable*()
interface where if a USDT::Context was not constructed with a pid the
semaphore enablement nops.
@@ -359,9 +359,13 @@ bool Context::addsem_probe(const std::string &provider_name,
int16_t val) {
Probe *found_probe = get_checked(provider_name, probe_name);
- if (found_probe != nullptr)
+ if (found_probe != nullptr) {
+ if (found_probe->need_enable())
return found_probe->add_to_semaphore(val);
+ return true;
+ }
+
return false;
}
