Skip to content

Commit

Permalink
cleanup(scap): remove proclist from vtable->get_proc
Browse files Browse the repository at this point in the history
It was always unclear (to me) what the proclist is used for, exactly.
It turns out it's just a holder for the callback which was ignored
in the previous implementation and now is replaced by a completely
different temporary proclist.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
  • Loading branch information
gnosek committed Nov 4, 2023
1 parent cd48322 commit 6ddf820
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion userspace/libscap/linux/scap_linux_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int32_t scap_linux_create_iflist(struct scap_platform* platform);
int32_t scap_linux_create_userlist(struct scap_platform* platform);

uint32_t scap_linux_get_device_by_mount_id(struct scap_platform* platform, const char *procdir, unsigned long requested_mount_id);
struct scap_threadinfo* scap_linux_proc_get(struct scap_platform* platform, struct scap_proclist* proclist, int64_t tid, bool scan_sockets);
struct scap_threadinfo* scap_linux_proc_get(struct scap_platform* platform, int64_t tid, bool scan_sockets);
int32_t scap_linux_refresh_proc_table(struct scap_platform* platform, struct scap_proclist* proclist);
bool scap_linux_is_thread_alive(struct scap_platform* platform, int64_t pid, int64_t tid, const char* comm);
int32_t scap_linux_getpid_global(struct scap_platform* platform, int64_t *pid, char* error);
Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/linux/scap_procs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ int32_t scap_linux_getpid_global(struct scap_platform* platform, int64_t *pid, c
return scap_errprintf(error, 0, "could not find tgid in status file %s", filename);
}

struct scap_threadinfo* scap_linux_proc_get(struct scap_platform* platform, struct scap_proclist* proclist, int64_t tid, bool scan_sockets)
struct scap_threadinfo* scap_linux_proc_get(struct scap_platform* platform, int64_t tid, bool scan_sockets)
{
struct scap_linux_platform* linux_platform = (struct scap_linux_platform*)platform;

Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/scap_platform_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct scap_threadinfo* scap_proc_get(scap_t* handle, int64_t tid, bool scan_soc
{
if (handle && handle->m_platform && handle->m_platform->m_vtable->get_proc)
{
return handle->m_platform->m_vtable->get_proc(handle->m_platform, &handle->m_platform->m_proclist, tid, scan_sockets);
return handle->m_platform->m_vtable->get_proc(handle->m_platform, tid, scan_sockets);
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/scap_platform_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct scap_platform_vtable
// XXX this is Linux-specific
uint32_t (*get_device_by_mount_id)(struct scap_platform*, const char *procdir, unsigned long requested_mount_id);

struct scap_threadinfo* (*get_proc)(struct scap_platform*, struct scap_proclist* proclist, int64_t tid, bool scan_sockets);
struct scap_threadinfo* (*get_proc)(struct scap_platform*, int64_t tid, bool scan_sockets);

int32_t (*refresh_proc_table)(struct scap_platform*, struct scap_proclist* proclist);
bool (*is_thread_alive)(struct scap_platform*, int64_t pid, int64_t tid, const char* comm);
Expand Down

0 comments on commit 6ddf820

Please sign in to comment.