File tree Expand file tree Collapse file tree 2 files changed +7
-38
lines changed Expand file tree Collapse file tree 2 files changed +7
-38
lines changed Original file line number Diff line number Diff line change @@ -165,10 +165,10 @@ ProcessSignal* ProcessSignalFormatter::CreateProcessSignal(sinsp_evt* event) {
165165 }
166166
167167 // set user and group id credentials
168- if (auto uid = EventExtractor:: get_uid (event)) {
168+ if (const uint32_t * uid = event_extractor_-> get_uid (event)) {
169169 signal->set_uid (*uid);
170170 }
171- if (auto gid = EventExtractor::get_gid (event)) {
171+ if (const uint32_t * gid = event_extractor_-> get_uid (event)) {
172172 signal->set_gid (*gid);
173173 }
174174
@@ -234,14 +234,8 @@ ProcessSignal* ProcessSignalFormatter::CreateProcessSignal(sinsp_threadinfo* tin
234234 signal->set_pid (tinfo->m_pid );
235235
236236 // set user and group id credentials
237- auto uid = EventExtractor::get_uid (tinfo);
238- if (uid) {
239- signal->set_uid (*uid);
240- }
241- auto gid = EventExtractor::get_gid (tinfo);
242- if (gid) {
243- signal->set_gid (*gid);
244- }
237+ signal->set_uid (tinfo->m_uid );
238+ signal->set_gid (tinfo->m_gid );
245239
246240 // set time
247241 auto timestamp = Allocate<Timestamp>();
@@ -372,10 +366,7 @@ void ProcessSignalFormatter::GetProcessLineage(sinsp_threadinfo* tinfo,
372366 // Collapse parent child processes that have the same path
373367 if (lineage.empty () || (lineage.back ().parent_exec_file_path () != pt->m_exepath )) {
374368 LineageInfo info;
375- auto uid = EventExtractor::get_uid (pt);
376- if (uid) {
377- info.set_parent_uid (*uid);
378- }
369+ info.set_parent_uid (pt->m_uid );
379370 info.set_parent_exec_file_path (pt->m_exepath );
380371 lineage.push_back (info);
381372 }
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ class EventExtractor {
136136 TINFO_FIELD (exe);
137137 TINFO_FIELD (exepath);
138138 TINFO_FIELD (pid);
139+ TINFO_FIELD_RAW (uid, m_uid, uint32_t );
140+ TINFO_FIELD_RAW (gid, m_gid, uint32_t );
139141 FIELD_CSTR (proc_args, " proc.args" );
140142
141143 // General event information
@@ -172,30 +174,6 @@ class EventExtractor {
172174
173175 return get_container_id (tinfo);
174176 }
175-
176- static std::optional<uint32_t > get_uid (sinsp_threadinfo* tinfo) {
177- return tinfo->m_uid ;
178- }
179-
180- static std::optional<uint32_t > get_uid (sinsp_evt* evt) {
181- auto * tinfo = evt->get_tinfo ();
182- if (tinfo == nullptr ) {
183- return {};
184- }
185- return get_uid (tinfo);
186- }
187-
188- static std::optional<uint32_t > get_gid (sinsp_threadinfo* tinfo) {
189- return tinfo->m_gid ;
190- }
191-
192- static std::optional<uint32_t > get_gid (sinsp_evt* evt) {
193- auto * tinfo = evt->get_tinfo ();
194- if (tinfo == nullptr ) {
195- return {};
196- }
197- return get_gid (tinfo);
198- }
199177};
200178
201179} // namespace collector::system_inspector
You can’t perform that action at this time.
0 commit comments