Importing FreeBSD port of libgtop from Josh Sled.

This commit is contained in:
Martin Baulig
1998-08-06 23:34:50 +00:00
parent 864867aeeb
commit 79f5a9c667
20 changed files with 554 additions and 244 deletions

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
The Gnome Top Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -22,10 +22,28 @@
#include <config.h>
#include <glibtop/loadavg.h>
#include <stdlib.h>
/* Provides load averange. */
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
void
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
{
memset (buf, 0, sizeof (glibtop_loadavg));
double ldavg[3];
glibtop_init_r (&server);
memset (buf, 0, sizeof (glibtop_loadavg));
getloadavg(ldavg, 3);
/* fill in the struct */
buf->flags = _glibtop_sysdeps_loadavg;
for (int i=0; i<3; i++) {
buf->loadavg[i] = ldavg[i];
} /* end for */
}