Created
July 6, 2016 06:16
-
-
Save syshack/e06cdd8d43acb9af41646d6398c73e6f to your computer and use it in GitHub Desktop.
全系统IO监控
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global file_read_top | |
global file_write_top | |
probe begin { | |
printf("Ctrl-C break\n") | |
} | |
probe syscall.read.return { | |
if ( $return > 0 ) { | |
file = @cast(task_current(), "task_struct")->files->fdt->fd[$fd] | |
filename = fullpath_struct_file(task_current(), file) | |
if ( filename != "" ) { | |
if ( (file->f_inode->i_mode & 0170000) == 0100000 ) { | |
file_read_top[pid(), execname(), filename] += $return | |
} | |
} | |
} | |
} | |
probe syscall.write.return { | |
if ( $return > 0 ) { | |
file = @cast(task_current(), "task_struct")->files->fdt->fd[$fd] | |
filename = fullpath_struct_file(task_current(), file) | |
if ( filename != "" ) { | |
if ( (file->f_inode->i_mode & 0170000) == 0100000 ) { | |
file_write_top[pid(), execname(), filename] += $return | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment