The magic of #strace

A collogue of mine showed me some magic today.

Here is the magic command:

strace -ttt -fff -o rm rm /tmp/t

The result is like magic:

1455022679.446613 execve("/bin/rm", ["rm", "/tmp/t"], [/* 22 vars */]) = 0
1455022679.446786 brk(0)                = 0x19f4000
1455022679.446808 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1455022679.446829 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe98e690000
1455022679.446874 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
1455022679.446896 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
1455022679.446915 fstat(3, {st_mode=S_IFREG|0644, st_size=31854, ...}) = 0
1455022679.446930 mmap(NULL, 31854, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe98e688000
1455022679.446944 close(3)              = 0
1455022679.446958 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1455022679.446975 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
1455022679.446991 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\v\2\0\0\0\0\0"..., 832) = 832
1455022679.447005 fstat(3, {st_mode=S_IFREG|0755, st_size=1869392, ...}) = 0
1455022679.447020 mmap(NULL, 3972864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe98e0a5000
1455022679.447035 mprotect(0x7fe98e265000, 2097152, PROT_NONE) = 0
1455022679.447050 mmap(0x7fe98e465000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7fe98e465000
1455022679.447070 mmap(0x7fe98e46b000, 16128, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe98e46b000
1455022679.447089 close(3)              = 0
1455022679.447111 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe98e687000
1455022679.447127 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe98e686000
1455022679.447141 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe98e685000
1455022679.447155 arch_prctl(ARCH_SET_FS, 0x7fe98e686700) = 0
1455022679.447213 mprotect(0x7fe98e465000, 16384, PROT_READ) = 0
1455022679.447233 mprotect(0x60d000, 4096, PROT_READ) = 0
1455022679.447249 mprotect(0x7fe98e692000, 4096, PROT_READ) = 0
1455022679.447264 munmap(0x7fe98e688000, 31854) = 0
1455022679.447336 brk(0)                = 0x19f4000
1455022679.447349 brk(0x1a15000)        = 0x1a15000
1455022679.447369 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
1455022679.447387 fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
1455022679.447402 mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe98dddc000
1455022679.447418 close(3)              = 0
1455022679.447462 ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
1455022679.447490 newfstatat(AT_FDCWD, "/tmp/t", {st_mode=S_IFREG|0644, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
1455022679.447517 geteuid()             = 0
1455022679.447529 unlinkat(AT_FDCWD, "/tmp/t", 0) = 0
1455022679.447568 lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
1455022679.447583 close(0)              = 0
1455022679.447596 close(1)              = 0
1455022679.447608 close(2)              = 0
1455022679.447620 exit_group(0)         = ?
1455022679.447670 +++ exited with 0 +++
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s