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))

2 Answers 2

2

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

1
  • Thanks. Unfortunately this is not documented in either manpage or html doc. I will look it up in the source code. Jun 9, 2011 at 6:20
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .