Skip to content

Commit

Permalink
slove some conflict
Browse files Browse the repository at this point in the history
Signed-off-by: shangfan <[email protected]>
  • Loading branch information
sf1999817 committed Apr 22, 2024
1 parent 841dd62 commit ae2afbc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ int kprobe_vfs_write(struct pt_regs *ctx)

if(!e)
return 0;

//如果探测到的指针不为空
if(fd_ptr){
int fd = *fd_ptr;
Expand Down
1 change: 1 addition & 0 deletions eBPF_Supermarket/Filesystem_Subsystem/fs_watcher/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static int write_event(void *ctx, void *data, size_t data_sz)
strftime(ts, sizeof(ts), "%H:%M:%S", tm);
//获取文件真实路径
snprintf(path,sizeof(path),"/proc/self/fd/%d",e->fd);
//通过realpath来合并文件路径
char *real_path = realpath(path,NULL);
if(real_path != NULL){
printf("%-8s %-7d %-7ld %-7ld %-7s\n", ts, e->pid,e->real_count,e->count,real_path);
Expand Down
1 change: 1 addition & 0 deletions eBPF_Supermarket/Filesystem_Subsystem/fs_watcher/write.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
struct fs_t {
int fd;
int pid;

size_t real_count;
size_t count;
};
Expand Down

0 comments on commit ae2afbc

Please sign in to comment.