Exemple #1
0
static LONGEST
linux_xfer_osdata_isockets (gdb_byte *readbuf,
			    ULONGEST offset, LONGEST len)
{
  static const char *buf;
  static LONGEST len_avail = -1;
  static struct buffer buffer;

  if (offset == 0)
    {
      if (len_avail != -1 && len_avail != 0)
	buffer_free (&buffer);
      len_avail = 0;
      buf = NULL;
      buffer_init (&buffer);
      buffer_grow_str (&buffer, "<osdata type=\"I sockets\">\n");

      print_sockets (AF_INET, 1, &buffer);
      print_sockets (AF_INET, 0, &buffer);
      print_sockets (AF_INET6, 1, &buffer);
      print_sockets (AF_INET6, 0, &buffer);

      buffer_grow_str0 (&buffer, "</osdata>\n");
      buf = buffer_finish (&buffer);
      len_avail = strlen (buf);
    }

  if (offset >= len_avail)
    {
      /* Done.  Get rid of the buffer.  */
      buffer_free (&buffer);
      buf = NULL;
      len_avail = 0;
      return 0;
    }

  if (len > len_avail - offset)
    len = len_avail - offset;
  memcpy (readbuf, buf + offset, len);

  return len;
}
Exemple #2
0
void shows(char *str)
	{
	print_sockets();
	}