-};
-#define G (*(struct globals*)&bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
-
-
-static dev_t find_socket_dev(void)
-{
- int fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd >= 0) {
- struct stat buf;
- int r = fstat(fd, &buf);
- close(fd);
- if (r == 0)
- return buf.st_dev;
- }
- return 0;
-}
-
-static char *parse_net_arg(const char *arg, unsigned *port)
-{
- char path[20], tproto[5];
-
- if (sscanf(arg, "%u/%4s", port, tproto) != 2)
- return NULL;
- sprintf(path, "/proc/net/%s", tproto);
- if (access(path, R_OK) != 0)
- return NULL;
- return xstrdup(path);
-}
-
-static void add_pid(const pid_t pid)
-{
- pid_list **curr = &G.pid_list_head;
-
- while (*curr) {
- if ((*curr)->pid == pid)
- return;
- curr = &(*curr)->next;
- }
-
- *curr = xzalloc(sizeof(pid_list));
- (*curr)->pid = pid;
-}