diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2024-08-11 13:44:49 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2024-08-11 13:44:49 -0700 |
commit | f1525f45ae60fb788ea1e10344814b7dcaa89c12 (patch) | |
tree | 480b3c6df467c8dc7982ef985f62a31797f2ecf9 /libvmon | |
parent | 11a8202d6ee7d81d3137c0561713b7df61ed6bc7 (diff) |
libvmon: ensure dtor invocations only return dtor codes
libvmon's internal api for samplers is extremely ad-hoc and
implicit.
This was done at the time to keep the source compact and have the
sampler ctor/dtor branches commingled immediately adjacent to
eachother... the thinking being this would help keep them in sync
as the code evolved. The ctor branches generally open fds and
allocate resources, with the dtor intended to undo those things.
With them kept more or less in the same page of code, it /should/
be obvious when one changes the other must as well.
In the long-term it probably makes sense to just explode this api
to something more formal and step back from those assumptions.
In lieu of doing such a refactor, let's improve the situation by
asserting the return codes at least stay within the expected
range. i.e. let's abort when a sample_changed/unchanged/error
return code comes from an dtor invocation, since this implies a
program error where someone isn't handling the implicit dtor
branches properly, instead falling through sampling paths.
Diffstat (limited to 'libvmon')
0 files changed, 0 insertions, 0 deletions