**I want to determine which process has the other end of a UNIX socket.** 

Specifically, I'm asking about one that was created with `socketpair()`, though the problem is the same for any UNIX socket.

I have a program `parent` which creates a `socketpair(AF_UNIX, SOCK_STREAM, 0, fds)`, and `fork()`s. The parent process closes `fds[1]` and keeps `fds[0]` to communicate. The child does the opposite, `close(fds[0]); s=fds[1]`. Then the child `exec()`s another program, `child1`. The two can communicate back and forth via this socketpair.

Now, let's say I know who `parent` is, but I want to figure out who `child1` is. How do I do this? 

There are several tools at my disposal, but none can tell me which process is on the other end of the socket. I have tried: 

* `lsof -c progname`
* `lsof -c parent -c child1`
* `ls -l /proc/$(pidof server)/fd`
* `cat /proc/net/unix`

Basically, I can see the two sockets, and everything about them, but cannot tell that they are connected. I am trying to determine which FD in the parent is communicating with which child process.