Updated to match new prototype.
* fsusage.c: (linux_2_6_0), (linux_2_4_0), (_glibtop_linux_get_fsusage_read_write): Updated to match new prototype.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2004-09-19 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
|
* fsusage.c: (linux_2_6_0), (linux_2_4_0),
|
||||||
|
(_glibtop_linux_get_fsusage_read_write): Updated to match new prototype.
|
||||||
|
|
||||||
2004-09-19 Benoît Dejean <tazforever@dlfp.org>
|
2004-09-19 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* mem.c: (glibtop_get_mem_s): Added missing memset( , 0, ).
|
* mem.c: (glibtop_get_mem_s): Added missing memset( , 0, ).
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void _glibtop_linux_get_fsusage_read_write(glibtop *server,
|
gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server,
|
||||||
glibtop_fsusage *buf,
|
glibtop_fsusage *buf,
|
||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
@@ -20,17 +20,16 @@ void _glibtop_linux_get_fsusage_read_write(glibtop *server,
|
|||||||
* linux/Documentation/iostats.txt
|
* linux/Documentation/iostats.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
static gboolean linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
||||||
{
|
{
|
||||||
FILE *mtab = setmntent("/etc/mtab", "r");
|
FILE *mtab = setmntent("/etc/mtab", "r");
|
||||||
|
|
||||||
struct mntent *emnt;
|
struct mntent *emnt;
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
while((emnt = getmntent(mtab)) != NULL)
|
while((emnt = getmntent(mtab)) != NULL)
|
||||||
{
|
{
|
||||||
if(strcmp(emnt->mnt_dir, path) != 0)
|
if(strcmp(emnt->mnt_dir, path) == 0)
|
||||||
continue;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char filename[64]; /* magic */
|
char filename[64]; /* magic */
|
||||||
|
|
||||||
@@ -76,28 +75,36 @@ static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
|||||||
buf->read = strtoull(p, &p, 0);
|
buf->read = strtoull(p, &p, 0);
|
||||||
p = skip_token(p);
|
p = skip_token(p);
|
||||||
buf->write = strtoull(p, &p, 0);
|
buf->write = strtoull(p, &p, 0);
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endmntent(mtab);
|
endmntent(mtab);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void linux_2_4_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
static gboolean linux_2_4_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _glibtop_linux_get_fsusage_read_write(glibtop *server,
|
gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server,
|
||||||
glibtop_fsusage *buf,
|
glibtop_fsusage *buf,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0))
|
||||||
{
|
{
|
||||||
linux_2_6_0(server, buf, path);
|
return linux_2_6_0(server, buf, path);
|
||||||
}
|
}
|
||||||
else if(server->os_version_code >= LINUX_VERSION_CODE(2, 4, 0))
|
else if(server->os_version_code >= LINUX_VERSION_CODE(2, 4, 0))
|
||||||
{
|
{
|
||||||
linux_2_4_0(server, buf, path);
|
return linux_2_4_0(server, buf, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user