3

I use ss in iproute2 package to list sockets statistics. Using -p option can give me process information. Do you know what does the numbers shown mean? I can see that the first one is PID but not the last one.

Sample output:

ESTAB     0       0       192.168.1.2:59246  124.40.42.38:www    users:(("gweather-applet",1922,23))    
ESTAB     0       0       192.168.1.2:42612  72.14.213.16:imaps  users:(("thunderbird-bin",5553,45))
slm
  • 7,615
  • 16
  • 56
  • 76
Fish Monitor
  • 353
  • 3
  • 11

2 Answers2

2

The second number is a number of file descriptor associated with this connection in the process

Alex
  • 7,939
  • 6
  • 38
  • 52
1

As is shown in the implementation of ss :

static int find_users(unsigned ino, char *buf, int buflen)
{
  struct user_ent *p;
  int cnt = 0;
  char *ptr;

  if (!ino)
    return 0;

  p = user_ent_hash[user_ent_hashfn(ino)];
  ptr = buf;
  while (p) {
    if (p->ino != ino)
        goto next;

    if (ptr - buf >= buflen - 1)
        break;

    snprintf(ptr, buflen - (ptr - buf),
         "(\"%s\",%d,%d),",
         p->process, p->pid, p->fd);
    ptr += strlen(ptr);
    cnt++;

  next:
    p = p->next;
  }

  if (ptr != buf)
    ptr[-1] = '\0';

  return cnt;
}

the first number is p->pid, and the second is p->fd.

fibonacci
  • 111
  • 3