我试图strace
在 linux 中运行我的程序。
这是示例输出:
brk(0) = 0x804b000
brk(0x806c000) = 0x806c000
open("test.txt", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0600, st_size=216, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7728000
read(3, "10\n10\n2\t3\t3\t5\t4\t7\t7\t2\t2\t7\t\n8\t3\t1"..., 4096) = 216
read(3, "", 4096) = 0
read(3, "", 4096) = 0
close(3) = 0
munmap(0xb7728000, 4096) = 0
**open(NULL, O_RDONLY) = -1 EFAULT (Bad address)**
dup(2) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fstat64(3, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7728000
**_llseek(3, 0, 0xbfc97a44, SEEK_CUR) = -1 ESPIPE (Illegal seek)**
write(3, "Can't open file!: Bad address\n", 30Can't open file!: Bad address
为什么我在这两行中遇到一些错误。这是什么**open(NULL, O_RDONLY)**
意思?