Skip to content

Commit

Permalink
cleanup(scap): define SECOND_TO_NS as ULL
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
  • Loading branch information
gnosek committed Jul 16, 2023
1 parent cd9d36e commit 8db5e54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion driver/capture_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ or GPL2.txt for full copies of the license.
#define BPF_HTTP_PREFIX 0x50545448

/* Convert seconds to nanoseconds */
#define SECOND_TO_NS 1000000000
#define SECOND_TO_NS 1000000000ULL
8 changes: 4 additions & 4 deletions userspace/libscap/linux/scap_procs.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ int32_t scap_proc_fill_pidns_start_ts(char* error, struct scap_threadinfo* tinfo
snprintf(proc_cmdline_pidns, sizeof(proc_cmdline_pidns), "%sroot/proc/1/cmdline", procdirname);
if(stat(proc_cmdline_pidns, &targetstat) == 0)
{
tinfo->pidns_init_start_ts = targetstat.st_ctim.tv_sec * (uint64_t) SECOND_TO_NS + targetstat.st_ctim.tv_nsec;
tinfo->pidns_init_start_ts = targetstat.st_ctim.tv_sec * SECOND_TO_NS + targetstat.st_ctim.tv_nsec;
return SCAP_SUCCESS;
}
else
Expand Down Expand Up @@ -480,8 +480,8 @@ int32_t scap_proc_fill_exe_ino_ctime_mtime(char* error, struct scap_threadinfo*
if(stat(exetarget, &targetstat) == 0)
{
tinfo->exe_ino = targetstat.st_ino;
tinfo->exe_ino_ctime = targetstat.st_ctim.tv_sec * (uint64_t) SECOND_TO_NS + targetstat.st_ctim.tv_nsec;
tinfo->exe_ino_mtime = targetstat.st_mtim.tv_sec * (uint64_t) SECOND_TO_NS + targetstat.st_mtim.tv_nsec;
tinfo->exe_ino_ctime = targetstat.st_ctim.tv_sec * SECOND_TO_NS + targetstat.st_ctim.tv_nsec;
tinfo->exe_ino_mtime = targetstat.st_mtim.tv_sec * SECOND_TO_NS + targetstat.st_mtim.tv_nsec;
}

return SCAP_SUCCESS;
Expand Down Expand Up @@ -822,7 +822,7 @@ static int32_t scap_proc_add_from_proc(struct scap_linux_platform* linux_platfor
snprintf(proc_cmdline, sizeof(proc_cmdline), "%scmdline", dir_name);
if(stat(proc_cmdline, &dirstat) == 0)
{
tinfo->clone_ts = dirstat.st_ctim.tv_sec * (uint64_t) SECOND_TO_NS + dirstat.st_ctim.tv_nsec;
tinfo->clone_ts = dirstat.st_ctim.tv_sec * SECOND_TO_NS + dirstat.st_ctim.tv_nsec;
}

// If tid is different from pid, assume this is a thread and that the FDs are shared, and set the
Expand Down

0 comments on commit 8db5e54

Please sign in to comment.