New upstream version 2.41.2

This commit is contained in:
Jeremy Bícha
2024-01-11 10:28:24 -05:00
249 changed files with 16473 additions and 11738 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
EXTRA_DIST = procmap_smaps.gperf procmap_smaps.c
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c disk.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
+43 -32
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -91,8 +91,9 @@ build_triplet = @build@
host_triplet = @host@
subdir = sysdeps/linux
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/build-to-host.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \
$(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
@@ -112,13 +113,14 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libgtop_sysdeps_2_0_la_DEPENDENCIES =
am_libgtop_sysdeps_2_0_la_OBJECTS = open.lo close.lo cpu.lo mem.lo \
swap.lo uptime.lo loadavg.lo shm_limits.lo msg_limits.lo \
sem_limits.lo proclist.lo procstate.lo procuid.lo proctime.lo \
procmem.lo procsignal.lo prockernel.lo procsegment.lo \
procargs.lo procmap.lo siglist.lo sysinfo.lo netload.lo ppp.lo \
glibtop_private.lo mountlist.lo procaffinity.lo procio.lo \
fsusage.lo netlist.lo procopenfiles.lo procwd.lo
am_libgtop_sysdeps_2_0_la_OBJECTS = open.lo close.lo cpu.lo disk.lo \
mem.lo swap.lo uptime.lo loadavg.lo shm_limits.lo \
msg_limits.lo sem_limits.lo proclist.lo procstate.lo \
procuid.lo proctime.lo procmem.lo procsignal.lo prockernel.lo \
procsegment.lo procargs.lo procmap.lo siglist.lo sysinfo.lo \
netload.lo ppp.lo glibtop_private.lo mountlist.lo \
procaffinity.lo procio.lo fsusage.lo netlist.lo \
procopenfiles.lo procwd.lo
libgtop_sysdeps_2_0_la_OBJECTS = $(am_libgtop_sysdeps_2_0_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -144,22 +146,22 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/close.Plo ./$(DEPDIR)/cpu.Plo \
./$(DEPDIR)/fsusage.Plo ./$(DEPDIR)/glibtop_private.Plo \
./$(DEPDIR)/loadavg.Plo ./$(DEPDIR)/mem.Plo \
./$(DEPDIR)/mountlist.Plo ./$(DEPDIR)/msg_limits.Plo \
./$(DEPDIR)/netlist.Plo ./$(DEPDIR)/netload.Plo \
./$(DEPDIR)/open.Plo ./$(DEPDIR)/ppp.Plo \
./$(DEPDIR)/procaffinity.Plo ./$(DEPDIR)/procargs.Plo \
./$(DEPDIR)/procio.Plo ./$(DEPDIR)/prockernel.Plo \
./$(DEPDIR)/proclist.Plo ./$(DEPDIR)/procmap.Plo \
./$(DEPDIR)/procmem.Plo ./$(DEPDIR)/procopenfiles.Plo \
./$(DEPDIR)/procsegment.Plo ./$(DEPDIR)/procsignal.Plo \
./$(DEPDIR)/procstate.Plo ./$(DEPDIR)/proctime.Plo \
./$(DEPDIR)/procuid.Plo ./$(DEPDIR)/procwd.Plo \
./$(DEPDIR)/sem_limits.Plo ./$(DEPDIR)/shm_limits.Plo \
./$(DEPDIR)/siglist.Plo ./$(DEPDIR)/suid_open.Plo \
./$(DEPDIR)/swap.Plo ./$(DEPDIR)/sysinfo.Plo \
./$(DEPDIR)/uptime.Plo
./$(DEPDIR)/disk.Plo ./$(DEPDIR)/fsusage.Plo \
./$(DEPDIR)/glibtop_private.Plo ./$(DEPDIR)/loadavg.Plo \
./$(DEPDIR)/mem.Plo ./$(DEPDIR)/mountlist.Plo \
./$(DEPDIR)/msg_limits.Plo ./$(DEPDIR)/netlist.Plo \
./$(DEPDIR)/netload.Plo ./$(DEPDIR)/open.Plo \
./$(DEPDIR)/ppp.Plo ./$(DEPDIR)/procaffinity.Plo \
./$(DEPDIR)/procargs.Plo ./$(DEPDIR)/procio.Plo \
./$(DEPDIR)/prockernel.Plo ./$(DEPDIR)/proclist.Plo \
./$(DEPDIR)/procmap.Plo ./$(DEPDIR)/procmem.Plo \
./$(DEPDIR)/procopenfiles.Plo ./$(DEPDIR)/procsegment.Plo \
./$(DEPDIR)/procsignal.Plo ./$(DEPDIR)/procstate.Plo \
./$(DEPDIR)/proctime.Plo ./$(DEPDIR)/procuid.Plo \
./$(DEPDIR)/procwd.Plo ./$(DEPDIR)/sem_limits.Plo \
./$(DEPDIR)/shm_limits.Plo ./$(DEPDIR)/siglist.Plo \
./$(DEPDIR)/suid_open.Plo ./$(DEPDIR)/swap.Plo \
./$(DEPDIR)/sysinfo.Plo ./$(DEPDIR)/uptime.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -234,8 +236,6 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
ChangeLog
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -256,6 +256,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@@ -267,8 +269,10 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -319,6 +323,7 @@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LSBLK = @LSBLK@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@@ -328,8 +333,8 @@ MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -354,6 +359,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TR = @TR@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
@@ -406,6 +412,8 @@ libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
libgtop_top_builddir = @libgtop_top_builddir@
libs_xauth = @libs_xauth@
localedir = @localedir@
localedir_c = @localedir_c@
localedir_c_make = @localedir_c_make@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
@@ -414,6 +422,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
server_programs = @server_programs@
sharedstatedir = @sharedstatedir@
@@ -427,7 +436,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
EXTRA_DIST = procmap_smaps.gperf procmap_smaps.c
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c disk.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
@@ -502,6 +511,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsusage.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glibtop_private.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadavg.Plo@am__quote@ # am--include-marker
@@ -639,7 +649,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -718,6 +727,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f ./$(DEPDIR)/close.Plo
-rm -f ./$(DEPDIR)/cpu.Plo
-rm -f ./$(DEPDIR)/disk.Plo
-rm -f ./$(DEPDIR)/fsusage.Plo
-rm -f ./$(DEPDIR)/glibtop_private.Plo
-rm -f ./$(DEPDIR)/loadavg.Plo
@@ -796,6 +806,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/close.Plo
-rm -f ./$(DEPDIR)/cpu.Plo
-rm -f ./$(DEPDIR)/disk.Plo
-rm -f ./$(DEPDIR)/fsusage.Plo
-rm -f ./$(DEPDIR)/glibtop_private.Plo
-rm -f ./$(DEPDIR)/loadavg.Plo
+284
View File
@@ -0,0 +1,284 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by James Dominic P. Guana <guana.histark@gmail.com>, May 2020.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/disk.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_disk =
(1L << GLIBTOP_XDISK_SECTORS_READ) + (1L << GLIBTOP_XDISK_TIME_READ) +
(1L << GLIBTOP_XDISK_SECTORS_WRITE) + (1L << GLIBTOP_XDISK_TIME_WRITE);
/* Init function. */
void
_glibtop_init_disk_s (glibtop *server)
{
server->sysdeps.disk = _glibtop_sysdeps_disk;
}
/* Provides information about disk usage. */
// Linux kernel reports sectors by 512 bytes even for AF 4kn //
#define FILENAME "/proc/diskstats"
#define CMD_PIPE "lsblk --output NAME,TYPE -i -n | sed 's/`-//'|sed 's/|-//'|sed 's/|//'| sed -e 's/^[ \t]*//'|tr -s ' '"
#define STAT_BUFSIZ 81920
// Handle LVM and RAID //
static void
find_primary_part (partition_info *primary_part, const char *m)
{
int n = 0, tlvl = 0;
char name[256]="", type[256]="";
primary_part->max = 0;
//scan by tree level
//0 = disk (to lvl 0)
//0 = disk, 1 = part (to lvl 1)
//0 = disk, 1 = part, 2 = lvm or raid (to lvl 2)
//0 = disk, 1 = part, 2 = raid, 3 = lvm (to lvl 3)
while (sscanf(m, "%s %s", name, type) == 2)
{
if (tlvl == 0) {
if (strcmp (type, "loop") == 0 || strcmp (type, "rom") == 0 || strcmp (type, "disk") == 0) {
primary_part->max++;
}
else if ((strcmp (type, "part") == 0)){
tlvl = 1;
}
}
else if(tlvl == 1){
if (strcmp (type, "loop") == 0 || strcmp (type, "rom") == 0 || strcmp (type, "disk") == 0) {
n--;
tlvl = 0;
primary_part->max++;
}
else if ((strcmp (type, "part") == 0)) {
n--;
}
else if ((strcmp (type, "lvm") == 0) || (strncmp (type, "raid", 4) == 0)) {
tlvl = 2;
primary_part->max++;
}
}
else if( tlvl == 2){
if (strcmp (type, "loop") == 0 || strcmp (type, "rom") == 0 || strcmp(type, "disk") == 0) {
n--;
tlvl = 0;
primary_part->max++;
}
else if (((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0)) ||
((strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0))) {
n--;
}
else if (((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0)) ||
((strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0))) {
n--;
tlvl = 1;
}
else if ((strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "lvm") == 0)){
tlvl = 3;
primary_part->max++;
}
}
else if (tlvl == 3) {
if (strcmp (type, "loop") == 0 || strcmp (type, "rom") == 0 || strcmp (type, "disk") == 0) {
n--;
tlvl = 0;
primary_part->max++;
}
else if ((strcmp (type, "lvm") == 0)) {
n--;
}
else if ((strncmp (type, "raid", 4) == 0)) {
n--;
tlvl = 2;
}
else if ((strcmp (type, "part") == 0)) {
n--;
tlvl = 1;
}
}
strcpy (primary_part[n].name, name);
strncpy (primary_part[n].type, type, 4);
if (strcmp (primary_part[n].type, "raid") == 0) {
strcpy (primary_part[n].raid_num, type + 4);
}
m = skip_line (m);
n++;
}
}
static int
is_virtual_drive (partition_info *primary_part, const char *p)
{
int i;
char name[256];
int test = 1;
sscanf (p, "%s", name);
if (*p) {
for (i=0; i < primary_part->max; i++) {
if (strcmp (primary_part[i].name, name) == 0) {
test = 0;
break;
}
}
}
else {
test = 0;
}
return test;
}
static int
max_lines (const char *p)
{
char temp[10];
int count = 0;
while (sscanf (p, "%s", temp) == 1)
{
p = skip_line(p);
count++;
}
return count;
}
void
glibtop_get_disk_s (glibtop *server, glibtop_disk *buf)
{
partition_info primary_part[GLIBTOP_NDISK];
char buffer [STAT_BUFSIZ], *p, map_buffer [STAT_BUFSIZ], *m;
int i;
memset (buf, 0, sizeof (glibtop_disk));
file_to_buffer (server, buffer, sizeof buffer, FILENAME);
get_from_pipe (map_buffer, STAT_BUFSIZ, CMD_PIPE);
/*
* GLOBAL
*/
p = buffer; /* "disk" */
m = map_buffer;
/*
* PER DISK
*/
server->ndisk = max_lines(p);
find_primary_part (primary_part, m);
for (i = 0; i < server->ndisk; i++) {
p = skip_multiple_token (p,2);
// skip if disk is the raw device
if (!is_virtual_drive (primary_part, p)) {
server->ndisk--;
p = skip_line (p); /* move to ^ */
p = skip_multiple_token (p, 2);
}
p = skip_token (p); /* prev xdisk_name */
p = skip_token (p); /* prev xdisk_reads_completed */
p = skip_token (p); /* prev xdisk_reads_merged */
buf->xdisk_sectors_read [i] = strtoull (p, &p, 0);
buf->xdisk_time_read [i] = strtoull (p, &p, 0);
p = skip_token (p); /* prev xdisk_writes_completed */
p = skip_token (p); /* prev xdisk_writes_merged */
buf->xdisk_sectors_write [i] = strtoull (p, &p, 0);
buf->xdisk_time_write [i] = strtoull (p, &p, 0);
p = skip_line (p); /* move to ^ */
}
}
+15
View File
@@ -57,6 +57,21 @@ skip_token (const char *p)
}
void
get_from_pipe (char *buffer, const size_t bufsiz, const char *cmd)
{
FILE* fp;
fp = popen (cmd, "r");
size_t psize = fread(buffer,1,bufsiz,fp);
if (psize == bufsiz)
g_warning("Read bufsiz bytes, there may be more");
pclose (fp);
}
/*
* Read functions
*/
+3
View File
@@ -61,6 +61,9 @@ skip_line (const char *p)
return (char *) (*p ? p+1 : p);
}
void
get_from_pipe (char *buffer, const size_t bufsiz, const char *cmd);
/*
* Smart strtoul which handles binary suffixes
* e.g: get_scaled("Size: 32 kB", "Size:") == 32768
+2 -1
View File
@@ -23,6 +23,7 @@
#define __LINUX__GLIBTOP_SERVER_H__
#define GLIBTOP_SUID_CPU 0
#define GLIBTOP_SUID_DISK 0
#define GLIBTOP_SUID_MEM 0
#define GLIBTOP_SUID_SWAP 0
#define GLIBTOP_SUID_UPTIME 0
@@ -46,6 +47,6 @@
#define GLIBTOP_SUID_PROC_AFFINITY 0
#define GLIBTOP_SUID_PPP 0
#define GLIBTOP_SUID_PROC_OPEN_FILES 0
#define GLIBTOP_SUID_PROC_IO 0
#define GLIBTOP_SUID_PROC_IO 0
#endif /* __LINUX__GLIBTOP_SERVER_H__ */
+49 -14
View File
@@ -40,7 +40,8 @@ End:
typedef struct
{
GHashTable *table;
GHashTable *table_fstype;
GHashTable *table_mntdir;
} IgnoreList;
@@ -49,7 +50,8 @@ ignore_list_new(void)
{
IgnoreList* ig;
ig = g_new(IgnoreList, 1);
ig->table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
ig->table_fstype = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
ig->table_mntdir = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
return ig;
}
@@ -58,24 +60,38 @@ static void
ignore_list_delete(IgnoreList* ig)
{
if (ig) {
g_hash_table_destroy(ig->table);
g_hash_table_destroy(ig->table_fstype);
g_hash_table_destroy(ig->table_mntdir);
g_free(ig);
}
}
static void
ignore_list_add(IgnoreList* ig, const char* fs)
ignore_list_add_fstype(IgnoreList* ig, const char* fstype)
{
g_hash_table_insert(ig->table, g_strdup(fs), GINT_TO_POINTER(1));
g_hash_table_insert(ig->table_fstype, g_strdup(fstype), GINT_TO_POINTER(1));
}
static void
ignore_list_add_mntdir(IgnoreList* ig, const char* mntdir)
{
g_hash_table_insert(ig->table_mntdir, g_strdup(mntdir), GINT_TO_POINTER(1));
}
static gboolean
ignore_list_has(IgnoreList* ig, const char* fs)
ignore_list_has_fstype(IgnoreList* ig, const char* fstype)
{
gpointer data;
data = g_hash_table_lookup(ig->table, fs);
data = g_hash_table_lookup(ig->table_fstype, fstype);
return data != NULL;
}
static gboolean
ignore_list_has_mntdir(IgnoreList* ig, const char* mntdir)
{
gpointer data;
data = g_hash_table_lookup(ig->table_mntdir, mntdir);
return data != NULL;
}
@@ -84,7 +100,7 @@ ignore_list_has(IgnoreList* ig, const char* fs)
static gboolean
ignore_fs(const char *fstype, IgnoreList** ig)
ignore_fs(const char *mntdir, const char *fstype, IgnoreList** ig)
{
if (!*ig) {
FILE* fs;
@@ -92,24 +108,43 @@ ignore_fs(const char *fstype, IgnoreList** ig)
*ig = ignore_list_new();
ignore_list_add(*ig, "none");
ignore_list_add_fstype(*ig, "none");
if ((fs = fopen("/proc/filesystems", "r")) != NULL) {
while (fgets(line, sizeof line, fs)) {
if (!strncmp(line, "nodev", 5)) {
if (!strncmp(line, "nodev", 5) && strncmp(line+strlen(line)-4, "zfs", 3)) {
char *type;
type = g_strstrip(line + 5);
ignore_list_add(*ig, type);
ignore_list_add_fstype(*ig, type);
}
}
fclose(fs);
}
if ((fs = fopen("/run/mount/utab", "r")) != NULL) {
size_t len = 0;
char *uline = NULL;
while (getline(&uline, &len, fs) != -1) {
if (strstr(uline, "x-gdu.hide")) {
char * pch = strtok (uline, " ");
while (pch != NULL) {
if (!strncmp(pch, "TARGET=", 7)) {
ignore_list_add_mntdir(*ig, pch+7);
}
pch = strtok (NULL, " ");
}
}
}
free(uline);
fclose(fs);
}
}
return ignore_list_has(*ig, fstype);
return ignore_list_has_fstype(*ig, fstype) || ignore_list_has_mntdir(*ig, mntdir);
}
glibtop_mountentry *
glibtop_get_mountlist_s(glibtop *server, glibtop_mountlist *buf, int all_fs)
{
@@ -136,7 +171,7 @@ glibtop_get_mountlist_s(glibtop *server, glibtop_mountlist *buf, int all_fs)
const char *devopt;
gsize len;
if (!all_fs && ignore_fs(mnt->mnt_type, &ig))
if (!all_fs && ignore_fs(mnt->mnt_dir, mnt->mnt_type, &ig))
continue;
len = entries->len;