-static void scan_proc_net(const char *path, unsigned port)
-{
- char line[MAX_LINE + 1];
- long long uint64_inode;
- unsigned tmp_port;
- FILE *f;
- struct stat st;
- int fd;
-
- /* find socket dev */
- st.st_dev = 0;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd >= 0) {
- fstat(fd, &st);
- close(fd);
- }
-
- f = fopen_for_read(path);
- if (!f)
- return;
-
- while (fgets(line, MAX_LINE, f)) {
- char addr[68];
- if (sscanf(line, "%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x "
- "%*x:%*x %*x %*d %*d %llu",
- addr, &tmp_port, &uint64_inode) == 3
- ) {
- int len = strlen(addr);
- if (len == 8 && (option_mask32 & OPT_IP6))
- continue;
- if (len > 8 && (option_mask32 & OPT_IP4))
- continue;
- if (tmp_port == port) {
- st.st_ino = uint64_inode;
- add_inode(&st);
- }
- }
- }
- fclose(f);
-}
-
-static int search_dev_inode(const struct stat *st)