Skip to content

Commit

Permalink
fix(libsinsp): parse dev and inode in all open-family events
Browse files Browse the repository at this point in the history
Signed-off-by: Gianmatteo Palmieri <[email protected]>
  • Loading branch information
mrgian authored and poiana committed Mar 20, 2024
1 parent f9e3009 commit 1ade13c
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,6 +2678,14 @@ void sinsp_parser::parse_open_openat_creat_exit(sinsp_evt *evt)
ino = evt->get_param(6)->as<uint64_t>();
}
}
else if(etype == PPME_SYSCALL_OPENAT2_X && evt->get_num_params() > 6)
{
dev = evt->get_param(6)->as<uint32_t>();
if (evt->get_num_params() > 7)
{
ino = evt->get_param(7)->as<uint64_t>();
}
}

//
// Compare with enter event parameters
Expand Down Expand Up @@ -2706,16 +2714,19 @@ void sinsp_parser::parse_open_openat_creat_exit(sinsp_evt *evt)
}
else if (etype == PPME_SYSCALL_OPEN_BY_HANDLE_AT_X)
{
/*
* Flags
*/
flags = evt->get_param(2)->as<uint32_t>();

/*
* Path
*/
name = evt->get_param(3)->as<std::string_view>();

if(etype == PPME_SYSCALL_OPEN_BY_HANDLE_AT_X && evt->get_num_params() > 4)
{
dev = evt->get_param(4)->as<uint32_t>();
if (evt->get_num_params() > 5)
{
ino = evt->get_param(5)->as<uint64_t>();
}
}

// since open_by_handle_at returns an absolute path we will always start at /
sdir = "";
}
Expand Down

0 comments on commit 1ade13c

Please sign in to comment.