Professional Web Applications Themes

lsof - find both endpoints of a unix socket? - Linux / Unix Administration

I'm stracing a process which shows that it is reading/writing from/to fd 3. lsof shows that fd 3 is a unix domain socket. kdesktop_ 9665 marc 3u unix 0xe0d32980 884489 socket How do I find the other end of this socket? Grep'ing the device (0xe0d32980) or the inode (884489) out of the system-wide lsof output yields only the line above. netstat doesn't give any help either. thanks /fc...

  1. #1

    Default lsof - find both endpoints of a unix socket?

    I'm stracing a process which shows that it is reading/writing from/to fd 3.
    lsof shows that fd 3 is a unix domain socket.

    kdesktop_ 9665 marc 3u unix 0xe0d32980 884489 socket

    How do I find the other end of this socket? Grep'ing the device
    (0xe0d32980) or the inode (884489) out of the system-wide lsof output
    yields only the line above.

    netstat doesn't give any help either.

    thanks
    /fc

    Frank Cusack Guest

  2. #2

    Default Re: lsof - find both endpoints of a unix socket?

    Frank Cusack <fcusackfcusack.com> writes:
    >I'm stracing a process which shows that it is reading/writing from/to fd 3.
    >lsof shows that fd 3 is a unix domain socket.
    > kdesktop_ 9665 marc 3u unix 0xe0d32980 884489 socket
    >How do I find the other end of this socket? Grep'ing the device
    >(0xe0d32980) or the inode (884489) out of the system-wide lsof output
    >yields only the line above.
    >netstat doesn't give any help either.
    The lsof part of the question might more appropriately have been
    directed to me, the lsof author, or to the lsof-l mailing list.

    As it is there isn't enough detail to form a precise answer, because
    the UNIX dialect on which lsof is being used is unknown, and the lsof
    revision is unknown.

    Those details matter because dialect UNIX domain socket implementation
    and internal details differ significantly, and because lsof revisions
    also differ.

    In the general case, an imprecise answer to your question is that, if
    the UNIX dialect's UNIX domain socket structures indicate the other
    endpoint of an open UNIX domain socket file, lsof will report its UNIX
    protocol control block address in the NAME column, and that same
    address will appear in the DEVICE column of endpoint's open file.

    For example, on 32 bit AIX 5.1 this might be reported as:

    COMMAND PID USER FD TYPE DEVICE ... NAME
    ...
    rmcd 11138 root 11u unix 0x70703200 ... ->0x70703000
    ...
    IBM.ERrmd 18836 root 6u unix 0x70703000 ... /var/ct/IW/soc/mc/RMIBM.ERRM.0
    ...

    The above example is interesting for another reason -- the IBM.ERrmd
    process has bound the /var/ct/IW/soc/mc/RMIBM.ERRM.0 path to the UNIX
    domain socket, while the rmcd process has not.

    Lsof reports UNIX domain socket information differently on other UNIX
    dialects. On Linux, for example, where lsof must use /proc/net/unix,
    all UNIX domain sockets have a bound path, but no endpoint information.
    Often there is no bound path. That often makes it impossible to
    determine the other endpoint, but it is a result of the Linux /proc
    file system implementation.

    Vic Abell, lsof author, <abepurdue.edu>
    Victor A Abell Guest

Similar Threads

  1. Replies: 3
    Last Post: April 18th, 06:24 PM
  2. Send Message over UNIX Socket
    By Didatus in forum PERL Miscellaneous
    Replies: 2
    Last Post: August 20th, 11:00 AM
  3. Replies: 1
    Last Post: August 11th, 07:53 PM
  4. How to find out installed packages on Unix
    By dtorreblanca0205 in forum PERL Modules
    Replies: 5
    Last Post: July 27th, 01:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139