Skip to content

Commit

Permalink
build: Make a few more functions const
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Aponte <[email protected]>
  • Loading branch information
federico-sysdig committed Dec 22, 2023
1 parent 99a8816 commit f4c5606
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ void sinsp::open_test_input(scap_test_input_data* data, sinsp_mode_t mode)

/*=============================== Engine related ===============================*/

bool sinsp::check_current_engine(const std::string& engine_name)
bool sinsp::check_current_engine(const std::string& engine_name) const
{
return scap_check_current_engine(m_h, engine_name.data());
}
Expand Down Expand Up @@ -1876,11 +1876,21 @@ scap_stats_v2* sinsp::get_sinsp_stats_v2_buffer()
return m_sinsp_stats_v2_buffer;
}

const scap_stats_v2* sinsp::get_sinsp_stats_v2_buffer() const
{
return m_sinsp_stats_v2_buffer;
}

std::shared_ptr<sinsp_stats_v2> sinsp::get_sinsp_stats_v2()
{
return m_sinsp_stats_v2;
}

std::shared_ptr<const sinsp_stats_v2> sinsp::get_sinsp_stats_v2() const
{
return m_sinsp_stats_v2;
}

sinsp_filter_check* sinsp::new_generic_filtercheck()
{
return new sinsp_filter_check_gen_event();
Expand Down
4 changes: 3 additions & 1 deletion userspace/libsinsp/sinsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,15 @@ class SINSP_PUBLIC sinsp : public capture_stats_source
\note sinsp stats may be refactored near-term.
*/
scap_stats_v2* get_sinsp_stats_v2_buffer();
const scap_stats_v2* get_sinsp_stats_v2_buffer() const;

/*!
\brief Return sinsp stats v2 containing continually updated counters around thread and fd state tables.
\note sinsp stats may be refactored near-term.
*/
std::shared_ptr<sinsp_stats_v2> get_sinsp_stats_v2();
std::shared_ptr<const sinsp_stats_v2> get_sinsp_stats_v2() const;

/*!
\brief Look up a thread given its tid and return its information,
Expand Down Expand Up @@ -862,7 +864,7 @@ class SINSP_PUBLIC sinsp : public capture_stats_source
* @param engine_name engine that we want to check.
* @return true if the passed engine is the active one otherwise false.
*/
bool check_current_engine(const std::string& engine_name);
bool check_current_engine(const std::string& engine_name) const;

/*=============================== Engine related ===============================*/

Expand Down

0 comments on commit f4c5606

Please sign in to comment.