zuntan02のはてなブログ

備忘録的なものです

【メモ】strace

https://blogs.oracle.com/solairo/entry/ksplice_strace
Strace -- システム管理者の顕微鏡

ex.netstat -a コマンドを実行するときに読み込まれるファイルとか見てみる。/etc/servicesが読み込まれていた

strace -e open netstat -a

open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libselinux.so.1", O_RDONLY)  = 3
open("/lib/libc.so.6", O_RDONLY)        = 3
open("/lib/libdl.so.2", O_RDONLY)       = 3
open("/lib/libsepol.so.1", O_RDONLY)    = 3
open("/etc/selinux/config", O_RDONLY|O_LARGEFILE) = 3
open("/proc/mounts", O_RDONLY|O_LARGEFILE) = 3
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
open("/proc/net/tcp", O_RDONLY)         = 3
open("/etc/nsswitch.conf", O_RDONLY)    = 4
open("/etc/ld.so.cache", O_RDONLY)      = 4
open("/lib/libnss_files.so.2", O_RDONLY) = 4
open("/etc/services", O_RDONLY)         = 4
open("/etc/protocols", O_RDONLY)        = 4
tcp        0      0 *:mysql                     *:*                         LISTEN
tcp        0      0 *:pop3                      *:*                         LISTEN
tcp        0      0 *:http                      *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 *:smtp                      *:*                         LISTEN
open("/etc/resolv.conf", O_RDONLY)      = 4
open("/etc/host.conf", O_RDONLY)        = 4
open("/etc/hosts", O_RDONLY)            = 4
open("/etc/hosts", O_RDONLY)            = 4
open("/etc/ld.so.cache", O_RDONLY)      = 4
open("/lib/libnss_dns.so.2", O_RDONLY)  = 4
open("/lib/libresolv.so.2", O_RDONLY)   = 4
tcp        0   1388 www34237u.sakura.ne.jp:ssh  219.117.253.234.stati:60168 ESTABLISHED
open("/proc/net/tcp6", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/proc/net/udp", O_RDONLY)         = 3
udp        0      0 www34237u.sakura.ne.jp:ntp  *:*
open("/etc/hosts", O_RDONLY)            = 4
udp        0      0 localhost.localdomain:ntp   *:*
udp        0      0 *:ntp                       *:*
open("/proc/net/udp6", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/proc/net/sctp/eps", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/proc/net/sctp/assocs", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/proc/net/raw", O_RDONLY)         = 3
open("/proc/net/raw6", O_RDONLY)        = -1 ENOENT (No such file or directory)
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
open("/proc/net/unix", O_RDONLY)        = 3
unix  2      [ ACC ]     STREAM     LISTENING     3484   @ISCSIADM_ABSTRACT_NAMESPACE
unix  2      [ ACC ]     STREAM     LISTENING     3470   @ISCSID_UIP_ABSTRACT_NAMESPACE
unix  7      [ ]         DGRAM                    3688   /dev/log
unix  2      [ ]         DGRAM                    1190   @/org/kernel/udev/udevd
unix  2      [ ACC ]     STREAM     LISTENING     3768   /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     3878   /var/lib/mysql/mysql.sock
unix  2      [ ]         DGRAM                    28790175
unix  3      [ ]         STREAM     CONNECTED     28790119
unix  3      [ ]         STREAM     CONNECTED     28790118
unix  2      [ ]         DGRAM                    28790113
unix  2      [ ]         DGRAM                    3990
unix  2      [ ]         DGRAM                    3909
unix  2      [ ]         DGRAM                    3696
open("/proc/net/ipx", O_RDONLY)         = -1 ENOENT (No such file or directory)
open("/proc/net/ax25", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/proc/net/x25", O_RDONLY)         = -1 ENOENT (No such file or directory)
open("/proc/net/x25", O_RDONLY)         = -1 ENOENT (No such file or directory)
open("/proc/net/nr", O_RDONLY)          = -1 ENOENT (No such file or directory)
広告を非表示にする