Linux系统工具:strace
本文最后更新于:2022年9月4日 下午
系统调用简介
进程通过系统调用使用内核服务。系统调用会进入内核,让内核执行服务然后返回
一些常见的系统调用:
系统调用 | 描述 |
---|---|
fork() | 创建进程 |
exit() | 结束当前进程 |
wait() | 等待子进程结束 |
exec(filename, *argv) | 加载并执行一个文件 |
open(filename, flags) | 打开文件,flags 指定读/写模式 |
read(fd, buf, n) | 从文件中读 n 个字节到 buf |
write(fd, buf, n) | 从 buf 中写 n 个字节到文件 |
close(fd) | 关闭打开的 fd |
unlink(filename) | 删除文件 |
strace的常见用法
strace可以使你在不知道程序源代码的情况下跟踪应用程序的系统调用
让我们打开tldr查看strace的常见用法:
1 |
|
打印出运行echo wdnmd
过程的系统调用:
Linux系统工具:strace
http://gls.show/p/d936e762/