def process_inet()

in ambari-metrics-host-monitoring/src/main/python/psutil/psutil/_pslinux.py [0:0]


    def process_inet(self, file, family, type_, inodes, filter_pid=None):
        """Parse /proc/net/tcp* and /proc/net/udp* files."""
        if file.endswith('6') and not os.path.exists(file):
            # IPv6 not supported
            return
        f = open(file, 'rt')
        try:
            f.readline()  # skip the first line
            for line in f:
                _, laddr, raddr, status, _, _, _, _, _, inode = \
                    line.split()[:10]
                if inode in inodes:
                    # We assume inet sockets are unique, so we error
                    # out if there are multiple references to the
                    # same inode. We won't do this for UNIX sockets.
                    if len(inodes[inode]) > 1 and type_ != socket.AF_UNIX:
                        raise ValueError("ambiguos inode with multiple "
                                         "PIDs references")
                    pid, fd = inodes[inode][0]
                else:
                    pid, fd = None, -1
                if filter_pid is not None and filter_pid != pid:
                    continue
                else:
                    if type_ == socket.SOCK_STREAM:
                        status = TCP_STATUSES[status]
                    else:
                        status = _common.CONN_NONE
                    laddr = self.decode_address(laddr, family)
                    raddr = self.decode_address(raddr, family)
                    yield (fd, family, type_, laddr, raddr, status, pid)
        finally:
            f.close()