Bug#261380:

Benot Dejean TazForEver@dlfp.org, 261380@bugs.debian.org
Sun, 19 Sep 2004 17:24:38 +0200


--=-iZzkYWShBiH/2f9SIobl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

hi, could you compile the attached C program and send back its output ?
please also send your 'df' output.

(you need gcc libgtop2-dev pkg-config)

to compile:
gcc $(pkg-config --cflags --libs libgtop-2.0) sparc64.c

to run:
./a.out

thank you.

--=20
Beno=C3=AEt Dejean
JID: TazForEver@jabber.org
gDesklets http://gdesklets.gnomedesktop.org
LibGTop http://directory.fsf.org/libgtop.html
http://www.paulla.asso.fr

--=-iZzkYWShBiH/2f9SIobl
Content-Disposition: attachment; filename=sparc64.c
Content-Type: text/x-csrc; name=sparc64.c; charset=UTF-8
Content-Transfer-Encoding: 7bit

#include <glibtop.h>

#include <glibtop/fsusage.h>
#include <glibtop/mountlist.h>

#include <stdio.h>
#include <stddef.h>


#define buf_offsetof(MEMBER) ((ptrdiff_t)&(buf.MEMBER) - (ptrdiff_t)&buf)

#define HEADER_PPRINT(FUNC) printf(#FUNC "\tsizeof = %lu B\n", \
(unsigned long) sizeof buf)

#define PPRINT(DATA, FORMAT) printf("\t%4lu B %3lu " #DATA " = " FORMAT "\n", \
(unsigned long) sizeof buf.DATA, (unsigned long) buf_offsetof(DATA), buf.DATA)

#define PPRINT_ARRAY(ARRAY, SIZE, FORMAT) do { \
size_t i; \
printf("\t%4lu B %3lu " #ARRAY "[%lu] = { ", \
(unsigned long) sizeof buf.ARRAY, (unsigned long) buf_offsetof(ARRAY),\
(unsigned long) G_N_ELEMENTS(buf.ARRAY)); \
for(i = 0; i < (SIZE - 1); ++i) printf(".%u = " FORMAT ", ", i, buf.ARRAY[i]); \
printf(".%u = " FORMAT " }\n", SIZE - 1 , buf.ARRAY[SIZE - 1]); \
} while(0)

#define FOOTER_PPRINT() putchar('\n')



static void pprint_get_fsusage(const char *mountpoint)
{
  glibtop_fsusage buf;

  glibtop_get_fsusage(&buf, mountpoint);

  HEADER_PPRINT(glibtop_get_fsusage);
  PPRINT(flags, "%#llx");
  PPRINT(blocks, "%llu");
  PPRINT(bfree, "%llu");
  PPRINT(bavail, "%llu");
  PPRINT(files, "%llu");
  PPRINT(ffree, "%llu");
  PPRINT(block_size, "%u");
  PPRINT(read, "%llu");
  PPRINT(write, "%llu");
  FOOTER_PPRINT();
}



static void pprint_get_mountlist(gboolean allfs)
{
  glibtop_mountlist buf;
  glibtop_mountentry *entries;
  size_t i;

  entries = glibtop_get_mountlist(&buf, allfs);

  HEADER_PPRINT(glibtop_get_mountlist);
  PPRINT(flags, "%#llx");
  PPRINT(number, "%llu");
  PPRINT(total, "%llu");
  PPRINT(size, "%llu");

  printf("\t%4llu B entries[%llu] = \n\t\t{\n", buf.total, buf.number);

  for(i = 0; i < buf.number; ++i)
    {
      printf("\t\t .%lu = { .dev = %#llx,"
	     " .devname = \"%s\","
	     " .mountir = \"%s\","
	     " .type - \"%s\" }\n",
	     (unsigned long) i, entries[i].dev,
	     entries[i].devname,
	     entries[i].mountdir,
	     entries[i].type);
    }

  printf("\t\t}\n");
  FOOTER_PPRINT();

  g_free(entries);
}


int main()
{
  glibtop_mountlist buf;
  glibtop_mountentry *entries;
  size_t i;

  pprint_get_mountlist(TRUE);
  pprint_get_mountlist(FALSE);

  entries = glibtop_get_mountlist(&buf, FALSE);

  for(i = 0; i < buf.number; ++i)
    {
      puts(entries[i].mountdir);
      pprint_get_fsusage(entries[i].mountdir);
    }

  g_free(entries);

  return 0;
}

--=-iZzkYWShBiH/2f9SIobl--