I am using strace
to track a program. In this line:
recvfrom(7, "\0\260R\0\0\1\364\6\215\r\257\330\210\341\0\270\240\0\260R\0\0\0\0\0\0\0\0\0\0\0\0"..., 3000, 0, {sa_family=AF_PACKET, proto=0x88e1, if4, pkttype=PACKET_OUTGOING, addr(6)={1, f4068d0dafd8}, [18]) = 60
the first seven is the file descriptor used to read (seen here).
Can I discover who opened that socket? I know that processes keep in /proc (I think?) their list of open files. So, could I find in the list of all processess who has that fd opened or something similar?
Thanks
/proc/$pid/fd
orlsof
, but I don't this you can determine who "opened" that fd. - For a process to access a fd it has to open it on its own. – michas Jun 05 '15 at 11:44strace
, look what operation returned fd 7 for more information (trygrep '^open.* = 7$'
first). Since it hassa_family=AF_PACKET
, I'd say this is your process communicating with a device. – lcd047 Jun 05 '15 at 14:14netstat -ap
(requires root to see the program name). – ott-- Jun 07 '15 at 01:06