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) {
165
165
}
166
166
167
167
// 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)) {
169
169
signal->set_uid (*uid);
170
170
}
171
- if (auto gid = EventExtractor::get_gid (event)) {
171
+ if (const uint32_t * gid = event_extractor_-> get_uid (event)) {
172
172
signal->set_gid (*gid);
173
173
}
174
174
@@ -234,14 +234,8 @@ ProcessSignal* ProcessSignalFormatter::CreateProcessSignal(sinsp_threadinfo* tin
234
234
signal->set_pid (tinfo->m_pid );
235
235
236
236
// 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 );
245
239
246
240
// set time
247
241
auto timestamp = Allocate<Timestamp>();
@@ -372,10 +366,7 @@ void ProcessSignalFormatter::GetProcessLineage(sinsp_threadinfo* tinfo,
372
366
// Collapse parent child processes that have the same path
373
367
if (lineage.empty () || (lineage.back ().parent_exec_file_path () != pt->m_exepath )) {
374
368
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 );
379
370
info.set_parent_exec_file_path (pt->m_exepath );
380
371
lineage.push_back (info);
381
372
}
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ class EventExtractor {
136
136
TINFO_FIELD (exe);
137
137
TINFO_FIELD (exepath);
138
138
TINFO_FIELD (pid);
139
+ TINFO_FIELD_RAW (uid, m_uid, uint32_t );
140
+ TINFO_FIELD_RAW (gid, m_gid, uint32_t );
139
141
FIELD_CSTR (proc_args, " proc.args" );
140
142
141
143
// General event information
@@ -172,30 +174,6 @@ class EventExtractor {
172
174
173
175
return get_container_id (tinfo);
174
176
}
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
- }
199
177
};
200
178
201
179
} // namespace collector::system_inspector
You can’t perform that action at this time.
0 commit comments