New upstream version 2.38.0
This commit is contained in:
6
sysdeps/Makefile.am
Normal file
6
sysdeps/Makefile.am
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
SUBDIRS = common @sysdeps_dir@
|
||||
|
||||
DIST_SUBDIRS = bsd common linux osf1 \
|
||||
stub stub_suid sun4 freebsd solaris aix darwin \
|
||||
cygwin openbsd
|
||||
696
sysdeps/Makefile.in
Normal file
696
sysdeps/Makefile.in
Normal file
@@ -0,0 +1,696 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = sysdeps
|
||||
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 \
|
||||
$(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 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/libgtop-sysdeps.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
distdir
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__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
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB = @DL_LIB@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GTKDOC_CHECK = @GTKDOC_CHECK@
|
||||
GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
|
||||
GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
|
||||
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
|
||||
GTKDOC_MKPDF = @GTKDOC_MKPDF@
|
||||
GTKDOC_REBASE = @GTKDOC_REBASE@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
|
||||
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
|
||||
INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
|
||||
INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
|
||||
INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
|
||||
INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
|
||||
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
|
||||
INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
|
||||
KVM_LIBS = @KVM_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGTOP_BINDIR = @LIBGTOP_BINDIR@
|
||||
LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
|
||||
LIBGTOP_INCS = @LIBGTOP_INCS@
|
||||
LIBGTOP_LIBS = @LIBGTOP_LIBS@
|
||||
LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
|
||||
LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
|
||||
LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
|
||||
LIBGTOP_SERVER = @LIBGTOP_SERVER@
|
||||
LIBGTOP_SERVER_VERSION = @LIBGTOP_SERVER_VERSION@
|
||||
LIBGTOP_VERSION = @LIBGTOP_VERSION@
|
||||
LIBGTOP_VERSION_CODE = @LIBGTOP_VERSION_CODE@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
LT_VERSION_INFO = @LT_VERSION_INFO@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libgtop_have_sysinfo = @libgtop_have_sysinfo@
|
||||
libgtop_need_server = @libgtop_need_server@
|
||||
libgtop_postinstall = @libgtop_postinstall@
|
||||
libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
|
||||
libgtop_top_builddir = @libgtop_top_builddir@
|
||||
libs_xauth = @libs_xauth@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
server_programs = @server_programs@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysdeps_dir = @sysdeps_dir@
|
||||
sysdeps_suid_lib = @sysdeps_suid_lib@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = common @sysdeps_dir@
|
||||
DIST_SUBDIRS = bsd common linux osf1 \
|
||||
stub stub_suid sun4 freebsd solaris aix darwin \
|
||||
cygwin openbsd
|
||||
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
|
||||
check-am clean clean-generic clean-libtool cscopelist-am ctags \
|
||||
ctags-am distclean distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
105
sysdeps/aix/ChangeLog
Normal file
105
sysdeps/aix/ChangeLog
Normal file
@@ -0,0 +1,105 @@
|
||||
2004-12-23 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* netlist.c:
|
||||
* Makefile.am: Added dummy glibtop_get_netlist.
|
||||
|
||||
2004-10-22 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_s):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_s):
|
||||
* procmem.c: (glibtop_get_proc_mem_s):
|
||||
* procsegment.c: (glibtop_get_proc_segment_s):
|
||||
* procsignal.c: (glibtop_get_proc_signal_s):
|
||||
* procstate.c: (glibtop_get_proc_state_s):
|
||||
* proctime.c: (glibtop_get_proc_time_s):
|
||||
* procuid.c: (glibtop_get_proc_uid_s): No longer abort() is no such pid.
|
||||
buf.flags == 0ULL means that there no data could be retrieve at all.
|
||||
Closes #154876. Thanks to Christophe Belle.
|
||||
|
||||
2004-10-04 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procstate.c: (glibtop_get_proc_state_s): Fixed .state to follow
|
||||
LibGTop2 specification.
|
||||
|
||||
2004-10-04 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procmap.c: (glibtop_get_proc_map_s): Fixed glibtop_init_s call.
|
||||
|
||||
2004-10-04 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* cpu.c: (glibtop_init_cpu_p), (glibtop_get_cpu_p):
|
||||
* glibtop_machine.h:
|
||||
* glibtop_server.h:
|
||||
* mem.c: (glibtop_get_mem_s):
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
* procargs.c: (glibtop_get_proc_args_s):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_s):
|
||||
* proclist.c: (glibtop_get_proclist_s):
|
||||
* procmem.c: (glibtop_get_proc_mem_s):
|
||||
* procsegment.c: (glibtop_get_proc_segment_s):
|
||||
* procsignal.c: (glibtop_get_proc_signal_s):
|
||||
* procstate.c: (glibtop_get_proc_state_s):
|
||||
* proctime.c: (glibtop_get_proc_time_s):
|
||||
* procuid.c: (glibtop_get_proc_uid_s):
|
||||
* swap.c: (glibtop_get_swap_s):
|
||||
* sysinfo.c: (add_info), (init_sysinfo):
|
||||
* uptime.c: (glibtop_init_uptime_s), (glibtop_get_uptime_s):
|
||||
|
||||
AIX support updated by Laurent Vivier <Laurent.Vivier@BULL.NET>.
|
||||
|
||||
Fixed cpu/uptime/sysinfo.
|
||||
Added missing calls to glibtop_init_s.
|
||||
|
||||
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* sysinfo.c: Added missing const qualifier.
|
||||
|
||||
2004-06-06 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_s): Removed never executed if statements.
|
||||
* procstate.c: (glibtop_get_proc_state_s): Used g_strlcpy instead of
|
||||
strncpy.
|
||||
|
||||
2004-05-25 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* uptime.c: (glibtop_get_uptime_p): Added boot_time.
|
||||
|
||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_s): fix g_malloc usage on non-Linux
|
||||
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
|
||||
|
||||
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am: install only one library, libgtop-2.0
|
||||
Fix build-time warnings due to the redefinition of guint64
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* procsignal.c: (glibtop_get_proc_signal_s): s/u_int64_t/guint64/
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* glibtop_machine.h:
|
||||
* glibtop_server.h:
|
||||
* glibtop_suid.h:
|
||||
* procargs.c:
|
||||
* proclist.c:
|
||||
* procmap.c:
|
||||
* utils.c:
|
||||
* utils.h: fixed compilation
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_s):
|
||||
* proclist.c: (glibtop_get_proclist_s):
|
||||
replace all the xmalloc crap by glib memory management functions
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* .cvsignore: added
|
||||
|
||||
2002-09-24 Laurent Vivier <Laurent.Vivier@bull.net>
|
||||
|
||||
* Create sysdeps/aix (from stub)
|
||||
24
sysdeps/aix/Makefile.am
Normal file
24
sysdeps/aix/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
|
||||
|
||||
libgtop_sysdeps_2_0_la_SOURCES = siglist.c nosuid.c mem.c swap.c uptime.c \
|
||||
procargs.c prockernel.c proclist.c procmap.c \
|
||||
procmem.c procsegment.c procsignal.c \
|
||||
proctime.c procuid.c procmem.c utils.c \
|
||||
procstate.c sysinfo.c netlist.c
|
||||
|
||||
|
||||
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c loadavg.c \
|
||||
msg_limits.c shm_limits.c sem_limits.c \
|
||||
netload.c ppp.c utils.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_2_0_la_LIBADD = $(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la $(GLIB_LIBS)
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h glibtop_suid.h
|
||||
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
783
sysdeps/aix/Makefile.in
Normal file
783
sysdeps/aix/Makefile.in
Normal file
@@ -0,0 +1,783 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = sysdeps/aix
|
||||
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 \
|
||||
$(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 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/libgtop-sysdeps.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(libgtopinclude_HEADERS) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libgtop_sysdeps_2_0_la_LIBADD =
|
||||
am_libgtop_sysdeps_2_0_la_OBJECTS = siglist.lo nosuid.lo mem.lo \
|
||||
swap.lo uptime.lo procargs.lo prockernel.lo proclist.lo \
|
||||
procmap.lo procmem.lo procsegment.lo procsignal.lo proctime.lo \
|
||||
procuid.lo procmem.lo utils.lo procstate.lo sysinfo.lo \
|
||||
netlist.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@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libgtop_sysdeps_2_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libgtop_sysdeps_2_0_la_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
am__DEPENDENCIES_1 =
|
||||
libgtop_sysdeps_suid_2_0_la_DEPENDENCIES = \
|
||||
$(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la \
|
||||
$(am__DEPENDENCIES_1)
|
||||
am_libgtop_sysdeps_suid_2_0_la_OBJECTS = open.lo close.lo cpu.lo \
|
||||
loadavg.lo msg_limits.lo shm_limits.lo sem_limits.lo \
|
||||
netload.lo ppp.lo utils.lo
|
||||
libgtop_sysdeps_suid_2_0_la_OBJECTS = \
|
||||
$(am_libgtop_sysdeps_suid_2_0_la_OBJECTS)
|
||||
libgtop_sysdeps_suid_2_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libgtop_sysdeps_suid_2_0_la_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES) \
|
||||
$(libgtop_sysdeps_suid_2_0_la_SOURCES)
|
||||
DIST_SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES) \
|
||||
$(libgtop_sysdeps_suid_2_0_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libgtopincludedir)"
|
||||
HEADERS = $(libgtopinclude_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__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)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB = @DL_LIB@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GTKDOC_CHECK = @GTKDOC_CHECK@
|
||||
GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
|
||||
GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
|
||||
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
|
||||
GTKDOC_MKPDF = @GTKDOC_MKPDF@
|
||||
GTKDOC_REBASE = @GTKDOC_REBASE@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
|
||||
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
|
||||
INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
|
||||
INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
|
||||
INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
|
||||
INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
|
||||
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
|
||||
INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
|
||||
KVM_LIBS = @KVM_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGTOP_BINDIR = @LIBGTOP_BINDIR@
|
||||
LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
|
||||
LIBGTOP_INCS = @LIBGTOP_INCS@
|
||||
LIBGTOP_LIBS = @LIBGTOP_LIBS@
|
||||
LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
|
||||
LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
|
||||
LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
|
||||
LIBGTOP_SERVER = @LIBGTOP_SERVER@
|
||||
LIBGTOP_SERVER_VERSION = @LIBGTOP_SERVER_VERSION@
|
||||
LIBGTOP_VERSION = @LIBGTOP_VERSION@
|
||||
LIBGTOP_VERSION_CODE = @LIBGTOP_VERSION_CODE@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
LT_VERSION_INFO = @LT_VERSION_INFO@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libgtop_have_sysinfo = @libgtop_have_sysinfo@
|
||||
libgtop_need_server = @libgtop_need_server@
|
||||
libgtop_postinstall = @libgtop_postinstall@
|
||||
libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
|
||||
libgtop_top_builddir = @libgtop_top_builddir@
|
||||
libs_xauth = @libs_xauth@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
server_programs = @server_programs@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysdeps_dir = @sysdeps_dir@
|
||||
sysdeps_suid_lib = @sysdeps_suid_lib@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
|
||||
libgtop_sysdeps_2_0_la_SOURCES = siglist.c nosuid.c mem.c swap.c uptime.c \
|
||||
procargs.c prockernel.c proclist.c procmap.c \
|
||||
procmem.c procsegment.c procsignal.c \
|
||||
proctime.c procuid.c procmem.c utils.c \
|
||||
procstate.c sysinfo.c netlist.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c loadavg.c \
|
||||
msg_limits.c shm_limits.c sem_limits.c \
|
||||
netload.c ppp.c utils.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_2_0_la_LIBADD = $(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la $(GLIB_LIBS)
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h glibtop_suid.h
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/aix/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/aix/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libgtop_sysdeps-2.0.la: $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_sysdeps_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libgtop_sysdeps_2_0_la_LINK) $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
libgtop_sysdeps_suid-2.0.la: $(libgtop_sysdeps_suid_2_0_la_OBJECTS) $(libgtop_sysdeps_suid_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_sysdeps_suid_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libgtop_sysdeps_suid_2_0_la_LINK) $(libgtop_sysdeps_suid_2_0_la_OBJECTS) $(libgtop_sysdeps_suid_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadavg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netload.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nosuid.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procargs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prockernel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proclist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsegment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsignal.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procstate.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proctime.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procuid.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shm_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/siglist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysinfo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-libgtopincludeHEADERS: $(libgtopinclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libgtopincludedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libgtopincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-libgtopincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(libgtopincludedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libgtopincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-libgtopincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libgtopincludeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-libgtopincludeHEADERS install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-libgtopincludeHEADERS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
29
sysdeps/aix/close.c
Normal file
29
sysdeps/aix/close.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
||||
135
sysdeps/aix/cpu.c
Normal file
135
sysdeps/aix/cpu.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <stdlib.h>
|
||||
#include <sys/systemcfg.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <utils.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
|
||||
(1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) +
|
||||
(1L << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_FREQUENCY) +
|
||||
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
|
||||
(1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) +
|
||||
(1L << GLIBTOP_XCPU_NICE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_cpu_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
server->ncpu = _system_configuration.ncpus;
|
||||
if (server->ncpu == 1)
|
||||
{
|
||||
server->ncpu = 0; /* means single-processor, see glibtop.h */
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "sysinfo");
|
||||
if (result == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
server->machine->sysinfo_offset = result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "cpuinfo");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.cpu = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
server->machine->cpuinfo_offset = result;
|
||||
|
||||
server->machine->cpuinfo = (struct cpuinfo*)calloc(_system_configuration.ncpus, sizeof(struct cpuinfo));
|
||||
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
int result;
|
||||
int cpu;
|
||||
struct sysinfo sysinfo;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->sysinfo_offset,
|
||||
&sysinfo, sizeof(struct sysinfo));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read sysinfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->idle = sysinfo.cpu[CPU_IDLE];
|
||||
buf->user = sysinfo.cpu[CPU_USER];
|
||||
buf->sys = sysinfo.cpu[CPU_KERNEL];
|
||||
buf->nice = sysinfo.cpu[CPU_WAIT];
|
||||
|
||||
buf->total = buf->idle + buf->user + buf->sys + buf->nice ;
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->cpuinfo_offset,
|
||||
server->machine->cpuinfo,
|
||||
_system_configuration.ncpus
|
||||
* sizeof(struct cpuinfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read cpuinfo");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (cpu = 0; cpu < MIN(GLIBTOP_NCPU, _system_configuration.ncpus); cpu++)
|
||||
{
|
||||
buf->xcpu_idle[cpu] =
|
||||
server->machine->cpuinfo[cpu].cpu[CPU_IDLE];
|
||||
buf->xcpu_user[cpu] =
|
||||
server->machine->cpuinfo[cpu].cpu[CPU_USER];
|
||||
buf->xcpu_sys[cpu] =
|
||||
server->machine->cpuinfo[cpu].cpu[CPU_KERNEL];
|
||||
buf->xcpu_nice[cpu] =
|
||||
server->machine->cpuinfo[cpu].cpu[CPU_WAIT];
|
||||
|
||||
buf->xcpu_total[cpu] = buf->xcpu_idle[cpu] +
|
||||
buf->xcpu_user[cpu] +
|
||||
buf->xcpu_sys[cpu] +
|
||||
buf->xcpu_nice[cpu];
|
||||
}
|
||||
|
||||
|
||||
buf->frequency = sysconf(_SC_CLK_TCK);
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
50
sysdeps/aix/glibtop_machine.h
Normal file
50
sysdeps/aix/glibtop_machine.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
#include <procinfo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
uid_t uid, euid;
|
||||
gid_t gid, egid;
|
||||
|
||||
int kmem_fd;
|
||||
|
||||
off_t cpuinfo_offset;
|
||||
off_t sysinfo_offset;
|
||||
off_t ifnet_offset;
|
||||
off_t loadavg_offset;
|
||||
off_t shminfo_offset;
|
||||
off_t seminfo_offset;
|
||||
off_t msginfo_offset;
|
||||
|
||||
struct cpuinfo *cpuinfo;
|
||||
struct procsinfo last_pinfo;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIBTOP_MACHINE_H__ */
|
||||
51
sysdeps/aix/glibtop_server.h
Normal file
51
sysdeps/aix/glibtop_server.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SERVER_H__
|
||||
#define __GLIBTOP_SERVER_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SUID_CPU (1 << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_SUID_MEM 0
|
||||
#define GLIBTOP_SUID_SWAP 0
|
||||
#define GLIBTOP_SUID_UPTIME 0
|
||||
#define GLIBTOP_SUID_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_SUID_SHM_LIMITS (1 << GLIBTOP_SYSDEPS_SHM_LIMITS)
|
||||
#define GLIBTOP_SUID_MSG_LIMITS (1 << GLIBTOP_SYSDEPS_MSG_LIMITS)
|
||||
#define GLIBTOP_SUID_SEM_LIMITS (1 << GLIBTOP_SYSDEPS_SEM_LIMITS)
|
||||
#define GLIBTOP_SUID_PROCLIST 0
|
||||
#define GLIBTOP_SUID_PROC_STATE 0
|
||||
#define GLIBTOP_SUID_PROC_UID 0
|
||||
#define GLIBTOP_SUID_PROC_MEM 0
|
||||
#define GLIBTOP_SUID_PROC_TIME 0
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
||||
#define GLIBTOP_SUID_PROC_KERNEL 0
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
||||
#define GLIBTOP_SUID_PROC_ARGS 0
|
||||
#define GLIBTOP_SUID_PROC_MAP 0
|
||||
#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PPP 0
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
50
sysdeps/aix/glibtop_suid.h
Normal file
50
sysdeps/aix/glibtop_suid.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SUID_H__
|
||||
#define __GLIBTOP_SUID_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if _IN_LIBGTOP
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
static inline void glibtop_suid_enter (glibtop *server) {
|
||||
setegid (server->machine->egid);
|
||||
}
|
||||
|
||||
static inline void glibtop_suid_leave (glibtop *server) {
|
||||
if (setegid (server->machine->gid))
|
||||
_exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags);
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
77
sysdeps/aix/loadavg.c
Normal file
77
sysdeps/aix/loadavg.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <nlist.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/loadavg.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1 << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_loadavg_p (glibtop *server)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "avenrun");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.loadavg = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine->loadavg_offset = result;
|
||||
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
int result;
|
||||
int loadavg[3];
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->loadavg_offset,
|
||||
loadavg, sizeof(loadavg));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read loadavg");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->loadavg[0] = loadavg[0] / 65536.0;
|
||||
buf->loadavg[1] = loadavg[1] / 65536.0;
|
||||
buf->loadavg[2] = loadavg[2] / 65536.0;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
77
sysdeps/aix/mem.c
Normal file
77
sysdeps/aix/mem.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/mem.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
|
||||
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_LOCKED);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
struct vminfo vminfo;
|
||||
int pagesize;
|
||||
int result;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
#ifdef HAVE_VMGETINFO
|
||||
result = vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#else
|
||||
result = _glibtop_vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#endif
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read vminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
buf->total = vminfo.memsizepgs * pagesize;
|
||||
buf->used = (vminfo.numwseguse + vminfo.numpseguse +
|
||||
vminfo.numclseguse) * pagesize;
|
||||
buf->free = vminfo.numfrb * pagesize;
|
||||
buf->locked = (vminfo.numwsegpin + vminfo.numpsegpin +
|
||||
vminfo.numclsegpin) * pagesize;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
}
|
||||
80
sysdeps/aix/msg_limits.c
Normal file
80
sysdeps/aix/msg_limits.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/msg.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/msg_limits.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) +
|
||||
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGTQL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "msginfo");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.sem_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine->msginfo_offset = result;
|
||||
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct msginfo msginfo;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->msginfo_offset,
|
||||
&msginfo, sizeof(msginfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read seminfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->msgmax = msginfo.msgmax;
|
||||
buf->msgmnb = msginfo.msgmnb;
|
||||
buf->msgmni = msginfo.msgmni;
|
||||
buf->msgtql = msginfo.msgmnm;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
39
sysdeps/aix/netlist.c
Normal file
39
sysdeps/aix/netlist.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* This file is part of LibGTop 2.0.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/netlist.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netlist = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netlist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netlist = _glibtop_sysdeps_netlist;
|
||||
}
|
||||
|
||||
char**
|
||||
glibtop_get_netlist_s (glibtop *server, glibtop_netlist *buf)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_netlist));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
208
sysdeps/aix/netload.c
Normal file
208
sysdeps/aix/netload.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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 <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netload =
|
||||
(1 << GLIBTOP_NETLOAD_IF_FLAGS) + (1 << GLIBTOP_NETLOAD_MTU) +
|
||||
(1 << GLIBTOP_NETLOAD_SUBNET) + (1 << GLIBTOP_NETLOAD_ADDRESS) +
|
||||
(1 << GLIBTOP_NETLOAD_PACKETS_IN) + (1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
|
||||
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + (1 << GLIBTOP_NETLOAD_BYTES_IN) +
|
||||
(1 << GLIBTOP_NETLOAD_BYTES_OUT) + (1 << GLIBTOP_NETLOAD_BYTES_TOTAL) +
|
||||
(1 << GLIBTOP_NETLOAD_ERRORS_IN) + (1 << GLIBTOP_NETLOAD_ERRORS_OUT) +
|
||||
(1 << GLIBTOP_NETLOAD_ERRORS_TOTAL) + (1 << GLIBTOP_NETLOAD_COLLISIONS);
|
||||
|
||||
static void get_ifaddr(glibtop* server, struct ifaddr* next, long* addr, long* mask)
|
||||
{
|
||||
struct ifaddr ifaddr;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
||||
*addr = 0;
|
||||
*mask = 0;
|
||||
|
||||
while (next)
|
||||
{
|
||||
/* get interface ifaddr structure */
|
||||
|
||||
_glibtop_get_kmem_info(server, (off_t)next, &ifaddr, sizeof(ifaddr));
|
||||
|
||||
/* get socket addr information */
|
||||
|
||||
_glibtop_get_kmem_info( server, (off_t)ifaddr.ifa_addr
|
||||
, &sockaddr, sizeof(sockaddr));
|
||||
|
||||
/* if valid family : UDP, TCP, ...*/
|
||||
|
||||
if (sockaddr.sin_family == AF_INET)
|
||||
{
|
||||
*addr = sockaddr.sin_addr.s_addr;
|
||||
|
||||
_glibtop_get_kmem_info( server, (off_t)ifaddr.ifa_netmask
|
||||
, &sockaddr, sizeof(sockaddr));
|
||||
|
||||
*mask = sockaddr.sin_addr.s_addr;
|
||||
|
||||
/* address found */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
next = ifaddr.ifa_next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netload_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
off_t addr;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "ifnet");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.netload = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_info(server, result, &addr, sizeof(addr));
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.netload = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine->ifnet_offset = addr;
|
||||
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
}
|
||||
|
||||
/* Provides network statistics. */
|
||||
|
||||
void
|
||||
glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
int result;
|
||||
off_t offset;
|
||||
struct ifnet ifnet;
|
||||
long addr;
|
||||
long mask;
|
||||
char name[16];
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
|
||||
for ( offset = server->machine->ifnet_offset;
|
||||
offset != 0;
|
||||
offset = (off_t)ifnet.if_next
|
||||
)
|
||||
{
|
||||
result = _glibtop_get_kmem_info(server, offset,
|
||||
&ifnet, sizeof(ifnet));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read ifnet");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_info(server, (off_t)ifnet.if_name,
|
||||
name, sizeof(name));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read if_name");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(name+strlen(name), "%d", ifnet.if_unit);
|
||||
if (strcmp(name, interface) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ifnet.if_flags & IFF_UP)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_UP);
|
||||
if (ifnet.if_flags & IFF_BROADCAST)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_BROADCAST);
|
||||
if (ifnet.if_flags & IFF_LOOPBACK)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LOOPBACK);
|
||||
if (ifnet.if_flags & IFF_POINTOPOINT)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_POINTOPOINT);
|
||||
if (ifnet.if_flags & IFF_RUNNING)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_RUNNING);
|
||||
if (ifnet.if_flags & IFF_NOARP)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_NOARP);
|
||||
if (ifnet.if_flags & IFF_PROMISC)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_PROMISC);
|
||||
if (ifnet.if_flags & IFF_ALLMULTI)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_ALLMULTI);
|
||||
if (ifnet.if_flags & IFF_OACTIVE)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_OACTIVE);
|
||||
if (ifnet.if_flags & IFF_SIMPLEX)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_SIMPLEX);
|
||||
if (ifnet.if_flags & IFF_LINK0)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK0);
|
||||
if (ifnet.if_flags & IFF_LINK1)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK1);
|
||||
if (ifnet.if_flags & IFF_LINK2)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK2);
|
||||
if (ifnet.if_flags & IFF_LINK2)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK2);
|
||||
if (ifnet.if_flags & 0x80000)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_MULTICAST);
|
||||
|
||||
buf->mtu = ifnet.if_mtu;
|
||||
|
||||
get_ifaddr(server, ifnet.if_addrlist, &addr, &mask);
|
||||
|
||||
buf->subnet = addr & mask;
|
||||
buf->address = addr;
|
||||
|
||||
buf->packets_in = ifnet.if_ipackets;
|
||||
buf->packets_out = ifnet.if_opackets;
|
||||
buf->packets_total = buf->packets_in + buf->packets_out;
|
||||
|
||||
buf->bytes_in = ifnet.if_ibytes;
|
||||
buf->bytes_out = ifnet.if_obytes;
|
||||
buf->bytes_total = buf->bytes_in + buf->bytes_out;
|
||||
|
||||
buf->errors_in = ifnet.if_ierrors;
|
||||
buf->errors_out = ifnet.if_oerrors;
|
||||
buf->errors_total = ifnet.if_ierrors + ifnet.if_oerrors;
|
||||
|
||||
buf->collisions = ifnet.if_collisions;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_netload;
|
||||
}
|
||||
45
sysdeps/aix/nosuid.c
Normal file
45
sysdeps/aix/nosuid.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/systemcfg.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/close.h>
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server,
|
||||
const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
server->ncpu = _system_configuration.ncpus;
|
||||
|
||||
if (server->ncpu == 1)
|
||||
{
|
||||
server->ncpu = 0; /* means single-processor, see glibtop.h */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
||||
81
sysdeps/aix/open.c
Normal file
81
sysdeps/aix/open.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/init_hooks.h>
|
||||
#include "glibtop_suid.h"
|
||||
|
||||
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
const _glibtop_init_func_t *init_fkt;
|
||||
|
||||
if (server == NULL)
|
||||
glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
|
||||
|
||||
if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
|
||||
glibtop_open_p (server, "glibtop", features, flags);
|
||||
|
||||
for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
|
||||
(*init_fkt) (server);
|
||||
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
|
||||
|
||||
server->machine->uid = getuid ();
|
||||
server->machine->euid = geteuid ();
|
||||
server->machine->gid = getgid ();
|
||||
server->machine->egid = getegid ();
|
||||
|
||||
/* open kmem */
|
||||
|
||||
server->machine->kmem_fd = open("/dev/kmem", O_RDONLY);
|
||||
if (server->machine->kmem_fd == -1)
|
||||
glibtop_error_io_r (server, "Cannot open /dev/kmem");
|
||||
|
||||
/* Drop priviledges. */
|
||||
|
||||
if (seteuid (server->machine->uid))
|
||||
_exit (1);
|
||||
|
||||
if (setegid (server->machine->gid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
server->name = program_name;
|
||||
}
|
||||
43
sysdeps/aix/ppp.c
Normal file
43
sysdeps/aix/ppp.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/ppp.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_ppp = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_ppp_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
}
|
||||
|
||||
/* Provides PPP/ISDN information. */
|
||||
|
||||
void
|
||||
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
}
|
||||
113
sysdeps/aix/procargs.c
Normal file
113
sysdeps/aix/procargs.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <procinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
(1 << GLIBTOP_PROC_ARGS_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
static void _glibtop_remove_non_ascii(char* string)
|
||||
{
|
||||
for (;*string != 0;string++)
|
||||
{
|
||||
if (!isascii(*string))
|
||||
*string = '?';
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
char *args_buffer;
|
||||
char* args = NULL;
|
||||
int size;
|
||||
int result;
|
||||
int len;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return NULL;
|
||||
|
||||
size = max_len != 0 ? max_len : 4096;
|
||||
args_buffer = g_malloc (size);
|
||||
|
||||
result = getargs(pinfo, sizeof(struct procsinfo), args_buffer, size);
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot malloc getargs");
|
||||
|
||||
g_free(args_buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look if empty string */
|
||||
|
||||
if (args_buffer[0] == 0)
|
||||
{
|
||||
g_free(args_buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* compute length of args and realloc */
|
||||
|
||||
len = 0;
|
||||
while ((args_buffer[len] != 0) && (len < size))
|
||||
{
|
||||
_glibtop_remove_non_ascii(args_buffer + len);
|
||||
|
||||
len += strlen(args_buffer + len) + 1;
|
||||
}
|
||||
|
||||
args = g_malloc (len);
|
||||
|
||||
memcpy(args, args_buffer, len);
|
||||
g_free(args_buffer);
|
||||
|
||||
buf->size = len - 1;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return args;
|
||||
}
|
||||
94
sysdeps/aix/prockernel.c
Normal file
94
sysdeps/aix/prockernel.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <procinfo.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel =
|
||||
(1 <<GLIBTOP_PROC_KERNEL_MIN_FLT) + (1 <<GLIBTOP_PROC_KERNEL_MAJ_FLT) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_CMIN_FLT) + (1 <<GLIBTOP_PROC_KERNEL_CMAJ_FLT) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_KSTK_ESP) + (1 <<GLIBTOP_PROC_KERNEL_KSTK_EIP) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_NWCHAN);
|
||||
|
||||
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_kernel_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct thrdsinfo thinfo;
|
||||
struct procsinfo *pinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
if (!(pinfo->pi_flags | SKPROC))
|
||||
{
|
||||
/* not a kernel process */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->min_flt = pinfo->pi_ru.ru_minflt;
|
||||
buf->maj_flt = pinfo->pi_ru.ru_majflt;
|
||||
|
||||
buf->cmin_flt = pinfo->pi_cru.ru_minflt;
|
||||
buf->cmaj_flt = pinfo->pi_cru.ru_majflt;
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read thrdsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->kstk_esp = thinfo.ti_ustk;
|
||||
buf->kstk_eip = thinfo.ti_code;
|
||||
|
||||
buf->nwchan = thinfo.ti_wchan;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
247
sysdeps/aix/proclist.c
Normal file
247
sysdeps/aix/proclist.c
Normal file
@@ -0,0 +1,247 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <procinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/proclist.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1 << GLIBTOP_PROCLIST_NUMBER) + (1 << GLIBTOP_PROCLIST_TOTAL) +
|
||||
(1 << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
#define BLOCK_COUNT 256
|
||||
#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned int))
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proclist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
/* Fetch list of currently running processes.
|
||||
*
|
||||
* IMPORTANT NOTE:
|
||||
* On error, this function MUST return NULL and set buf->flags to zero !
|
||||
* On success, it returnes a pointer to a list of buf->number elements
|
||||
* each buf->size big. The total size is stored in buf->total. */
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
||||
gint64 which, gint64 arg)
|
||||
{
|
||||
struct procsinfo pinfo;
|
||||
int count, total;
|
||||
unsigned pids [BLOCK_COUNT], *pids_chain = NULL;
|
||||
int pids_size = 0, pids_offset = 0, new_size;
|
||||
pid_t current;
|
||||
int result;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
for( count = total = 0, current = 0
|
||||
, result = getprocs(&pinfo, sizeof(pinfo), NULL, 0, ¤t, 1);
|
||||
result == 1;
|
||||
result = getprocs(&pinfo, sizeof(pinfo), NULL, 0, ¤t, 1))
|
||||
{
|
||||
if (which & GLIBTOP_EXCLUDE_IDLE)
|
||||
{
|
||||
if (pinfo.pi_state & SIDL)
|
||||
{
|
||||
/* exclude idle processes */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (which & GLIBTOP_EXCLUDE_SYSTEM)
|
||||
{
|
||||
if (pinfo.pi_flags & SKPROC)
|
||||
{
|
||||
/* exclude Kernel processes */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (which & GLIBTOP_EXCLUDE_NOTTY)
|
||||
{
|
||||
if (!pinfo.pi_ttyp)
|
||||
{
|
||||
/* exclude processes without tty */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch(which & GLIBTOP_KERN_PROC_MASK)
|
||||
{
|
||||
case GLIBTOP_KERN_PROC_ALL:
|
||||
|
||||
/* return information about all processes
|
||||
* so, let's go ahead
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_PID:
|
||||
|
||||
/* return information about all processes with
|
||||
* pid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_pid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_PGRP:
|
||||
|
||||
/* return information about all processes in
|
||||
* process group passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_pgrp != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_SESSION:
|
||||
|
||||
/* return information about all processes in
|
||||
* session passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_sid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_TTY:
|
||||
|
||||
/* return information about all processes with
|
||||
* tty device number passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_ttyd != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_UID:
|
||||
|
||||
/* return information about all processes with
|
||||
* effective uid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_cred.cr_uid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_RUID:
|
||||
|
||||
/* return information about all processes with
|
||||
* real uid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_cred.cr_ruid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (count >= BLOCK_COUNT)
|
||||
{
|
||||
/* The following call to g_realloc will be
|
||||
* equivalent to g_malloc () if `pids_chain' is
|
||||
* NULL. We just calculate the new size and copy `pids'
|
||||
* to the beginning of the newly allocated block. */
|
||||
|
||||
new_size = pids_size + BLOCK_SIZE;
|
||||
|
||||
pids_chain = g_realloc
|
||||
(pids_chain, new_size);
|
||||
memcpy (pids_chain + pids_offset, pids, BLOCK_SIZE);
|
||||
|
||||
pids_size = new_size;
|
||||
pids_offset += BLOCK_COUNT;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
/* pids is now big enough to hold at least one single pid. */
|
||||
|
||||
pids[count++] = pinfo.pi_pid;
|
||||
|
||||
total++;
|
||||
}
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read procsinfo");
|
||||
}
|
||||
|
||||
/* count is only zero if an error occured (one a running Linux system,
|
||||
* we have at least one single process). */
|
||||
|
||||
if (!count) return NULL;
|
||||
|
||||
/* The following call to g_realloc will be equivalent to
|
||||
* g_malloc if pids_chain is NULL. We just calculate the
|
||||
* new size and copy pids to the beginning of the newly allocated
|
||||
* block. */
|
||||
|
||||
new_size = pids_size + count * sizeof (unsigned);
|
||||
|
||||
pids_chain = g_realloc (pids_chain, new_size);
|
||||
|
||||
memcpy (pids_chain + pids_offset, pids, count * sizeof (unsigned));
|
||||
|
||||
pids_size = new_size;
|
||||
|
||||
/* Since everything is ok now, we can set buf->flags, fill in the
|
||||
* remaining fields and return the `pids_chain'. */
|
||||
|
||||
buf->size = sizeof(unsigned int);
|
||||
buf->number = total;
|
||||
buf->total = total * buf->size;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proclist;
|
||||
|
||||
return pids_chain;
|
||||
}
|
||||
48
sysdeps/aix/procmap.c
Normal file
48
sysdeps/aix/procmap.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_map_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
{
|
||||
glibtop_init_p (&server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
69
sysdeps/aix/procmem.c
Normal file
69
sysdeps/aix/procmem.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmem.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_mem =
|
||||
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_VSIZE) +
|
||||
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_RSS) +
|
||||
(1 << GLIBTOP_PROC_MEM_RSS_RLIM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int pagesize;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
buf->vsize = buf->size = pinfo->pi_size * pagesize;
|
||||
buf->resident = buf->rss = (pinfo->pi_drss + pinfo->pi_trss) * pagesize;
|
||||
buf->rss_rlim = pinfo->pi_rlimit[RLIMIT_RSS].rlim_cur;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
70
sysdeps/aix/procsegment.c
Normal file
70
sysdeps/aix/procsegment.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + (1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) +
|
||||
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) + (1 << GLIBTOP_PROC_SEGMENT_STACK_RSS);
|
||||
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_segment_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int pagesize;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
buf->text_rss = pinfo->pi_trss * pagesize;
|
||||
buf->data_rss = pinfo->pi_drss * pagesize;
|
||||
buf->shlib_rss = pinfo->pi_ru.ru_ixrss * pagesize;
|
||||
buf->stack_rss = pinfo->pi_ru.ru_isrss * pagesize;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
85
sysdeps/aix/procsignal.c
Normal file
85
sysdeps/aix/procsignal.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C)) +998-99 Martin Baulig
|
||||
This file is part of LibGTop) +.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April) +998.
|
||||
|
||||
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) + 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 <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procsignal.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_signal =
|
||||
(1 <<GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 <<GLIBTOP_PROC_SIGNAL_BLOCKED) +
|
||||
(1 <<GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 <<GLIBTOP_PROC_SIGNAL_SIGCATCH);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_signal_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int i;
|
||||
long bit;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
/* pending signals */
|
||||
|
||||
#define NB_BITS (8 * sizeof(guint64))
|
||||
|
||||
for (i = 0; (i < NSIG) && (i < 2 * NB_BITS); i++)
|
||||
{
|
||||
bit = 1 << (NB_BITS - 1 - (i % NB_BITS));
|
||||
|
||||
if (sigismember(&pinfo->pi_sig, i))
|
||||
buf->signal[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_HOLD)
|
||||
buf->blocked[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_IGN)
|
||||
buf->sigignore[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_CATCH)
|
||||
buf->sigcatch[i / NB_BITS] |= bit;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
124
sysdeps/aix/procstate.c
Normal file
124
sysdeps/aix/procstate.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <procinfo.h>
|
||||
#include <sys/thread.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procstate.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_state =
|
||||
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) +
|
||||
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_state_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
struct thrdsinfo thinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
if (pinfo->pi_pid == 0)
|
||||
{
|
||||
strcpy(buf->cmd, "swapper");
|
||||
}
|
||||
|
||||
if (pinfo->pi_comm[0] == 0)
|
||||
{
|
||||
strcpy(buf->cmd, "<unknown>");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_strlcpy(buf->cmd, pinfo->pi_comm, sizeof buf->cmd);
|
||||
}
|
||||
|
||||
buf->uid = pinfo->pi_uid;
|
||||
buf->gid = pinfo->pi_cred.cr_gid;
|
||||
|
||||
if (pinfo->pi_state == SZOMB)
|
||||
{
|
||||
buf->state = GLIBTOP_PROCESS_ZOMBIE;
|
||||
strcpy(buf->cmd, "<defunct>");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get state of first thread */
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read threadinfo");
|
||||
}
|
||||
|
||||
switch (thinfo.ti_state)
|
||||
{
|
||||
case TSIDL:
|
||||
/* FIXME */
|
||||
/* buf->state = GLIBTOP_PROCESS_UNINTERRUPTIBLE; */
|
||||
break;
|
||||
case TSRUN:
|
||||
buf->state = GLIBTOP_PROCESS_RUNNING;
|
||||
break;
|
||||
case TSSLEEP:
|
||||
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
|
||||
break;
|
||||
case TSZOMB:
|
||||
buf->state = GLIBTOP_PROCESS_ZOMBIE;
|
||||
strcpy(buf->cmd, "<defunct>");
|
||||
break;
|
||||
case TSSTOP:
|
||||
buf->state = GLIBTOP_PROCESS_STOPPED;
|
||||
break;
|
||||
case TSSWAP:
|
||||
buf->state = GLIBTOP_PROCESS_SWAPPING;
|
||||
break;
|
||||
default:
|
||||
buf->state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
69
sysdeps/aix/proctime.c
Normal file
69
sysdeps/aix/proctime.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/proctime.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_RTIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_STIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_CUTIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_FREQUENCY);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_time_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
buf->start_time = pinfo->pi_start;
|
||||
buf->utime = pinfo->pi_ru.ru_utime.tv_sec + (double)pinfo->pi_ru.ru_utime.tv_usec/1000000.0;
|
||||
buf->stime = pinfo->pi_ru.ru_stime.tv_sec + (double)pinfo->pi_ru.ru_stime.tv_usec/1000000.0;
|
||||
buf->rtime = buf->utime + buf->stime;
|
||||
buf->cutime = pinfo->pi_cru.ru_utime.tv_sec + (double)pinfo->pi_cru.ru_utime.tv_usec/1000000.0;
|
||||
buf->cstime = pinfo->pi_cru.ru_stime.tv_sec + (double)pinfo->pi_cru.ru_stime.tv_usec/1000000.0;
|
||||
buf->frequency = sysconf(_SC_CLK_TCK);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
97
sysdeps/aix/procuid.c
Normal file
97
sysdeps/aix/procuid.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procuid.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
|
||||
(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID) +
|
||||
(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) +
|
||||
(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) +
|
||||
(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_PRIORITY) +
|
||||
(1 << GLIBTOP_PROC_UID_NICE);
|
||||
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_uid_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
struct thrdsinfo thinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL) return;
|
||||
|
||||
buf->uid = pinfo->pi_cred.cr_ruid;
|
||||
buf->euid = pinfo->pi_cred.cr_uid;
|
||||
buf->gid = pinfo->pi_cred.cr_rgid;
|
||||
buf->egid = pinfo->pi_cred.cr_gid;
|
||||
|
||||
buf->pid = pinfo->pi_pid;
|
||||
buf->ppid = pinfo->pi_ppid;
|
||||
|
||||
buf->pgrp = pinfo->pi_pgrp;
|
||||
buf->session = pinfo->pi_sid;
|
||||
|
||||
buf->tty = pinfo->pi_ttyd;
|
||||
|
||||
buf->nice = pinfo->pi_nice;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
buf->flags &= ~(1 << GLIBTOP_PROC_UID_PRIORITY);
|
||||
|
||||
glibtop_error_io_r(server, "Cannot read thrdsinfo");
|
||||
}
|
||||
|
||||
/* priority of first thread */
|
||||
|
||||
buf->priority = thinfo.ti_pri;
|
||||
}
|
||||
85
sysdeps/aix/sem_limits.c
Normal file
85
sysdeps/aix/sem_limits.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/sem_limits.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1 << GLIBTOP_IPC_SEMMNI) + (1 << GLIBTOP_IPC_SEMMSL) +
|
||||
(1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMUME) +
|
||||
(1 << GLIBTOP_IPC_SEMUSZ) + (1 << GLIBTOP_IPC_SEMVMX) +
|
||||
(1 << GLIBTOP_IPC_SEMAEM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "seminfo");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.sem_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine->seminfo_offset = result;
|
||||
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct seminfo seminfo;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->seminfo_offset,
|
||||
&seminfo, sizeof(seminfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read seminfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->semmni = seminfo.semmni;
|
||||
buf->semmsl = seminfo.semmsl;
|
||||
buf->semopm = seminfo.semopm;
|
||||
buf->semume = seminfo.semume;
|
||||
buf->semusz = seminfo.semusz;
|
||||
buf->semvmx = seminfo.semvmx;
|
||||
buf->semaem = seminfo.semaem;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
78
sysdeps/aix/shm_limits.c
Normal file
78
sysdeps/aix/shm_limits.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/shm.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/shm_limits.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
|
||||
(1L << GLIBTOP_IPC_SHMMNI);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "shminfo");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.shm_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine->shminfo_offset = result;
|
||||
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct shminfo shminfo;
|
||||
int s;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine->shminfo_offset,
|
||||
&shminfo, sizeof(struct shminfo));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read shminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->shmmax = shminfo.shmmax;
|
||||
buf->shmmin = shminfo.shmmin;
|
||||
buf->shmmni = shminfo.shmmni;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
71
sysdeps/aix/siglist.c
Normal file
71
sysdeps/aix/siglist.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/signal.h>
|
||||
|
||||
const glibtop_signame glibtop_sys_siglist [] =
|
||||
{ { 1, "SIGHUP", "Hangup" },
|
||||
{ 2, "SIGINT", "Interrupt" },
|
||||
{ 3, "SIGQUIT", "Quit" },
|
||||
{ 4, "SIGILL", "Illegal Instruction" },
|
||||
{ 5, "SIGTRAP", "Trace/Breakpoint Trap" },
|
||||
{ 6, "SIGABRT", "Abort" },
|
||||
{ 7, "SIGEMT", "Emulation Trap" },
|
||||
{ 8, "SIGFPE", "Arithmetic Exception" },
|
||||
{ 9, "SIGKILL", "Killed" },
|
||||
{ 10, "SIGBUS", "Bus Error" },
|
||||
{ 11, "SIGSEGV", "Segmentation Fault" },
|
||||
{ 12, "SIGSYS", "Bad System Call" },
|
||||
{ 13, "SIGPIPE", "Broken Pipe" },
|
||||
{ 14, "SIGALRM", "Alarm Clock" },
|
||||
{ 15, "SIGTERM", "Terminated" },
|
||||
{ 16, "SIGURG", "Urgent Socket Condition" },
|
||||
{ 17, "SIGSTOP", "Stop (signal)" },
|
||||
{ 18, "SIGSTP", "Stop (user)" },
|
||||
{ 19, "SIGCONT", "Continue" },
|
||||
{ 20, "SIGCHLD", "Child Status Changed" },
|
||||
{ 21, "SIGTTIN", "Stopped (tty input)" },
|
||||
{ 22, "SIGTTOU", "Stopped (tty output)" },
|
||||
{ 23, "SIGIO", "I/O completed" },
|
||||
{ 24, "SIGXCPU", "Cpu Limit Exceeded" },
|
||||
{ 25, "SIGXFSZ", "File Size Limit Exceeded" },
|
||||
{ 27, "SIGMSG", "Message" },
|
||||
{ 28, "SIGWINCH","Window Size Change" },
|
||||
{ 29, "SIGPWR", "Power-Fail/Restart" },
|
||||
{ 30, "SIGUSR1", "User Signal 1" },
|
||||
{ 31, "SIGUSR2", "User Signal 2" },
|
||||
{ 32, "SIGPROF", "Profiling Timer Expired" },
|
||||
{ 33, "SIGDANGER","System Crash Imminent" },
|
||||
{ 34, "SIGVTALRM","Virtual Timer Expired" },
|
||||
{ 35, "SIGMIGRATE","Migrate Process" },
|
||||
{ 36, "SIGPRE", "Programming Exception" },
|
||||
{ 37, "SIGVIRT", "AIX Virtual Time Alarm" },
|
||||
{ 38, "SIGALRM1", "m:n Condition Variables" },
|
||||
{ 39, "SIGWAITING","Scheduling" },
|
||||
{ 59, "SIGCPUFAIL","Predictive De-configuration of Processors" },
|
||||
{ 60, "SIGKAP", "Keep Alive" },
|
||||
{ 61, "SIGRETRACT","Monitor Mode Relinguish" },
|
||||
{ 62, "SIGSOUND", "Sound Control Completed" },
|
||||
{ 63, "SIGSAK", "Secure Attention Key" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
129
sysdeps/aix/swap.c
Normal file
129
sysdeps/aix/swap.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/swap.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_swap =
|
||||
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
|
||||
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
|
||||
(1 << GLIBTOP_SWAP_PAGEOUT);
|
||||
|
||||
#define FILENAME "/etc/swapspaces"
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_swap_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
struct vminfo vminfo;
|
||||
struct pginfo pginfo;
|
||||
int pagesize;
|
||||
int result;
|
||||
FILE* fd;
|
||||
char device_name[128];
|
||||
int c;
|
||||
int comment = 0;
|
||||
int pos = 0;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_SWAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
fd = fopen(FILENAME, "r");
|
||||
if (fd == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||
}
|
||||
|
||||
buf->total = 0;
|
||||
buf->free = 0;
|
||||
while((c = getc(fd)) != EOF)
|
||||
{
|
||||
if (comment)
|
||||
{
|
||||
/* skip comments */
|
||||
if (c == '\n') comment = 0;
|
||||
continue;
|
||||
}
|
||||
switch(c)
|
||||
{
|
||||
case '*':
|
||||
comment = 1;
|
||||
break;
|
||||
case '\n':
|
||||
device_name[pos] = 0;
|
||||
pos = 0;
|
||||
|
||||
if (strncmp("dev=", device_name, 4) == 0)
|
||||
{
|
||||
result = swapqry(device_name+4, &pginfo);
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read pginfo");
|
||||
break;
|
||||
}
|
||||
|
||||
buf->total += pginfo.size * pagesize;
|
||||
buf->free += pginfo.free * pagesize;;
|
||||
}
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
break;
|
||||
default:
|
||||
device_name[pos++] = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buf->used = buf->total - buf->free;
|
||||
fclose(fd);
|
||||
#ifdef HAVE_VMGETINFO
|
||||
result = vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#else
|
||||
result = _glibtop_vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#endif
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read vminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->pagein = vminfo.pageins;
|
||||
buf->pageout = vminfo.pageouts;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
}
|
||||
198
sysdeps/aix/sysinfo.c
Normal file
198
sysdeps/aix/sysinfo.c
Normal file
@@ -0,0 +1,198 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/systemcfg.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/sysinfo.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sysinfo =
|
||||
(1L << GLIBTOP_SYSINFO_CPUINFO);
|
||||
|
||||
static glibtop_sysinfo sysinfo;
|
||||
|
||||
static void add_info(glibtop_entry* entry, char* label, char* attribute)
|
||||
{
|
||||
char* key;
|
||||
char* value;
|
||||
|
||||
key = g_strdup(label);
|
||||
value = g_strdup(attribute);
|
||||
|
||||
g_ptr_array_add(entry->labels, key);
|
||||
g_hash_table_insert(entry->values, key, value);
|
||||
}
|
||||
|
||||
static void init_sysinfo(void)
|
||||
{
|
||||
int cpu;
|
||||
char buf[64];
|
||||
|
||||
memset (&sysinfo, 0, sizeof (glibtop_sysinfo));
|
||||
|
||||
sysinfo.ncpu = MIN(_system_configuration.ncpus, GLIBTOP_NCPU);
|
||||
|
||||
for (cpu = 0; cpu < sysinfo.ncpu ; cpu++)
|
||||
{
|
||||
/* init cpu data structure */
|
||||
|
||||
sysinfo.cpuinfo[cpu].labels = g_ptr_array_new();
|
||||
sysinfo.cpuinfo[cpu].values = g_hash_table_new (NULL, NULL);
|
||||
|
||||
/* add properties */
|
||||
|
||||
switch(_system_configuration.architecture)
|
||||
{
|
||||
case POWER_RS:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Power Classic");
|
||||
break;
|
||||
case POWER_PC:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Power PC");
|
||||
break;
|
||||
case IA64:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Intel IA64");
|
||||
break;
|
||||
default:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (_system_configuration.architecture == POWER_RS) ||
|
||||
(_system_configuration.architecture == POWER_PC) )
|
||||
{
|
||||
switch(_system_configuration.implementation)
|
||||
{
|
||||
case POWER_RS1:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS1");
|
||||
break;
|
||||
case POWER_RSC:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RSC");
|
||||
break;
|
||||
case POWER_RS2:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS2");
|
||||
break;
|
||||
case POWER_601:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "601");
|
||||
break;
|
||||
case POWER_603:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "603");
|
||||
break;
|
||||
case POWER_604:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "604");
|
||||
break;
|
||||
case POWER_620:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "620");
|
||||
break;
|
||||
case POWER_630:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "630");
|
||||
break;
|
||||
case POWER_A35:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "A35");
|
||||
break;
|
||||
case POWER_RS64II:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS64II");
|
||||
break;
|
||||
case POWER_RS64III:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS64III");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (_system_configuration.architecture == IA64)
|
||||
{
|
||||
switch(_system_configuration.implementation)
|
||||
{
|
||||
case IA64_M1:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "IA64 M1");
|
||||
break;
|
||||
case IA64_M2:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "IA64 M2");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.width);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "width", buf);
|
||||
|
||||
if (_system_configuration.cache_attrib & 1 )
|
||||
{
|
||||
/* L1 cache is present */
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.icache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L1 instruction cache size", buf);
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.dcache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L1 data cache size", buf);
|
||||
}
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.L2_cache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L2 cache size", buf);
|
||||
}
|
||||
|
||||
sysinfo.flags = _glibtop_sysdeps_sysinfo;
|
||||
}
|
||||
|
||||
const glibtop_sysinfo *
|
||||
glibtop_get_sysinfo_s (glibtop *server)
|
||||
{
|
||||
static int first_time = 1;
|
||||
|
||||
if (first_time)
|
||||
{
|
||||
init_sysinfo();
|
||||
first_time = 0;
|
||||
}
|
||||
|
||||
return &sysinfo;
|
||||
}
|
||||
63
sysdeps/aix/uptime.c
Normal file
63
sysdeps/aix/uptime.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/times.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/uptime.h>
|
||||
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime =
|
||||
(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_BOOT_TIME);
|
||||
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_uptime_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
time_t uptime;
|
||||
struct tms tbuf;
|
||||
|
||||
glibtop_init_s (&server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
buf->uptime = (double)times(&tbuf) / (double)sysconf(_SC_CLK_TCK);
|
||||
buf->boot_time = (guint64) time(NULL) - (guint64) buf->uptime;
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
139
sysdeps/aix/utils.c
Normal file
139
sysdeps/aix/utils.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <nlist.h>
|
||||
|
||||
#include <procinfo.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include "glibtop_suid.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_VMGETINFO
|
||||
#include <dlfcn.h>
|
||||
typedef int (*vmgetinfo_proto)(void *out, int command, int arg);
|
||||
#endif
|
||||
|
||||
off_t
|
||||
_glibtop_get_kmem_offset(glibtop* server, char* kname)
|
||||
{
|
||||
int result;
|
||||
struct nlist kernelnames[] =
|
||||
{ {NULL, 0, 0, 0, 0, 0},
|
||||
{NULL, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
kernelnames[0]._n._n_name = kname;
|
||||
|
||||
glibtop_suid_enter(server);
|
||||
|
||||
result = knlist(kernelnames, 1, sizeof(struct nlist));
|
||||
|
||||
glibtop_suid_leave(server);
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return kernelnames[0].n_value;
|
||||
}
|
||||
|
||||
int
|
||||
_glibtop_get_kmem_info(glibtop* server, off_t offset, void* buf, size_t len)
|
||||
{
|
||||
int result;
|
||||
|
||||
glibtop_suid_enter(server);
|
||||
|
||||
lseek(server->machine->kmem_fd, offset, SEEK_SET);
|
||||
|
||||
result = read(server->machine->kmem_fd, buf, len);
|
||||
|
||||
glibtop_suid_leave(server);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct procsinfo*
|
||||
_glibtop_get_procinfo (glibtop *server, pid_t pid)
|
||||
{
|
||||
int result;
|
||||
pid_t current;
|
||||
static int first_time = 1;
|
||||
|
||||
/* test if procsinfo already found */
|
||||
|
||||
if ((server->machine->last_pinfo.pi_pid == pid) && (!first_time))
|
||||
{
|
||||
return &server->machine->last_pinfo;
|
||||
}
|
||||
|
||||
/* seek procsinfo if given pid */
|
||||
|
||||
first_time = 0;
|
||||
current = 0;
|
||||
while ((result = getprocs( &server->machine->last_pinfo
|
||||
, sizeof(struct procsinfo)
|
||||
, NULL, 0, ¤t, 1)) == 1)
|
||||
{
|
||||
|
||||
if (pid == server->machine->last_pinfo.pi_pid)
|
||||
{
|
||||
return &server->machine->last_pinfo;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef HAVE_VMGETINFO
|
||||
int
|
||||
_glibtop_vmgetinfo (void *out, int command, int arg)
|
||||
{
|
||||
void* handle;
|
||||
|
||||
static vmgetinfo_proto kern_vmgetinfo = NULL;
|
||||
|
||||
if (kern_vmgetinfo == NULL)
|
||||
{
|
||||
handle = dlopen("/unix", RTLD_NOW | RTLD_GLOBAL);
|
||||
if (handle == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
kern_vmgetinfo = dlsym( handle, "vmgetinfo");
|
||||
|
||||
dlclose(handle);
|
||||
|
||||
if (kern_vmgetinfo == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return kern_vmgetinfo(out, command, arg);
|
||||
}
|
||||
#endif
|
||||
2
sysdeps/bsd/AUTHORS
Normal file
2
sysdeps/bsd/AUTHORS
Normal file
@@ -0,0 +1,2 @@
|
||||
Martin Baulig (martin@home-of-linux.org)
|
||||
Josh Sled (jsled@scam.XCF.Berkeley.EDU)
|
||||
485
sysdeps/bsd/ChangeLog
Normal file
485
sysdeps/bsd/ChangeLog
Normal file
@@ -0,0 +1,485 @@
|
||||
2007-05-08 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (_glibtop_bsd_get_fsusage_read_write):
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
|
||||
Fixed build on OpenBSD.
|
||||
Patch by Jasper Lievisse Adriaanse <jasper@nedbsd.nl>.
|
||||
|
||||
2007-02-18 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* AUTHORS:
|
||||
* Makefile.am:
|
||||
* NOTES:
|
||||
* close.c: (glibtop_close_p):
|
||||
* cpu.c: (glibtop_init_cpu_p), (glibtop_get_cpu_p):
|
||||
* fsusage.c: (_glibtop_bsd_get_fsusage_read_write):
|
||||
* glibtop_machine.h:
|
||||
* glibtop_server.h:
|
||||
* glibtop_suid.h:
|
||||
* init.c: (glibtop_init_r):
|
||||
* loadavg.c: (glibtop_init_loadavg_p), (glibtop_get_loadavg_p):
|
||||
* mem.c: (glibtop_init_mem_p), (glibtop_get_mem_p):
|
||||
* msg_limits.c: (glibtop_init_msg_limits_p),
|
||||
(glibtop_get_msg_limits_p):
|
||||
* netlist.c: (glibtop_init_netlist_s), (glibtop_get_netlist_s):
|
||||
* netload.c: (glibtop_init_netload_p), (glibtop_get_netload_p):
|
||||
* nosuid.c: (glibtop_open_s), (glibtop_close_s):
|
||||
* open.c: (glibtop_init_p), (glibtop_open_p):
|
||||
* ppp.c: (glibtop_init_ppp_p), (glibtop_get_ppp_p):
|
||||
* procargs.c: (glibtop_init_proc_args_p),
|
||||
(glibtop_get_proc_args_p):
|
||||
* procdata.c: (glibtop_get_procdata_s):
|
||||
* prockernel.c: (glibtop_init_proc_kernel_p),
|
||||
(glibtop_get_proc_kernel_p):
|
||||
* proclist.c: (glibtop_init_proclist_p), (glibtop_get_proclist_p):
|
||||
* procmap.c: (glibtop_init_proc_map_p), (glibtop_get_proc_map_p):
|
||||
* procmem.c: (glibtop_init_proc_mem_p), (glibtop_get_proc_mem_p):
|
||||
* procopenfiles.c: (glibtop_init_proc_open_files_s),
|
||||
(glibtop_get_proc_open_files_s):
|
||||
* procsegment.c: (glibtop_init_proc_segment_p),
|
||||
(glibtop_get_proc_segment_p):
|
||||
* procsignal.c: (glibtop_init_proc_signal_p),
|
||||
(glibtop_get_proc_signal_p):
|
||||
* procstate.c: (glibtop_init_proc_state_p),
|
||||
(glibtop_get_proc_state_p):
|
||||
* proctime.c: (glibtop_init_proc_time_p):
|
||||
* procuid.c: (glibtop_init_proc_uid_p), (glibtop_get_proc_uid_p):
|
||||
* sem_limits.c: (glibtop_init_sem_limits_p),
|
||||
(glibtop_get_sem_limits_p):
|
||||
* shm_limits.c: (glibtop_init_shm_limits_p),
|
||||
(glibtop_get_shm_limits_p):
|
||||
* siglist.c:
|
||||
* swap.c: (glibtop_init_swap_p), (glibtop_get_swap_p):
|
||||
* sysinfo.c: (init_sysinfo), (glibtop_get_sysinfo_s):
|
||||
* uptime.c: (glibtop_init_uptime_p), (glibtop_get_uptime_p):
|
||||
|
||||
Huge (k)FreeBSD update.
|
||||
(k)FreeBSD support is freebsd/
|
||||
Other BSD are in bsd/
|
||||
|
||||
Patch by Joe Marcus Clarke <marcus@freebsd.org>
|
||||
Alexander Nedotsukov <bland@FreeBSD.org>
|
||||
|
||||
Closes #407693.
|
||||
|
||||
2007-01-31 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write):
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* proctime.c:
|
||||
* siglist.c:
|
||||
* /libgtop-sysdeps.m4:
|
||||
|
||||
Various FreeBSD and kFreeBSD updates.
|
||||
Patch by Roy Marples <uberlord@gentoo.org>.
|
||||
Reviewed by Petr Salinger <Petr.Salinger@seznam.cz>.
|
||||
Closes #387200.
|
||||
|
||||
2006-11-27 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write):
|
||||
* mem.c: (glibtop_get_mem_p):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p):
|
||||
* proclist.c: (glibtop_get_proclist_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* procmem.c: (glibtop_get_proc_mem_p):
|
||||
* procsignal.c: (glibtop_get_proc_signal_p):
|
||||
* procstate.c: (glibtop_get_proc_state_p):
|
||||
* proctime.c:
|
||||
* procuid.c: (glibtop_get_proc_uid_p):
|
||||
* swap.c: (glibtop_init_swap_p), (glibtop_get_swap_p):
|
||||
|
||||
Added kfreebsd support.
|
||||
Patch by Petr Salinger <Petr.Salinger@seznam.cz>.
|
||||
|
||||
2006-04-09 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write):
|
||||
|
||||
Fixed typo.
|
||||
|
||||
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
||||
|
||||
* sysdeps/freebsd/fsusage.c:
|
||||
|
||||
Use statvfs(2) if available instead of statfs(2). The latter was
|
||||
replaced by the former and is no longer available under, e.g. NetBSD.
|
||||
|
||||
Fixes bug #337235.
|
||||
|
||||
2006-04-04 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* sysinfo.c: (init_sysinfo):
|
||||
|
||||
Store only strings in values' values. g_strdup these strings.
|
||||
Even if values is never destroyed, set key_destroy_func to NULL.
|
||||
|
||||
Leave description to NULL.
|
||||
|
||||
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
||||
|
||||
* sysdeps/freebsd/Makefile.am:
|
||||
* sysdeps/freebsd/sysinfo.c:
|
||||
|
||||
Bring back to life (from the 1.x versions) the sysinfo.c file for
|
||||
the freebsd sysdeps. The new file comes from the FreeBSD ports
|
||||
repository and has some minor style changes by me. This is required
|
||||
to get the glibtop_get_sysinfo_s function used by the sysdeps common
|
||||
code.
|
||||
|
||||
Fixes bug #337251.
|
||||
|
||||
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org>
|
||||
|
||||
* sysdeps/freebsd/proctime.c:
|
||||
|
||||
Remove obsolete and non-functional code that breaks the build under
|
||||
NetBSD. It was guarded by a conditional but could not compile
|
||||
anyway because it referred to an undefined variable.
|
||||
|
||||
Fixes bug #337234.
|
||||
|
||||
2005-02-28 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write): Forgot to add
|
||||
this file :)
|
||||
|
||||
2005-02-28 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* cpu.c: (glibtop_get_cpu_p):
|
||||
* netlist.c: (glibtop_get_netlist_s):
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
* procmem.c: (glibtop_get_proc_mem_p):
|
||||
|
||||
Fix a bug in netlist where glibtop_netlist.number was never initialized to 0
|
||||
(this resulted in a NULL pointer dereference in the network load feature
|
||||
of the multiload applet)
|
||||
|
||||
* Add support for getting interface flags and packet counts even on interfaces
|
||||
without IP addresses (needed for the network load feature of the multiload applet)
|
||||
|
||||
* Restore per-process limits in the !FreeBSD or __FreeBSD_version < 500013
|
||||
case
|
||||
|
||||
* Add CPU interrupt time as IOWAIT to get support for the cpu load feature of
|
||||
the multiload applet.
|
||||
|
||||
Patch from marcus@freebsd.org (Joe Marcus Clarke).
|
||||
Closes #168704.
|
||||
|
||||
2005-02-23 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* netlist.c: (glibtop_get_netlist_s):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* procmem.c: (glibtop_get_proc_mem_p):
|
||||
* procopenfiles.c: (glibtop_init_proc_open_files_s),
|
||||
(glibtop_get_proc_open_files_s):
|
||||
* proctime.c:
|
||||
|
||||
Add support for FreeBSD 6-CURRENT.
|
||||
Use the more portable getrlimit to obtain process memory limits.
|
||||
Correctly determine process time.
|
||||
Stub out the procopenfiles() function (this is not yet implemented, however).
|
||||
Fix a nasty infinite loop and memory leak due to a forgot pointer increment.
|
||||
|
||||
Patch from marcus@freebsd.org (Joe Marcus Clarke).
|
||||
Closes #168232.
|
||||
|
||||
2004-12-05 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* netlist.c: (glibtop_init_netlist_s), (glibtop_get_netlist_s):
|
||||
Added glibtop_get_netlist. Patch from marcus@freebsd.org (Joe Marcus Clarke).
|
||||
|
||||
2004-08-28 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mem.c: (glibtop_get_mem_p):
|
||||
* ppp.c:
|
||||
* swap.c: (glibtop_init_swap_p), (glibtop_get_swap_p):
|
||||
* uptime.c: (glibtop_get_uptime_p): Merge a bunch of trivial OpenBSD
|
||||
patchs. To *BSD maintainers : please report bugs ! don't be selfish, share
|
||||
your patchs.
|
||||
|
||||
2004-08-22 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procstate.c:
|
||||
* uptime.c: (glibtop_get_uptime_p): Merged Marcus' patches.
|
||||
|
||||
2004-07-15 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procstate.c: (glibtop_get_proc_state_p): Fixed copy/paste error
|
||||
while setting buf->state.
|
||||
|
||||
2004-06-07 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
* procstate.c: (glibtop_get_proc_state_p):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p): s/strncpy/g_strlcpy/.
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p): Cleaned.
|
||||
|
||||
|
||||
2004-05-26 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* procdata.c: (glibtop_get_procdata_s): Removed Linux related code.
|
||||
|
||||
2004-04-07 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p): patch for NetBSD/AMD64
|
||||
support (Julio M. Merino Vidal <jmmv@menta.net>)
|
||||
|
||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am:
|
||||
* cpu.c: (glibtop_init_cpu_p), (glibtop_get_cpu_p):
|
||||
* glibtop_machine.h:
|
||||
* mem.c:
|
||||
* netload.c: (glibtop_get_netload_p):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p):
|
||||
* proclist.c: (glibtop_get_proclist_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* procmem.c: (glibtop_get_proc_mem_p):
|
||||
* procsignal.c: (glibtop_get_proc_signal_p):
|
||||
* procstate.c: (glibtop_get_proc_state_p):
|
||||
* proctime.c:
|
||||
* procuid.c: (glibtop_get_proc_uid_p):
|
||||
* uptime.c: (glibtop_get_uptime_p): implement NetBSD support, and
|
||||
some build problems on FreeBSD (Closes: #135674)
|
||||
|
||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* swap.c: (glibtop_get_swap_p): fix g_malloc usage on non-Linux
|
||||
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
|
||||
|
||||
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am: install only one library, libgtop-2.0
|
||||
Fix build-time warnings due to the redefinition of guint64
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* mem.c: (glibtop_get_mem_p):
|
||||
* prockernel.c: (glibtop_get_proc_kernel_p):
|
||||
* procmem.c: (glibtop_get_proc_mem_p):
|
||||
* proctime.c: (glibtop_get_proc_time_p): s/u_int64_t/guint64/
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* swap.c: (glibtop_get_swap_p): fix swap sizes in FreeBSD,
|
||||
patch by edwin@mavetju.org
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* glibtop_machine.h:
|
||||
* glibtop_server.h:
|
||||
* glibtop_suid.h:
|
||||
* open.c:
|
||||
* procargs.c:
|
||||
* proclist.c:
|
||||
* procmap.c:
|
||||
* swap.c: fixed compilation
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* procargs.c: (glibtop_get_proc_args_p):
|
||||
* proclist.c: (glibtop_get_proclist_p):
|
||||
* procmap.c: (glibtop_get_proc_map_p):
|
||||
* swap.c: (glibtop_get_swap_p): replace all the xmalloc crap by glib
|
||||
memory management functions
|
||||
|
||||
2001-10-17 Abel Cheung <maddog@linux.org.hk>
|
||||
|
||||
* Makefile.am: move header to $(includedir)/libgtop-1.0/glibtop.
|
||||
|
||||
2001-02-27 Martin Baulig <baulig@suse.de>
|
||||
|
||||
* netload.c: Comment out the `subnet' field on BSDI; this should
|
||||
make it compile. Bug #13345.
|
||||
|
||||
* shm_limits.c, msg_limits.c, sem_limits.c: Applied a patch
|
||||
from Rolf Grossmann (grossman@securitas.net) for FreeBSD 4.2.
|
||||
Fixes #51334.
|
||||
|
||||
2001-02-14 Martin Baulig <baulig@suse.de>
|
||||
|
||||
* proctime.c (glibtop_get_proc_time_p): Make things work on
|
||||
OpenBSD 2.6; this is basically the same than on NetBSD.
|
||||
|
||||
2000-02-13 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* *.c: kvm_nlist () returns -1 on error, but a positive return value
|
||||
does not necessarily mean failure. Fixes #3302 which was reported by
|
||||
Matthias Scheler some time ago.
|
||||
|
||||
1999-10-16 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Applied all patches from the FreeBSD 3.3 ports collection.
|
||||
|
||||
* swap.c: Only #include <rlist.h> for __FreeBSD_version < 400005.
|
||||
|
||||
* prockernel.c: Make it compile on FreeBSD / alpha.
|
||||
|
||||
* procsignal.c: Some fixes for FreeBSD-current.
|
||||
|
||||
1999-10-16 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procstate.c (glibtop_get_proc_state_p): Don't use the
|
||||
`GLIBTOP_PROCESS_*' constants for process states for
|
||||
LibGTop 1.0.x.
|
||||
|
||||
1999-07-29 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* proctime.c (glibtop_get_proc_time_p): Fix bug reported by
|
||||
Takis Psarogiannakopoulos: `start_time' are seconds since the
|
||||
epoch as it is stated in the manual.
|
||||
|
||||
Tue Jun 15 16:04:10 1999 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* procuid.c: A fix to a ommitted case, when nor NetBSD, nor
|
||||
LibGTop >= 1.1.0. This should be investigated closely to cover
|
||||
more cases....
|
||||
|
||||
1999-05-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
More NetBSD 1.4 fixes.
|
||||
|
||||
* mem.c, procmap.c, procmem.c: Make this work with the new UVM code.
|
||||
|
||||
[FIXME: This following most likely works on all BSD systems, but
|
||||
this needs to be tested; I made it conditional to NetBSD 1.4 at
|
||||
the moment. Please extend the conditionals to any other systems
|
||||
where this works ...]
|
||||
|
||||
* procstate.c: Added `ruid' and `rgid' for LibGTop >= 1.1.0.
|
||||
* procuid.c: Added `ngroups' and `groups' for LibGTop >= 1.1.0.
|
||||
|
||||
1999-05-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: Make this work on NetBSD.
|
||||
|
||||
Thu Apr 8 23:47:29 1999 Timur Bakeyev <timur@gnu.org>
|
||||
|
||||
* cpu.c, mem.c, netload.c, procargs.c, procstate.c, proctime.c,
|
||||
sem_limits.c, shm_limits.c, swap.c: Added initial port for BSD/OS
|
||||
(aka BSDI) 2.x and 3.x. 4.x should also(?) work.
|
||||
|
||||
Still, this port require more close look and extended check.
|
||||
|
||||
1999-03-19 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added basic support for BSDI. It compiles without problems on
|
||||
BSDI 2.1 and 3.1, but it is *untested* - I'm neither root on
|
||||
the machine nor have I access to /dev/kmem, so I don't know
|
||||
whether it will work.
|
||||
|
||||
You need to give configure the `--enable-hacker-mode' parameter
|
||||
to use the code.
|
||||
|
||||
If someone can verify whether it actually works, please let me
|
||||
know.
|
||||
|
||||
1999-03-18 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: Don't use `sppp.pp_phase' if we don't HAVE_I4B_ACCT.
|
||||
This is an ugly hack until someone tells me which versions have
|
||||
this field and which not.
|
||||
|
||||
1999-02-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* prockernel.c, proctime.c: Applied patch Stanislav Grozev for
|
||||
OpenBSD: only include <osreldate.h> for FreeBSD.
|
||||
|
||||
1999-02-24 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* swap.c: Applied another patch from Jeremy Lea to
|
||||
make it work with FreeBSD-current.
|
||||
|
||||
1999-02-21 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procmap.c, procmem.c: Applied patch from Jeremy Lea.
|
||||
|
||||
* prockernel.c, proctime.c: Applied patch from the FreeBSD 2.2.8
|
||||
ports collection.
|
||||
|
||||
* procsignal.c: Applied patch from the NetBSD-current ports
|
||||
collection.
|
||||
|
||||
1998-12-06 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* Make it work with OpenBSD 2.4.
|
||||
|
||||
1998-12-05 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* Make it work with NetBSD 1.3.2.
|
||||
|
||||
1998-11-17 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* Make it work with FreeBSD 3.0.
|
||||
|
||||
1998-11-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* *.c: It does not work to get information about the swapper task
|
||||
on FreeBSD 2.2.6, so we simple return if pid == 0.
|
||||
|
||||
1998-10-31 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* *.c: Use glibtop_warn_io_r () instead of glibtop_error_io_r ().
|
||||
|
||||
* proctime.c, prockernel.c, procargs.c: Don't call kvm_uread () if
|
||||
the /proc filesystem is not mounted.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* netload.c: New file to get network load.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file to get command line arguments.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: New file to get PPP/ISDN statistics. Currently this only
|
||||
get ISDN statistics if you have the I4B package.
|
||||
|
||||
To get the number of bytes transferred in/out you need to read the
|
||||
file `misc/i4b_acct.txt' in the LibGTop source directory to see
|
||||
how to enable this.
|
||||
|
||||
1998-10-03 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procstate.c (glibtop_get_procstate_s): Use correct values for
|
||||
the `state' field.
|
||||
|
||||
* proclist.c (glibtop_get_proclist_p): Honor the GLIBTOP_EXCLUDE_IDLE
|
||||
and GLIBTOP_EXCLUDE_SYSTEM flags of the `which' parameter.
|
||||
|
||||
1998-08-24 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'.
|
||||
* cpu.c, mem.c: Removed `const' from sysctl () constants to keep
|
||||
compiler happy.
|
||||
|
||||
* procmem.c: Added missing call to `glibtop_init_p'.
|
||||
|
||||
* prockernel.c: Casting `nwchan' to `unsigned long' since this
|
||||
normally has the same size than a pointer. Well, is there a
|
||||
FreeBSD for 64bit architectures ?
|
||||
|
||||
1998-08-08 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* swap.c: Added swap usage based upton the source code
|
||||
of `pinfo'.
|
||||
|
||||
1998-08-07 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* *: Imported FreeBSD port of libgtop from Josh Sled.
|
||||
|
||||
* ChangeLog: New file.
|
||||
24
sysdeps/bsd/Makefile.am
Normal file
24
sysdeps/bsd/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
|
||||
|
||||
libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS)
|
||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c procaffinity.c \
|
||||
proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c netlist.c \
|
||||
netload.c ppp.c procopenfiles.c fsusage.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h \
|
||||
glibtop_suid.h
|
||||
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
783
sysdeps/bsd/Makefile.in
Normal file
783
sysdeps/bsd/Makefile.in
Normal file
@@ -0,0 +1,783 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = sysdeps/bsd
|
||||
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 \
|
||||
$(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 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/libgtop-sysdeps.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(libgtopinclude_HEADERS) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libgtop_sysdeps_2_0_la_LIBADD =
|
||||
am_libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo sysinfo.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@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libgtop_sysdeps_2_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libgtop_sysdeps_2_0_la_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
am__DEPENDENCIES_1 =
|
||||
libgtop_sysdeps_suid_2_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am_libgtop_sysdeps_suid_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 procaffinity.lo proclist.lo \
|
||||
procstate.lo procuid.lo proctime.lo procmem.lo procsignal.lo \
|
||||
prockernel.lo procsegment.lo procargs.lo procmap.lo netlist.lo \
|
||||
netload.lo ppp.lo procopenfiles.lo fsusage.lo
|
||||
libgtop_sysdeps_suid_2_0_la_OBJECTS = \
|
||||
$(am_libgtop_sysdeps_suid_2_0_la_OBJECTS)
|
||||
libgtop_sysdeps_suid_2_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libgtop_sysdeps_suid_2_0_la_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES) \
|
||||
$(libgtop_sysdeps_suid_2_0_la_SOURCES)
|
||||
DIST_SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES) \
|
||||
$(libgtop_sysdeps_suid_2_0_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libgtopincludedir)"
|
||||
HEADERS = $(libgtopinclude_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__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 AUTHORS \
|
||||
ChangeLog
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB = @DL_LIB@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GTKDOC_CHECK = @GTKDOC_CHECK@
|
||||
GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
|
||||
GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
|
||||
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
|
||||
GTKDOC_MKPDF = @GTKDOC_MKPDF@
|
||||
GTKDOC_REBASE = @GTKDOC_REBASE@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
|
||||
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
|
||||
INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
|
||||
INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
|
||||
INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
|
||||
INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
|
||||
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
|
||||
INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
|
||||
KVM_LIBS = @KVM_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGTOP_BINDIR = @LIBGTOP_BINDIR@
|
||||
LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
|
||||
LIBGTOP_INCS = @LIBGTOP_INCS@
|
||||
LIBGTOP_LIBS = @LIBGTOP_LIBS@
|
||||
LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
|
||||
LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
|
||||
LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
|
||||
LIBGTOP_SERVER = @LIBGTOP_SERVER@
|
||||
LIBGTOP_SERVER_VERSION = @LIBGTOP_SERVER_VERSION@
|
||||
LIBGTOP_VERSION = @LIBGTOP_VERSION@
|
||||
LIBGTOP_VERSION_CODE = @LIBGTOP_VERSION_CODE@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
LT_VERSION_INFO = @LT_VERSION_INFO@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libgtop_have_sysinfo = @libgtop_have_sysinfo@
|
||||
libgtop_need_server = @libgtop_need_server@
|
||||
libgtop_postinstall = @libgtop_postinstall@
|
||||
libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
|
||||
libgtop_top_builddir = @libgtop_top_builddir@
|
||||
libs_xauth = @libs_xauth@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
server_programs = @server_programs@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysdeps_dir = @sysdeps_dir@
|
||||
sysdeps_suid_lib = @sysdeps_suid_lib@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
|
||||
libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c
|
||||
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS)
|
||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c procaffinity.c \
|
||||
proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c netlist.c \
|
||||
netload.c ppp.c procopenfiles.c fsusage.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h \
|
||||
glibtop_suid.h
|
||||
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bsd/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/bsd/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libgtop_sysdeps-2.0.la: $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_sysdeps_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libgtop_sysdeps_2_0_la_LINK) $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
libgtop_sysdeps_suid-2.0.la: $(libgtop_sysdeps_suid_2_0_la_OBJECTS) $(libgtop_sysdeps_suid_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_sysdeps_suid_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libgtop_sysdeps_suid_2_0_la_LINK) $(libgtop_sysdeps_suid_2_0_la_OBJECTS) $(libgtop_sysdeps_suid_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsusage.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadavg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netload.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nosuid.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procaffinity.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procargs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prockernel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proclist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procopenfiles.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsegment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsignal.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procstate.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proctime.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procuid.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shm_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/siglist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysinfo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-libgtopincludeHEADERS: $(libgtopinclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libgtopincludedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libgtopincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-libgtopincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(libgtopincludedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libgtopincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-libgtopincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libgtopincludeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-libgtopincludeHEADERS install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-libgtopincludeHEADERS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
30
sysdeps/bsd/close.c
Normal file
30
sysdeps/bsd/close.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_p (glibtop *server)
|
||||
{ }
|
||||
142
sysdeps/bsd/cpu.c
Normal file
142
sysdeps/bsd/cpu.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/sched.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
|
||||
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
|
||||
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY) +
|
||||
(1L << GLIBTOP_CPU_IOWAIT);
|
||||
|
||||
#ifndef KERN_CP_TIME
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
#ifdef __bsdi__
|
||||
{ "_cpustats" },
|
||||
#else
|
||||
{ "_cp_time" },
|
||||
#endif
|
||||
{ 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* MIB array for sysctl */
|
||||
static int mib_length=2;
|
||||
static int mib [] = { CTL_KERN, KERN_CLOCKRATE };
|
||||
#ifdef KERN_CP_TIME
|
||||
static int mib2 [] = { CTL_KERN, KERN_CP_TIME };
|
||||
#endif
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_cpu_p (glibtop *server)
|
||||
{
|
||||
#ifndef KERN_CP_TIME
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (cpu)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set this only if kvm_nlist () succeeded. */
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
#ifdef KERN_CP_TIME
|
||||
guint64 cpts [CPUSTATES];
|
||||
#else
|
||||
long cpts [CPUSTATES];
|
||||
#endif
|
||||
/* sysctl vars*/
|
||||
struct clockinfo ci;
|
||||
size_t length;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
/* If this fails, the nlist may not be valid. */
|
||||
if (server->sysdeps.cpu == 0)
|
||||
return;
|
||||
|
||||
#ifdef KERN_CP_TIME
|
||||
length = sizeof (cpts);
|
||||
if (sysctl (mib2, mib_length, cpts, &length, NULL, 0)) {
|
||||
glibtop_warn_io_r (server, "sysctl");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&cpts, sizeof (cpts)) != sizeof (cpts)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (cp_time)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get the clockrate data */
|
||||
length = sizeof (struct clockinfo);
|
||||
if (sysctl (mib, mib_length, &ci, &length, NULL, 0)) {
|
||||
glibtop_warn_io_r (server, "sysctl");
|
||||
return;
|
||||
}
|
||||
|
||||
/* set user time */
|
||||
buf->user = cpts [CP_USER];
|
||||
/* set nice time */
|
||||
buf->nice = cpts [CP_NICE];
|
||||
/* set sys time */
|
||||
buf->sys = cpts [CP_SYS];
|
||||
/* set idle time */
|
||||
buf->idle = cpts [CP_IDLE];
|
||||
/* set iowait (really just interrupt) time */
|
||||
buf->iowait = cpts [CP_INTR];
|
||||
|
||||
/* set frequency */
|
||||
/*
|
||||
FIXME -- is hz, tick, profhz or stathz wanted?
|
||||
buf->frequency = sysctl("kern.clockrate", ...);
|
||||
|
||||
struct clockinfo
|
||||
*/
|
||||
buf->frequency = ci.hz;
|
||||
/* set total */
|
||||
buf->total = cpts [CP_USER] + cpts [CP_NICE]
|
||||
+ cpts [CP_SYS] + cpts [CP_IDLE];
|
||||
|
||||
/* Set the flags last. */
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
61
sysdeps/bsd/fsusage.c
Normal file
61
sysdeps/bsd/fsusage.c
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <config.h>
|
||||
|
||||
/* Although FreeBSD ships with statvfs it seems incomplete, so prefer statfs */
|
||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
||||
#undef HAVE_SYS_STATVFS_H
|
||||
#undef STAT_STATVFS
|
||||
#endif
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#if defined (HAVE_SYS_STATVFS_H)
|
||||
#include <sys/statvfs.h>
|
||||
#else
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
_glibtop_bsd_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path);
|
||||
|
||||
void
|
||||
_glibtop_bsd_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path)
|
||||
{
|
||||
int result;
|
||||
#if defined (STAT_STATVFS)
|
||||
struct statvfs sfs;
|
||||
#else
|
||||
struct statfs sfs;
|
||||
#endif
|
||||
|
||||
#if defined (STAT_STATVFS)
|
||||
result = statvfs (path, &sfs);
|
||||
#else
|
||||
result = statfs (path, &sfs);
|
||||
#endif
|
||||
|
||||
if (result == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(__OpenBSD__)
|
||||
buf->read = sfs.f_syncreads + sfs.f_asyncreads;
|
||||
#endif
|
||||
buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
|
||||
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
|
||||
}
|
||||
63
sysdeps/bsd/glibtop_machine.h
Normal file
63
sysdeps/bsd/glibtop_machine.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <nlist.h>
|
||||
#include <kvm.h>
|
||||
#include <sys/dkstat.h>
|
||||
#include <time.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/proc.h>
|
||||
|
||||
#ifndef SRUN
|
||||
#define SRUN SACTIVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
uid_t uid, euid;
|
||||
gid_t gid, egid;
|
||||
|
||||
/* The kernel descriptor, used by kvm_* calls. We keep and re-use
|
||||
* it rather than re-getting it for almost all function
|
||||
* invocations. */
|
||||
kvm_t *kd;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIBTOP_MACHINE_H__ */
|
||||
53
sysdeps/bsd/glibtop_server.h
Normal file
53
sysdeps/bsd/glibtop_server.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SERVER_H__
|
||||
#define __GLIBTOP_SERVER_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SUID_CPU (1 << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_SUID_MEM (1 << GLIBTOP_SYSDEPS_MEM)
|
||||
#define GLIBTOP_SUID_SWAP (1 << GLIBTOP_SYSDEPS_SWAP)
|
||||
#define GLIBTOP_SUID_UPTIME (1 << GLIBTOP_SYSDEPS_UPTIME)
|
||||
#define GLIBTOP_SUID_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_SUID_SHM_LIMITS (1 << GLIBTOP_SYSDEPS_SHM_LIMITS)
|
||||
#define GLIBTOP_SUID_MSG_LIMITS (1 << GLIBTOP_SYSDEPS_MSG_LIMITS)
|
||||
#define GLIBTOP_SUID_SEM_LIMITS (1 << GLIBTOP_SYSDEPS_SEM_LIMITS)
|
||||
#define GLIBTOP_SUID_PROCLIST (1 << GLIBTOP_SYSDEPS_PROCLIST)
|
||||
#define GLIBTOP_SUID_PROC_STATE (1 << GLIBTOP_SYSDEPS_PROC_STATE)
|
||||
#define GLIBTOP_SUID_PROC_UID (1 << GLIBTOP_SYSDEPS_PROC_UID)
|
||||
#define GLIBTOP_SUID_PROC_MEM (1 << GLIBTOP_SYSDEPS_PROC_MEM)
|
||||
#define GLIBTOP_SUID_PROC_TIME (1 << GLIBTOP_SYSDEPS_PROC_TIME)
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
|
||||
#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
|
||||
#define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS)
|
||||
#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP)
|
||||
#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
|
||||
#define GLIBTOP_SUID_PROC_WD 0
|
||||
#define GLIBTOP_SUID_PROC_AFFINITY 0
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
56
sysdeps/bsd/glibtop_suid.h
Normal file
56
sysdeps/bsd/glibtop_suid.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SUID_H__
|
||||
#define __GLIBTOP_SUID_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if _IN_LIBGTOP
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#define KI_PROC(ki) (&(ki))->kp_proc)
|
||||
#define KI_EPROC(ki) (&(ki))->kp_eproc)
|
||||
|
||||
#define FORCEUREAD 1
|
||||
#define UREADOK(ki) (FORCEUREAD || (KI_PROC(ki)->p_flag & P_INMEM))
|
||||
|
||||
static inline void glibtop_suid_enter (glibtop *server) {
|
||||
setregid (server->machine->gid, server->machine->egid);
|
||||
};
|
||||
|
||||
static inline void glibtop_suid_leave (glibtop *server) {
|
||||
if (setregid (server->machine->egid, server->machine->gid))
|
||||
_exit (1);
|
||||
};
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags);
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
59
sysdeps/bsd/loadavg.c
Normal file
59
sysdeps/bsd/loadavg.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/loadavg.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1L << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_loadavg_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
double ldavg[3];
|
||||
int i;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
getloadavg (ldavg, 3);
|
||||
|
||||
/* fill in the struct */
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
for (i = 0; i < 3; i++) {
|
||||
buf->loadavg [i] = ldavg [i];
|
||||
} /* end for */
|
||||
}
|
||||
222
sysdeps/bsd/mem.c
Normal file
222
sysdeps/bsd/mem.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/mem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ < 105020000)
|
||||
#include <vm/vm_param.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
|
||||
(1L << GLIBTOP_MEM_FREE) +
|
||||
(1L << GLIBTOP_MEM_SHARED) +
|
||||
(1L << GLIBTOP_MEM_BUFFER) +
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
(1L << GLIBTOP_MEM_CACHED) +
|
||||
#endif
|
||||
(1L << GLIBTOP_MEM_USER) + (1L << GLIBTOP_MEM_LOCKED);
|
||||
|
||||
#ifndef LOG1024
|
||||
#define LOG1024 10
|
||||
#endif
|
||||
|
||||
/* these are for getting the memory statistics */
|
||||
static int pageshift; /* log base 2 of the pagesize */
|
||||
|
||||
/* define pagetok in terms of pageshift */
|
||||
#define pagetok(size) ((size) << pageshift)
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
{ "_bufpages" },
|
||||
{ 0 }
|
||||
#else
|
||||
#if defined(__bsdi__)
|
||||
{ "_bufcachemem" },
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
{ "_bufspace" },
|
||||
#else
|
||||
{ "_bufpages" },
|
||||
#endif
|
||||
{ "_cnt" },
|
||||
{ 0 }
|
||||
#endif
|
||||
};
|
||||
|
||||
/* MIB array for sysctl */
|
||||
#ifdef __bsdi__
|
||||
static int mib [] = { CTL_VM, VM_TOTAL };
|
||||
#else
|
||||
static int mib [] = { CTL_VM, VM_METER };
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
|
||||
#endif
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_mem_p (glibtop *server)
|
||||
{
|
||||
register int pagesize;
|
||||
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (mem)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the page size with "getpagesize" and calculate pageshift
|
||||
* from it */
|
||||
pagesize = getpagesize ();
|
||||
pageshift = 0;
|
||||
while (pagesize > 1) {
|
||||
pageshift++;
|
||||
pagesize >>= 1;
|
||||
}
|
||||
|
||||
/* we only need the amount of log(2)1024 for our conversion */
|
||||
pageshift -= LOG1024;
|
||||
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
struct vmtotal vmt;
|
||||
size_t length_vmt;
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
struct uvmexp uvmexp;
|
||||
size_t length_uvmexp;
|
||||
#else
|
||||
struct vmmeter vmm;
|
||||
#endif
|
||||
u_int v_used_count;
|
||||
u_int v_total_count;
|
||||
u_int v_free_count;
|
||||
int bufspace;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
if (server->sysdeps.mem == 0)
|
||||
return;
|
||||
|
||||
/* [FIXME: On FreeBSD 2.2.6, sysctl () returns an incorrect
|
||||
* value for `vmt.vm'. We use some code from Unix top
|
||||
* here.] */
|
||||
|
||||
/* Get the data from sysctl */
|
||||
length_vmt = sizeof (vmt);
|
||||
if (sysctl (mib, 2, &vmt, &length_vmt, NULL, 0)) {
|
||||
glibtop_warn_io_r (server, "sysctl (vmt)");
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
length_uvmexp = sizeof (uvmexp);
|
||||
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
|
||||
glibtop_warn_io_r (server, "sysctl (uvmexp)");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
/* Get the data from kvm_* */
|
||||
if (kvm_read (server->machine->kd, nlst[1].n_value,
|
||||
&vmm, sizeof (vmm)) != sizeof (vmm)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (cnt)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[0].n_value,
|
||||
&bufspace, sizeof (bufspace)) != sizeof (bufspace)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (bufspace)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* convert memory stats to Kbytes */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
v_total_count = vmm.v_page_count;
|
||||
#else
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
v_total_count = uvmexp.reserve_kernel +
|
||||
uvmexp.reserve_pagedaemon +
|
||||
uvmexp.free + uvmexp.wired + uvmexp.active +
|
||||
uvmexp.inactive;
|
||||
#else
|
||||
v_total_count = vmm.v_kernel_pages +
|
||||
vmm.v_free_count + vmm.v_wire_count +
|
||||
vmm.v_active_count + vmm.v_inactive_count;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
v_used_count = uvmexp.active + uvmexp.inactive;
|
||||
v_free_count = uvmexp.free;
|
||||
#else
|
||||
v_used_count = vmm.v_active_count + vmm.v_inactive_count;
|
||||
v_free_count = vmm.v_free_count;
|
||||
#endif
|
||||
|
||||
buf->total = (guint64) pagetok (v_total_count) << LOG1024;
|
||||
buf->used = (guint64) pagetok (v_used_count) << LOG1024;
|
||||
buf->free = (guint64) pagetok (v_free_count) << LOG1024;
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
buf->cached = (guint64) pagetok (vmm.v_cache_count) << LOG1024;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
buf->locked = (guint64) pagetok (uvmexp.wired) << LOG1024;
|
||||
#else
|
||||
buf->locked = (guint64) pagetok (vmm.v_wire_count) << LOG1024;
|
||||
#endif
|
||||
|
||||
buf->shared = (guint64) pagetok (vmt.t_rmshr) << LOG1024;
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
buf->buffer = (guint64) bufspace;
|
||||
#else
|
||||
buf->buffer = (guint64) pagetok (bufspace) << LOG1024;
|
||||
#endif
|
||||
|
||||
/* user */
|
||||
buf->user = buf->total - buf->free - buf->shared - buf->buffer;
|
||||
|
||||
/* Set the values to return */
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
}
|
||||
114
sysdeps/bsd/msg_limits.c
Normal file
114
sysdeps/bsd/msg_limits.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, August 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/msg_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#if (defined __bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
_glibtop_init_msg_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Define the appropriate macro (if any) to get declaration of `struct
|
||||
* msginfo'. Needed on, at least, FreeBSD. */
|
||||
#if defined (STRUCT_MSGINFO_NEEDS_KERNEL)
|
||||
#define KERNEL 1
|
||||
#elif defined (STRUCT_MSGINFO_NEEDS__KERNEL)
|
||||
#define _KERNEL 1
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNI) +
|
||||
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGTQL) +
|
||||
(1L << GLIBTOP_IPC_MSGSSZ);
|
||||
|
||||
/* The values in this structure never change at runtime, so we only
|
||||
* read it once during initialization. We have to use the name `_msginfo'
|
||||
* since `msginfo' is already declared external in <sys/msg.h>. */
|
||||
static struct msginfo _msginfo;
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
{ "_msginfo" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (msg_limits)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&_msginfo, sizeof (_msginfo)) != sizeof (_msginfo)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (msginfo)");
|
||||
return;
|
||||
}
|
||||
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
if (server->sysdeps.msg_limits == 0)
|
||||
return;
|
||||
|
||||
buf->msgmax = _msginfo.msgmax;
|
||||
buf->msgmni = _msginfo.msgmni;
|
||||
buf->msgmnb = _msginfo.msgmnb;
|
||||
buf->msgtql = _msginfo.msgtql;
|
||||
buf->msgssz = _msginfo.msgtql;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
#endif /* either a newer BSDI or no BSDI at all. */
|
||||
|
||||
66
sysdeps/bsd/netlist.c
Normal file
66
sysdeps/bsd/netlist.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
This file is part of LibGTop 2.0.
|
||||
|
||||
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/netlist.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netlist = (1 << GLIBTOP_NETLIST_NUMBER);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netlist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netlist = _glibtop_sysdeps_netlist;
|
||||
}
|
||||
|
||||
|
||||
char**
|
||||
glibtop_get_netlist_s (glibtop *server, glibtop_netlist *buf)
|
||||
{
|
||||
struct if_nameindex *ifstart, *ifs;
|
||||
GPtrArray *devices;
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_NETLIST, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netlist));
|
||||
|
||||
ifs = ifstart = if_nameindex();
|
||||
|
||||
devices = g_ptr_array_new();
|
||||
|
||||
while(ifs && ifs->if_name) {
|
||||
g_ptr_array_add(devices, g_strdup(ifs->if_name));
|
||||
buf->number++;
|
||||
ifs++;
|
||||
}
|
||||
|
||||
if_freenameindex(ifstart);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_netlist;
|
||||
|
||||
g_ptr_array_add(devices, NULL);
|
||||
|
||||
return (char **) g_ptr_array_free(devices, FALSE);
|
||||
}
|
||||
|
||||
244
sysdeps/bsd/netload.c
Normal file
244
sysdeps/bsd/netload.c
Normal file
@@ -0,0 +1,244 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#ifdef HAVE_NET_IF_VAR_H
|
||||
#include <net/if_var.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netload =
|
||||
(1L << GLIBTOP_NETLOAD_IF_FLAGS) +
|
||||
(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
|
||||
(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
|
||||
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
|
||||
(1L << GLIBTOP_NETLOAD_BYTES_IN) +
|
||||
(1L << GLIBTOP_NETLOAD_BYTES_OUT) +
|
||||
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
|
||||
(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
|
||||
(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
|
||||
(1L << GLIBTOP_NETLOAD_ERRORS_TOTAL) +
|
||||
(1L << GLIBTOP_NETLOAD_COLLISIONS);
|
||||
|
||||
static const unsigned _glibtop_sysdeps_netload_data =
|
||||
(1L << GLIBTOP_NETLOAD_ADDRESS) +
|
||||
#if !defined(__bsdi__)
|
||||
(1L << GLIBTOP_NETLOAD_SUBNET) +
|
||||
#endif
|
||||
(1L << GLIBTOP_NETLOAD_MTU);
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
{ "_ifnet" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netload_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0)
|
||||
glibtop_error_io_r (server, "kvm_nlist");
|
||||
}
|
||||
|
||||
/* Provides Network statistics. */
|
||||
|
||||
void
|
||||
glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
struct ifnet ifnet;
|
||||
u_long ifnetaddr, ifnetfound;
|
||||
struct sockaddr *sa = NULL;
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version < 501113)) || defined(__bsdi__)
|
||||
char tname [16];
|
||||
#endif
|
||||
char name [32];
|
||||
|
||||
union {
|
||||
struct ifaddr ifa;
|
||||
struct in_ifaddr in;
|
||||
} ifaddr;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_NETLOAD), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&ifnetaddr, sizeof (ifnetaddr)) != sizeof (ifnetaddr))
|
||||
glibtop_error_io_r (server, "kvm_read (ifnet)");
|
||||
|
||||
while (ifnetaddr) {
|
||||
struct sockaddr_in *sin;
|
||||
register char *cp;
|
||||
u_long ifaddraddr;
|
||||
|
||||
{
|
||||
ifnetfound = ifnetaddr;
|
||||
|
||||
if (kvm_read (server->machine->kd, ifnetaddr, &ifnet,
|
||||
sizeof (ifnet)) != sizeof (ifnet))
|
||||
glibtop_error_io_r (server, "kvm_read (ifnetaddr)");
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version < 501113)) || defined(__bsdi__)
|
||||
if (kvm_read (server->machine->kd, (u_long) ifnet.if_name,
|
||||
tname, 16) != 16)
|
||||
glibtop_error_io_r (server, "kvm_read (if_name)");
|
||||
tname[15] = '\0';
|
||||
snprintf (name, 32, "%s%d", tname, ifnet.if_unit);
|
||||
#else
|
||||
g_strlcpy (name, ifnet.if_xname, sizeof(name));
|
||||
#endif
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
|
||||
ifnetaddr = (u_long) ifnet.if_link.tqe_next;
|
||||
#elif defined(__FreeBSD__) || defined(__bsdi__)
|
||||
ifnetaddr = (u_long) ifnet.if_next;
|
||||
#else
|
||||
ifnetaddr = (u_long) ifnet.if_list.tqe_next;
|
||||
#endif
|
||||
|
||||
if (strcmp (name, interface) != 0)
|
||||
continue;
|
||||
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
|
||||
ifaddraddr = (u_long) ifnet.if_addrhead.tqh_first;
|
||||
#elif defined(__FreeBSD__) || defined(__bsdi__)
|
||||
ifaddraddr = (u_long) ifnet.if_addrlist;
|
||||
#else
|
||||
ifaddraddr = (u_long) ifnet.if_addrlist.tqh_first;
|
||||
#endif
|
||||
}
|
||||
if (ifnet.if_flags & IFF_UP)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP);
|
||||
if (ifnet.if_flags & IFF_BROADCAST)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST);
|
||||
if (ifnet.if_flags & IFF_DEBUG)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG);
|
||||
if (ifnet.if_flags & IFF_LOOPBACK)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
|
||||
if (ifnet.if_flags & IFF_POINTOPOINT)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
|
||||
#ifdef IFF_DRV_RUNNING
|
||||
if (ifnet.if_drv_flags & IFF_DRV_RUNNING)
|
||||
#else
|
||||
if (ifnet.if_flags & IFF_RUNNING)
|
||||
#endif
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
|
||||
if (ifnet.if_flags & IFF_NOARP)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
|
||||
if (ifnet.if_flags & IFF_PROMISC)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
|
||||
if (ifnet.if_flags & IFF_ALLMULTI)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
|
||||
#ifdef IFF_DRV_OACTIVE
|
||||
if (ifnet.if_drv_flags & IFF_DRV_OACTIVE)
|
||||
#else
|
||||
if (ifnet.if_flags & IFF_OACTIVE)
|
||||
#endif
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_OACTIVE);
|
||||
if (ifnet.if_flags & IFF_SIMPLEX)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_SIMPLEX);
|
||||
if (ifnet.if_flags & IFF_LINK0)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK0);
|
||||
if (ifnet.if_flags & IFF_LINK1)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK1);
|
||||
if (ifnet.if_flags & IFF_LINK2)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK2);
|
||||
#ifdef __FreeBSD__
|
||||
if (ifnet.if_flags & IFF_ALTPHYS)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALTPHYS);
|
||||
#endif
|
||||
if (ifnet.if_flags & IFF_MULTICAST)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
|
||||
|
||||
buf->packets_in = ifnet.if_ipackets;
|
||||
buf->packets_out = ifnet.if_opackets;
|
||||
buf->packets_total = buf->packets_in + buf->packets_out;
|
||||
|
||||
buf->bytes_in = ifnet.if_ibytes;
|
||||
buf->bytes_out = ifnet.if_obytes;
|
||||
buf->bytes_total = buf->bytes_in + buf->bytes_out;
|
||||
|
||||
buf->errors_in = ifnet.if_ierrors;
|
||||
buf->errors_out = ifnet.if_oerrors;
|
||||
buf->errors_total = buf->errors_in + buf->errors_out;
|
||||
|
||||
buf->collisions = ifnet.if_collisions;
|
||||
buf->flags = _glibtop_sysdeps_netload;
|
||||
|
||||
while (ifaddraddr) {
|
||||
if ((kvm_read (server->machine->kd, ifaddraddr, &ifaddr,
|
||||
sizeof (ifaddr)) != sizeof (ifaddr)))
|
||||
glibtop_error_io_r (server, "kvm_read (ifaddraddr)");
|
||||
|
||||
#define CP(x) ((char *)(x))
|
||||
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
|
||||
CP(&ifaddr);
|
||||
sa = (struct sockaddr *)cp;
|
||||
|
||||
if (sa->sa_family == AF_LINK) {
|
||||
struct sockaddr_dl *dl = (struct sockaddr_dl *) sa;
|
||||
|
||||
memcpy (buf->hwaddress, LLADDR (dl), sizeof (buf->hwaddress));
|
||||
buf->flags |= GLIBTOP_NETLOAD_HWADDRESS;
|
||||
} else if (sa->sa_family == AF_INET) {
|
||||
sin = (struct sockaddr_in *)sa;
|
||||
#if !defined(__bsdi__)
|
||||
/* Commenting out to "fix" #13345. */
|
||||
buf->subnet = htonl (ifaddr.in.ia_subnet);
|
||||
#endif
|
||||
buf->address = sin->sin_addr.s_addr;
|
||||
buf->mtu = ifnet.if_mtu;
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_netload_data;
|
||||
} else if (sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
|
||||
|
||||
memcpy (buf->address6, &sin6->sin6_addr, sizeof (buf->address6));
|
||||
buf->flags |= GLIBTOP_NETLOAD_ADDRESS6;
|
||||
}
|
||||
/* FIXME prefix6, scope6 */
|
||||
#if defined (__OpenBSD__)
|
||||
ifaddraddr = (u_long) ifaddr.ifa.ifa_list.tqe_next;
|
||||
#else
|
||||
ifaddraddr = (u_long) ifaddr.ifa.ifa_link.tqe_next;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
36
sysdeps/bsd/nosuid.c
Normal file
36
sysdeps/bsd/nosuid.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/close.h>
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server,
|
||||
const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{ }
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
||||
94
sysdeps/bsd/open.c
Normal file
94
sysdeps/bsd/open.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/init_hooks.h>
|
||||
|
||||
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
const _glibtop_init_func_t *init_fkt;
|
||||
|
||||
if (server == NULL)
|
||||
glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
|
||||
|
||||
/* Do the initialization, but only if not already initialized. */
|
||||
|
||||
if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
|
||||
glibtop_open_p (server, "glibtop", features, flags);
|
||||
|
||||
for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
|
||||
(*init_fkt) (server);
|
||||
|
||||
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||
fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
|
||||
#endif
|
||||
|
||||
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
|
||||
|
||||
server->machine->uid = getuid ();
|
||||
server->machine->euid = geteuid ();
|
||||
server->machine->gid = getgid ();
|
||||
server->machine->egid = getegid ();
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
server->os_version_code = __FreeBSD_version;
|
||||
#endif
|
||||
|
||||
/* Setup machine-specific data */
|
||||
server->machine->kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");
|
||||
|
||||
if (server->machine->kd == NULL)
|
||||
glibtop_error_io_r (server, "kvm_open");
|
||||
|
||||
/* Drop priviledges. */
|
||||
|
||||
if (setreuid (server->machine->euid, server->machine->uid))
|
||||
_exit (1);
|
||||
|
||||
if (setregid (server->machine->egid, server->machine->gid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
/* Our effective uid is now those of the user invoking the server,
|
||||
* so we do no longer have any priviledges. */
|
||||
|
||||
/* NOTE: On FreeBSD, we do not need to be suid root, we just need to
|
||||
* be sgid kmem.
|
||||
*
|
||||
* The server will only use setegid() to get back it's priviledges,
|
||||
* so it will fail if it is suid root and not sgid kmem. */
|
||||
}
|
||||
143
sysdeps/bsd/ppp.c
Normal file
143
sysdeps/bsd/ppp.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/ppp.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#ifdef HAVE_I4B
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#ifdef HAVE_NET_IF_VAR_H
|
||||
#include <net/if_var.h>
|
||||
#endif
|
||||
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <net/if_sppp.h>
|
||||
#else
|
||||
#include <i4b/sppp/if_sppp.h>
|
||||
#endif
|
||||
|
||||
/* Read `misc/i4b_acct.txt' for details ... */
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
#include <machine/i4b_acct.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_ppp =
|
||||
(1L << GLIBTOP_PPP_STATE);
|
||||
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
static const unsigned long _glibtop_sysdeps_ppp_acct =
|
||||
(1L << GLIBTOP_PPP_BYTES_IN) + (1L << GLIBTOP_PPP_BYTES_OUT);
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_I4B */
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
#ifdef HAVE_I4B
|
||||
{ "_i4bisppp_softc" },
|
||||
#endif
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_ppp_p (glibtop *server)
|
||||
{
|
||||
#ifdef HAVE_I4B
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp |
|
||||
_glibtop_sysdeps_ppp_acct;
|
||||
#else
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
#endif
|
||||
#endif /* HAVE_I4B */
|
||||
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0)
|
||||
glibtop_error_io_r (server, "kvm_nlist");
|
||||
}
|
||||
|
||||
/* Provides information about ppp usage. */
|
||||
|
||||
void
|
||||
glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
#ifdef HAVE_I4B
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
struct i4bisppp_softc data;
|
||||
#else
|
||||
struct sppp data;
|
||||
#endif
|
||||
int phase;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PPP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&data, sizeof (data)) != sizeof (data))
|
||||
glibtop_error_io_r (server, "kvm_read (i4bisppp_softc)");
|
||||
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
phase = data.sc_if_un.scu_sp.pp_phase;
|
||||
#else
|
||||
/* FIXME: Which FreeBSD version have this field and
|
||||
* which not. */
|
||||
#if 0
|
||||
phase = data.pp_phase;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (phase) {
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
case PHASE_DEAD:
|
||||
case PHASE_TERMINATE:
|
||||
buf->state = GLIBTOP_PPP_STATE_HANGUP;
|
||||
break;
|
||||
case PHASE_ESTABLISH:
|
||||
case PHASE_NETWORK:
|
||||
buf->state = GLIBTOP_PPP_STATE_ONLINE;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
buf->state = GLIBTOP_PPP_STATE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_ppp;
|
||||
|
||||
#ifdef HAVE_I4B_ACCT
|
||||
buf->bytes_in = data.sc_inb;
|
||||
buf->bytes_out = data.sc_outb;
|
||||
buf->flags |= _glibtop_sysdeps_ppp_acct;
|
||||
#endif
|
||||
#endif /* HAVE_I4B */
|
||||
}
|
||||
87
sysdeps/bsd/procaffinity.c
Normal file
87
sysdeps/bsd/procaffinity.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* Copyright (C) 2008 Juan Romero Pardines <xtraeme@gmail.com>
|
||||
|
||||
This file is part of LibGTop 2.
|
||||
|
||||
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., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/procaffinity.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#if __NetBSD_Version__ >= 499007200 /* 4.99.72 to play safe */
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
_glibtop_init_proc_affinity_s(glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_affinity =
|
||||
(1 << GLIBTOP_PROC_AFFINITY_NUMBER) |
|
||||
(1 << GLIBTOP_PROC_AFFINITY_ALL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
guint16 *
|
||||
glibtop_get_proc_affinity_s(glibtop *server, glibtop_proc_affinity *buf, pid_t pid)
|
||||
{
|
||||
#if __NetBSD_Version__ >= 499007200
|
||||
cpuset_t *cpuset;
|
||||
size_t i;
|
||||
GArray* cpus;
|
||||
|
||||
memset(buf, 0, sizeof *buf);
|
||||
|
||||
/* create the cpuset(3) */
|
||||
cpuset = cpuset_create();
|
||||
if (cpuset == NULL) {
|
||||
glibtop_error_r(server, "cpuset_getaffinity (cpuset_create) failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the affinity for _this_ pid, I assume that we always want lid 0 */
|
||||
if ((_sched_getaffinity(pid, 0, cpuset_size(cpuset), cpuset)) != 0) {
|
||||
cpuset_destroy(cpuset);
|
||||
glibtop_error_r(server, "cpuset_getaffinity (_sched_getaffinity) failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cpus = g_array_new(FALSE, FALSE, sizeof(guint16));
|
||||
|
||||
for (i = 0; i < MIN(cpuset_size(cpuset), (size_t)(server->ncpu + 1)); i++) {
|
||||
if (cpuset_isset(i, cpuset)) {
|
||||
guint16 n = i;
|
||||
g_array_append_val(cpus, n);
|
||||
}
|
||||
}
|
||||
|
||||
buf->number = cpus->len;
|
||||
buf->all = (cpus->len == (size_t)(server->ncpu + 1));
|
||||
buf->flags = (1 << GLIBTOP_PROC_AFFINITY_NUMBER)
|
||||
| (1 << GLIBTOP_PROC_AFFINITY_ALL);
|
||||
|
||||
/* we are done */
|
||||
cpuset_destroy(cpuset);
|
||||
|
||||
return (guint16*) g_array_free(cpus, FALSE);
|
||||
#else
|
||||
memset(buf, 0, sizeof *buf);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
108
sysdeps/bsd/procargs.c
Normal file
108
sysdeps/bsd/procargs.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
(1L << GLIBTOP_PROC_ARGS_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_args_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
char *
|
||||
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
char *retval, **args, **ptr;
|
||||
size_t size = 0, pos = 0;
|
||||
int count;
|
||||
|
||||
#ifndef __bsdi__
|
||||
char filename [BUFSIZ];
|
||||
struct stat statb;
|
||||
#endif
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
|
||||
if (pid < 5) return NULL;
|
||||
|
||||
#ifndef __bsdi__
|
||||
sprintf (filename, "/proc/%d/mem", pid);
|
||||
if (stat (filename, &statb)) return NULL;
|
||||
#endif
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count < 1)) {
|
||||
glibtop_suid_leave (server);
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
args = kvm_getargv (server->machine->kd, pinfo, max_len);
|
||||
if (args == NULL) {
|
||||
glibtop_suid_leave (server);
|
||||
glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
for (ptr = args; *ptr; ptr++)
|
||||
size += strlen (*ptr)+1;
|
||||
|
||||
size += 2;
|
||||
retval = g_malloc0 (size);
|
||||
|
||||
for (ptr = args; *ptr; ptr++) {
|
||||
const size_t len = strlen (*ptr)+1;
|
||||
memcpy (retval+pos, *ptr, len);
|
||||
pos += len;
|
||||
}
|
||||
|
||||
buf->size = pos ? pos-1 : 0;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return retval;
|
||||
}
|
||||
270
sysdeps/bsd/prockernel.c
Normal file
270
sysdeps/bsd/prockernel.c
Normal file
@@ -0,0 +1,270 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#if (!defined __OpenBSD__) && (!defined __bsdi__)
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__)) && \
|
||||
!defined(__NetBSD__)
|
||||
#include <machine/pcb.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/pmap.h>
|
||||
#ifdef __arm32__
|
||||
#define KERNBASE KERNEL_BASE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/pmap.h>
|
||||
#ifdef __arm32__
|
||||
#define KERNBASE KERNEL_BASE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
|
||||
(1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
|
||||
(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
|
||||
(1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
|
||||
(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel_pcb =
|
||||
(1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) +
|
||||
(1L << GLIBTOP_PROC_KERNEL_KSTK_ESP);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel_wchan =
|
||||
(1L << GLIBTOP_PROC_KERNEL_NWCHAN) +
|
||||
(1L << GLIBTOP_PROC_KERNEL_WCHAN);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_kernel_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel_pstats |
|
||||
_glibtop_sysdeps_proc_kernel_pcb |
|
||||
_glibtop_sysdeps_proc_kernel_wchan;
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel_p (glibtop *server,
|
||||
glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
|
||||
struct user *u_addr = (struct user *)USRSTACK;
|
||||
struct pstats pstats;
|
||||
struct pcb pcb;
|
||||
#endif
|
||||
int count;
|
||||
|
||||
char filename [BUFSIZ];
|
||||
struct stat statb;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
if (server->sysdeps.proc_time == 0)
|
||||
return;
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#define PROC_WCHAN ki_wchan
|
||||
#define PROC_WMESG ki_wmesg
|
||||
#define PROC_WMESG ki_wmesg
|
||||
|
||||
#else
|
||||
|
||||
#define PROC_WCHAN kp_proc.p_wchan
|
||||
#define PROC_WMESG kp_proc.p_wmesg
|
||||
#define PROC_WMESG kp_eproc.e_wmesg
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(__NetBSD__) || !defined(SACTIVE)
|
||||
buf->nwchan = (unsigned long) pinfo [0].PROC_WCHAN &~ KERNBASE;
|
||||
|
||||
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN);
|
||||
|
||||
if (pinfo [0].PROC_WCHAN && pinfo [0].PROC_WMESG) {
|
||||
g_strlcpy (buf->wchan, pinfo [0].PROC_WMESG,
|
||||
sizeof buf->wchan);
|
||||
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_WCHAN);
|
||||
} else {
|
||||
buf->wchan [0] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
|
||||
|
||||
/* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */
|
||||
|
||||
/* [FIXME]: /usr/include/sys/user.h tells me that the user area
|
||||
* may or may not be at the same kernel address in all
|
||||
* processes, but I don't see any way to get that address.
|
||||
* Since `ps' simply uses its own address, I think it's
|
||||
* safe to do this here, too. */
|
||||
|
||||
/* NOTE: You need to mount the /proc filesystem to make
|
||||
* `kvm_uread' work. */
|
||||
|
||||
sprintf (filename, "/proc/%d/mem", (int) pid);
|
||||
if (stat (filename, &statb)) return;
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
#if !defined(__NetBSD__) || !defined(SACTIVE)
|
||||
#ifdef __NetBSD__
|
||||
/* On NetBSD, there is no kvm_uread(), and kvm_read() always reads
|
||||
* from kernel memory. */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
#else
|
||||
|
||||
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
|
||||
kvm_uread (server->machine->kd, &(pinfo [0]).kp_proc,
|
||||
#endif
|
||||
(unsigned long) &u_addr->u_stats,
|
||||
(char *) &pstats, sizeof (pstats)) == sizeof (pstats))
|
||||
{
|
||||
/*
|
||||
* The u-area might be swapped out, and we can't get
|
||||
* at it because we have a crashdump and no swap.
|
||||
* If it's here fill in these fields, otherwise, just
|
||||
* leave them 0.
|
||||
*/
|
||||
|
||||
buf->min_flt = (guint64) pstats.p_ru.ru_minflt;
|
||||
buf->maj_flt = (guint64) pstats.p_ru.ru_majflt;
|
||||
buf->cmin_flt = (guint64) pstats.p_cru.ru_minflt;
|
||||
buf->cmaj_flt = (guint64) pstats.p_cru.ru_majflt;
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_kernel_pstats;
|
||||
}
|
||||
|
||||
#ifdef __NetBSD__
|
||||
if (kvm_read (server->machine->kd,
|
||||
#else
|
||||
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
|
||||
kvm_uread (server->machine->kd, &(pinfo [0]).kp_proc,
|
||||
#endif
|
||||
(unsigned long) &u_addr->u_pcb,
|
||||
(char *) &pcb, sizeof (pcb)) == sizeof (pcb))
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#ifndef __alpha__
|
||||
#if (__FreeBSD_version >= 300003) || defined(__FreeBSD_kernel__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_esp;
|
||||
buf->kstk_eip = (guint64) pcb.pcb_eip;
|
||||
#else
|
||||
buf->kstk_esp = (guint64) pcb.pcb_ksp;
|
||||
buf->kstk_eip = (guint64) pcb.pcb_pc;
|
||||
#endif
|
||||
#else
|
||||
/*xxx FreeBSD/Alpha? */
|
||||
#endif
|
||||
#else
|
||||
#ifdef __i386__
|
||||
buf->kstk_esp = (guint64) pcb.pcb_tss.tss_esp0;
|
||||
#ifdef __bsdi__
|
||||
buf->kstk_eip = (guint64) pcb.pcb_tss.tss_eip;
|
||||
#else
|
||||
buf->kstk_eip = (guint64) pcb.pcb_tss.__tss_eip;
|
||||
#endif
|
||||
#else
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__m68k__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_usp;
|
||||
buf->kstk_eip = (guint64) 0;
|
||||
#elif defined(__x86_64__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_usersp;
|
||||
buf->kstk_eip = (guint64) 0;
|
||||
#elif (defined(__arm32__) || defined(__powerpc__))
|
||||
buf->kstk_esp = (guint64) pcb.pcb_sp;
|
||||
buf->kstk_eip = (guint64) 0;
|
||||
#elif defined(__mipsel__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_context[8];
|
||||
buf->kstk_eip = (guint64) 0;
|
||||
#elif defined(__sparc__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_sp;
|
||||
buf->kstk_eip = (guint64) pcb.pcb_pc;
|
||||
#elif defined(__alpha__)
|
||||
buf->kstk_esp = (guint64) pcb.pcb_context[9];
|
||||
buf->kstk_eip = (guint64) pcb.pcb_context[8];
|
||||
#else
|
||||
/* provide some defaults for other platforms */
|
||||
buf->kstk_esp = (guint64) 0;
|
||||
buf->kstk_eip = (guint64) 0;
|
||||
#endif /* ${MACHINE_ARCH} */
|
||||
#endif /* __NetBSD__ */
|
||||
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
#else
|
||||
/* XXX: the code here was, quite frankly, junk, and almost
|
||||
* certainly wrong - remove it all, leave these fields
|
||||
* unpopulated, and give up until such time as the right
|
||||
* code is produced for both FreeBSD 4.x and 5.x
|
||||
*/
|
||||
return;
|
||||
#endif /* __FreeBSD__ */
|
||||
}
|
||||
113
sysdeps/bsd/proclist.c
Normal file
113
sysdeps/bsd/proclist.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proclist.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
|
||||
(1L << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
/* Fetch list of currently running processes.
|
||||
* The interface of this function is a little bit different from the others:
|
||||
* buf->flags is only set if the call succeeded, in this case pids_chain,
|
||||
* a list of the pids of all currently running processes is returned,
|
||||
* buf->number is the number of elements of this list and buf->size is
|
||||
* the size of one single element (sizeof (unsigned)). The total size is
|
||||
* stored in buf->total.
|
||||
*
|
||||
* The calling function has to free the memory to which a pointer is returned.
|
||||
*
|
||||
* IMPORTANT NOTE:
|
||||
* On error, this function MUST return NULL and set buf->flags to zero !
|
||||
* On success, it returnes a pointer to a list of buf->number elements
|
||||
* each buf->size big. The total size is stored in buf->total.
|
||||
* The calling function has to free the memory to which a pointer is returned.
|
||||
*
|
||||
* On error, NULL is returned and buf->flags is zero. */
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proclist_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
|
||||
gint64 real_which, gint64 arg)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
unsigned *pids = NULL;
|
||||
int which, count;
|
||||
int i,j;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine->kd, which, arg, &count);
|
||||
if ((pinfo == NULL) || (count < 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (proclist)");
|
||||
return NULL;
|
||||
}
|
||||
count--;
|
||||
|
||||
/* Allocate count objects in the pids_chain array
|
||||
* Same as malloc is pids is NULL, which it is. */
|
||||
pids = g_realloc (pids, count * sizeof (unsigned));
|
||||
/* Copy the pids over to this chain */
|
||||
for (i=j=0; i < count; i++) {
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
#define PROC_STAT ki_stat
|
||||
#define PROC_RUID ki_ruid
|
||||
#define PROC_PID ki_pid
|
||||
|
||||
#else
|
||||
#define PROC_STAT kp_proc.p_stat
|
||||
#define PROC_RUID kp_eproc.e_pcred.p_ruid
|
||||
#define PROC_PID kp_proc.p_pid
|
||||
|
||||
#endif
|
||||
|
||||
if ((real_which & GLIBTOP_EXCLUDE_IDLE) &&
|
||||
(pinfo[i].PROC_STAT != SRUN))
|
||||
continue;
|
||||
else if ((real_which & GLIBTOP_EXCLUDE_SYSTEM) &&
|
||||
(pinfo[i].PROC_RUID == 0))
|
||||
continue;
|
||||
pids [j++] = (unsigned) pinfo[i].PROC_PID;
|
||||
} /* end for */
|
||||
/* Set the fields in buf */
|
||||
buf->number = j;
|
||||
buf->size = sizeof (unsigned);
|
||||
buf->total = j * sizeof (unsigned);
|
||||
buf->flags = _glibtop_sysdeps_proclist;
|
||||
return pids;
|
||||
}
|
||||
311
sysdeps/bsd/procmap.c
Normal file
311
sysdeps/bsd/procmap.c
Normal file
@@ -0,0 +1,311 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/resource.h>
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ < 105020000)
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <vm/vm_map.h>
|
||||
#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#else
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_map.h>
|
||||
#if (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__)
|
||||
#include <vm/vm.h>
|
||||
#else
|
||||
#include <vm/vm_prot.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#define _KVM_VNODE
|
||||
#endif
|
||||
#include <sys/vnode.h>
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#undef _KVM_VNODE
|
||||
#endif
|
||||
#include <sys/mount.h>
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
|
||||
#include <sys/ucred.h>
|
||||
#if (!defined __OpenBSD__) && (!defined __bsdi__)
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#include <sys/sysctl.h>
|
||||
#if !defined(__NetBSD__) || (__NetBSD_Version__ < 105020000)
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
/* Fixme ... */
|
||||
#undef _KERNEL
|
||||
#define _UVM_UVM_AMAP_I_H_ 1
|
||||
#define _UVM_UVM_MAP_I_H_ 1
|
||||
#include <uvm/uvm.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_map =
|
||||
(1L << GLIBTOP_PROC_MAP_TOTAL) + (1L << GLIBTOP_PROC_MAP_NUMBER) +
|
||||
(1L << GLIBTOP_PROC_MAP_SIZE);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_map_entry =
|
||||
(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
|
||||
(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) +
|
||||
(1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_map_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
struct vm_map_entry entry, *first;
|
||||
struct vmspace vmspace;
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
struct vnode vnode;
|
||||
struct inode inode;
|
||||
#else
|
||||
struct vm_object object;
|
||||
#endif
|
||||
GArray *maps = g_array_sized_new(FALSE, FALSE,
|
||||
sizeof(glibtop_map_entry),
|
||||
100);
|
||||
#if (defined __FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
struct vnode vnode;
|
||||
#if (__FreeBSD_version < 500039) && !defined(__FreeBSD_kernel__)
|
||||
struct inode inode;
|
||||
#endif
|
||||
#endif
|
||||
int count, i = 0;
|
||||
int update = 0;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return (glibtop_map_entry*) g_array_free(maps, TRUE);
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count < 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return (glibtop_map_entry*) g_array_free(maps, TRUE);
|
||||
}
|
||||
|
||||
/* Now we get the memory maps. */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
(unsigned long) pinfo [0].ki_vmspace,
|
||||
#else
|
||||
(unsigned long) pinfo [0].kp_proc.p_vmspace,
|
||||
#endif
|
||||
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace))
|
||||
glibtop_error_io_r (server, "kvm_read (vmspace)");
|
||||
|
||||
first = vmspace.vm_map.header.next;
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) vmspace.vm_map.header.next,
|
||||
(char *) &entry, sizeof (entry)) != sizeof (entry))
|
||||
glibtop_error_io_r (server, "kvm_read (entry)");
|
||||
|
||||
/* Allocate space. */
|
||||
|
||||
buf->number = vmspace.vm_map.nentries;
|
||||
buf->size = sizeof (glibtop_map_entry);
|
||||
|
||||
buf->total = buf->number * buf->size;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_map;
|
||||
|
||||
/* Walk through the `vm_map_entry' list ... */
|
||||
|
||||
/* I tested this a few times with `mmap'; as soon as you write
|
||||
* to the mmap'ed area, the object type changes from OBJT_VNODE
|
||||
* to OBJT_DEFAULT so if seems this really works. */
|
||||
|
||||
do {
|
||||
glibtop_map_entry *mentry;
|
||||
unsigned long inum, dev;
|
||||
guint len;
|
||||
|
||||
if (update) {
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.next,
|
||||
&entry, sizeof (entry)) != sizeof (entry))
|
||||
glibtop_error_io_r (server, "kvm_read (entry)");
|
||||
} else {
|
||||
update = 1;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#if (__FreeBSD__ >= 4) || defined(__FreeBSD_kernel__)
|
||||
if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP))
|
||||
continue;
|
||||
#else
|
||||
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
|
||||
continue;
|
||||
#endif
|
||||
#else
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
if (UVM_ET_ISSUBMAP (&entry))
|
||||
continue;
|
||||
#else
|
||||
if (entry.is_a_map || entry.is_sub_map)
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
if (!entry.object.uvm_obj)
|
||||
continue;
|
||||
|
||||
/* We're only interested in vnodes */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.object.uvm_obj,
|
||||
&vnode, sizeof (vnode)) != sizeof (vnode)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (vnode)");
|
||||
return (glibtop_map_entry*) g_array_free(maps, TRUE);
|
||||
}
|
||||
#else
|
||||
if (!entry.object.vm_object)
|
||||
continue;
|
||||
|
||||
/* We're only interested in `vm_object's */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.object.vm_object,
|
||||
&object, sizeof (object)) != sizeof (object))
|
||||
glibtop_error_io_r (server, "kvm_read (object)");
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
#if defined(UVM_VNODE_VALID)
|
||||
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
|
||||
continue;
|
||||
#endif
|
||||
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
|
||||
!vnode.v_data) continue;
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) vnode.v_data,
|
||||
&inode, sizeof (inode)) != sizeof (inode))
|
||||
glibtop_error_io_r (server, "kvm_read (inode)");
|
||||
|
||||
inum = inode.i_number;
|
||||
dev = inode.i_dev;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* If the object is of type vnode, add its size */
|
||||
|
||||
if (object.type != OBJT_VNODE)
|
||||
continue;
|
||||
|
||||
if (!object.handle)
|
||||
continue;
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) object.handle,
|
||||
&vnode, sizeof (vnode)) != sizeof (vnode))
|
||||
glibtop_error_io_r (server, "kvm_read (vnode)");
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500039)) || defined(__FreeBSD_kernel__)
|
||||
switch (vnode.v_type) {
|
||||
case VREG:
|
||||
#if (__FreeBSD_version < 600006) && !defined(__FreeBSD_kernel__)
|
||||
inum = vnode.v_cachedid;
|
||||
dev = vnode.v_cachedfs;
|
||||
#endif
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
|
||||
!vnode.v_data) continue;
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) vnode.v_data,
|
||||
&inode, sizeof (inode)) != sizeof (inode))
|
||||
glibtop_error_io_r (server, "kvm_read (inode)");
|
||||
|
||||
inum = inode.i_number;
|
||||
dev = inode.i_dev;
|
||||
#endif
|
||||
#endif
|
||||
len = maps->len;
|
||||
g_array_set_size(maps, len + 1);
|
||||
mentry = &g_array_index(maps, glibtop_map_entry, len);
|
||||
|
||||
mentry->flags = _glibtop_sysdeps_map_entry;
|
||||
|
||||
mentry->start = (guint64) entry.start;
|
||||
mentry->end = (guint64) entry.end;
|
||||
mentry->offset = (guint64) entry.offset;
|
||||
mentry->device = (guint64) dev;
|
||||
mentry->inode = (guint64) inum;
|
||||
|
||||
mentry->perm = (guint64) 0;
|
||||
|
||||
if (entry.protection & VM_PROT_READ)
|
||||
mentry->perm |= GLIBTOP_MAP_PERM_READ;
|
||||
if (entry.protection & VM_PROT_WRITE)
|
||||
mentry->perm |= GLIBTOP_MAP_PERM_WRITE;
|
||||
if (entry.protection & VM_PROT_EXECUTE)
|
||||
mentry->perm |= GLIBTOP_MAP_PERM_EXECUTE;
|
||||
} while (entry.next != first);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_map;
|
||||
|
||||
buf->number = maps->len;
|
||||
buf->size = sizeof (glibtop_map_entry);
|
||||
buf->total = buf->number * buf->size;
|
||||
|
||||
return (glibtop_map_entry*) g_array_free(maps, FALSE);
|
||||
}
|
||||
293
sysdeps/bsd/procmem.c
Normal file
293
sysdeps/bsd/procmem.c
Normal file
@@ -0,0 +1,293 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/resource.h>
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#else
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_map.h>
|
||||
#endif
|
||||
|
||||
#include <sys/vnode.h>
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
|
||||
#include <sys/ucred.h>
|
||||
#if (!defined __OpenBSD__) && (!defined __bsdi__)
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#include <sys/sysctl.h>
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
||||
#include <uvm/uvm.h>
|
||||
#else
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && \
|
||||
(__NetBSD_Version__ >= 104000000) && (__NetBSD_Version__ < 105020000)
|
||||
/* Fixme ... */
|
||||
#undef _KERNEL
|
||||
#define _UVM_UVM_AMAP_I_H_ 1
|
||||
#define _UVM_UVM_MAP_I_H_ 1
|
||||
#include <uvm/uvm.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_mem =
|
||||
(1L << GLIBTOP_PROC_MEM_SIZE) +
|
||||
(1L << GLIBTOP_PROC_MEM_VSIZE) +
|
||||
(1L << GLIBTOP_PROC_MEM_RESIDENT) +
|
||||
(1L << GLIBTOP_PROC_MEM_RSS) +
|
||||
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_mem_share =
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
(1L << GLIBTOP_PROC_MEM_SHARE);
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
(1L << GLIBTOP_PROC_MEM_SHARE);
|
||||
#else
|
||||
0;
|
||||
#endif
|
||||
|
||||
#ifndef LOG1024
|
||||
#define LOG1024 10
|
||||
#endif
|
||||
|
||||
/* these are for getting the memory statistics */
|
||||
static int pageshift; /* log base 2 of the pagesize */
|
||||
|
||||
/* define pagetok in terms of pageshift */
|
||||
#define pagetok(size) ((size) << pageshift)
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_mem_p (glibtop *server)
|
||||
{
|
||||
register int pagesize;
|
||||
|
||||
/* get the page size with "getpagesize" and calculate pageshift
|
||||
* from it */
|
||||
pagesize = getpagesize ();
|
||||
pageshift = 0;
|
||||
while (pagesize > 1) {
|
||||
pageshift++;
|
||||
pagesize >>= 1;
|
||||
}
|
||||
|
||||
/* we only need the amount of log(2)1024 for our conversion */
|
||||
pageshift -= LOG1024;
|
||||
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
|
||||
_glibtop_sysdeps_proc_mem_share;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
struct vm_map_entry entry, *first;
|
||||
struct vmspace *vms, vmspace;
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
struct vnode vnode;
|
||||
#else
|
||||
struct vm_object object;
|
||||
#endif
|
||||
#if (!defined(__FreeBSD__) || (__FreeBSD_version < 500013)) && !defined(__FreeBSD_kernel__)
|
||||
struct plimit plimit;
|
||||
#endif
|
||||
int count;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
if (server->sysdeps.proc_mem == 0)
|
||||
return;
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count < 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#define PROC_VMSPACE ki_vmspace
|
||||
|
||||
buf->rss_rlim = pinfo [0].ki_rssize;
|
||||
|
||||
buf->vsize = buf->size = (guint64) pagetok
|
||||
(pinfo [0].ki_tsize + pinfo [0].ki_dsize + pinfo[0].ki_ssize)
|
||||
<< LOG1024;
|
||||
buf->resident = buf->rss = (guint64) pagetok
|
||||
(pinfo [0].ki_rssize) << LOG1024;
|
||||
|
||||
#else
|
||||
|
||||
#define PROC_VMSPACE kp_proc.p_vmspace
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) pinfo [0].PROC_VMSPACE,
|
||||
(char *) &plimit, sizeof (plimit)) != sizeof (plimit)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (plimit)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->rss_rlim = (guint64)
|
||||
(plimit.pl_rlimit [RLIMIT_RSS].rlim_cur);
|
||||
|
||||
vms = &pinfo [0].kp_eproc.e_vm;
|
||||
|
||||
buf->vsize = buf->size = (guint64) pagetok
|
||||
(vms->vm_tsize + vms->vm_dsize + vms->vm_ssize) << LOG1024;
|
||||
|
||||
buf->resident = buf->rss = (guint64) pagetok
|
||||
(vms->vm_rssize) << LOG1024;
|
||||
#endif
|
||||
|
||||
/* Now we get the shared memory. */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) pinfo [0].PROC_VMSPACE,
|
||||
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (vmspace)");
|
||||
return;
|
||||
}
|
||||
|
||||
first = vmspace.vm_map.header.next;
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) vmspace.vm_map.header.next,
|
||||
(char *) &entry, sizeof (entry)) != sizeof (entry)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (entry)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Walk through the `vm_map_entry' list ... */
|
||||
|
||||
/* I tested this a few times with `mmap'; as soon as you write
|
||||
* to the mmap'ed area, the object type changes from OBJT_VNODE
|
||||
* to OBJT_DEFAULT so if seems this really works. */
|
||||
|
||||
while (entry.next != first) {
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.next,
|
||||
&entry, sizeof (entry)) != sizeof (entry)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (entry)");
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#if (__FreeBSD__ >= 4) || defined(__FreeBSD_kernel__)
|
||||
if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP))
|
||||
continue;
|
||||
#else
|
||||
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
|
||||
continue;
|
||||
#endif
|
||||
#else
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
if (UVM_ET_ISSUBMAP (&entry))
|
||||
continue;
|
||||
#else
|
||||
if (entry.is_a_map || entry.is_sub_map)
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
if (!entry.object.uvm_obj)
|
||||
continue;
|
||||
|
||||
/* We're only interested in vnodes */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.object.uvm_obj,
|
||||
&vnode, sizeof (vnode)) != sizeof (vnode)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (vnode)");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!entry.object.vm_object)
|
||||
continue;
|
||||
|
||||
/* We're only interested in `vm_object's */
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) entry.object.vm_object,
|
||||
&object, sizeof (object)) != sizeof (object)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (object)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* If the object is of type vnode, add its size */
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
#if defined(UVM_VNODE_VALID)
|
||||
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
|
||||
continue;
|
||||
#endif
|
||||
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
|
||||
!vnode.v_data) continue;
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105250000)
|
||||
/* Reference count must be at least two. */
|
||||
if (vnode.v_usecount <= 1)
|
||||
continue;
|
||||
|
||||
buf->share += pagetok (vnode.v_uobj.uo_npages) << LOG1024;
|
||||
#else
|
||||
|
||||
/* Reference count must be at least two. */
|
||||
if (vnode.v_uvm.u_obj.uo_refs <= 1)
|
||||
continue;
|
||||
|
||||
buf->share += pagetok (vnode.v_uvm.u_obj.uo_npages) << LOG1024;
|
||||
#endif /* __NetBSD_Version__ >= 105250000 */
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (object.type != OBJT_VNODE)
|
||||
continue;
|
||||
|
||||
buf->share += object.un_pager.vnp.vnp_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_mem |
|
||||
_glibtop_sysdeps_proc_mem_share;
|
||||
}
|
||||
51
sysdeps/bsd/procopenfiles.c
Normal file
51
sysdeps/bsd/procopenfiles.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
Copyright (C) 2004 Nicol<6F>s Lichtmaier
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Modified by Nicol<6F>s Lichtmaier to give a process open files.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procopenfiles.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_open_files =
|
||||
(1L << GLIBTOP_PROC_OPEN_FILES_NUMBER)|
|
||||
(1L << GLIBTOP_PROC_OPEN_FILES_TOTAL)|
|
||||
(1L << GLIBTOP_PROC_OPEN_FILES_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_open_files_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_open_files = _glibtop_sysdeps_proc_open_files;
|
||||
}
|
||||
|
||||
|
||||
/* XXX Unimplemented on FreeBSD */
|
||||
glibtop_open_files_entry *
|
||||
glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
81
sysdeps/bsd/procsegment.c
Normal file
81
sysdeps/bsd/procsegment.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_segment = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_segment_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_segment_p (glibtop *server,
|
||||
glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
#if 0
|
||||
/* Get the process info from the kernel */
|
||||
kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, count);
|
||||
if (*count != 1) {
|
||||
return; /* the zeroed-out buffer indicating no data */
|
||||
}
|
||||
|
||||
/* trs: text resident set size
|
||||
pinfo[0]->kp_eproc.e_xrssize;
|
||||
*/
|
||||
/* buf->trs = pinfo[0]->kp_eproc.e_xrssize; */
|
||||
/* lrs: shared-lib resident set size
|
||||
? */
|
||||
/* drs: data resident set size
|
||||
pinfo[0]->kp_eproc.e_vm.vm_map.vm_dsize;
|
||||
*/
|
||||
/* dt: dirty pages
|
||||
*/
|
||||
/* start_code: address of beginning of code segment
|
||||
|
||||
*/
|
||||
/* end_code: address of end of code segment
|
||||
*/
|
||||
/* start_stack: address of the bottom of stack segment
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
136
sysdeps/bsd/procsignal.c
Normal file
136
sysdeps/bsd/procsignal.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsignal.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_signal =
|
||||
(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) +
|
||||
(1L << GLIBTOP_PROC_SIGNAL_BLOCKED) +
|
||||
(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) +
|
||||
(1L << GLIBTOP_PROC_SIGNAL_SIGCATCH);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_signal_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal_p (glibtop *server,
|
||||
glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
int count = 0;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#define PROC_SIGLIST ki_siglist
|
||||
#define PROC_SIGMASK ki_sigmask
|
||||
#define PROC_SIGIGNORE ki_sigignore
|
||||
#define PROC_SIGCATCH ki_sigcatch
|
||||
|
||||
#else
|
||||
|
||||
#define PROC_SIGLIST kp_proc.p_siglist
|
||||
#define PROC_SIGMASK kp_proc.p_sigmask
|
||||
#define PROC_SIGIGNORE kp_proc.p_sigignore
|
||||
#define PROC_SIGCATCH kp_proc.p_sigcatch
|
||||
|
||||
#endif
|
||||
|
||||
/* signal: mask of pending signals.
|
||||
* pinfo [0].kp_proc.p_siglist
|
||||
*/
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
|
||||
buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
|
||||
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
|
||||
(defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__))
|
||||
buf->signal [0] = pinfo [0].PROC_SIGLIST.__bits[0];
|
||||
#else
|
||||
buf->signal [0] = pinfo [0].kp_proc.p_siglist;
|
||||
#endif
|
||||
|
||||
/* blocked: mask of blocked signals.
|
||||
* pinfo [0].kp_proc.p_sigmask
|
||||
*/
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
|
||||
buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
|
||||
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
|
||||
(defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__))
|
||||
buf->blocked [0] = pinfo [0].PROC_SIGMASK.__bits[0];
|
||||
#else
|
||||
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
|
||||
#endif
|
||||
|
||||
/* sigignore: mask of ignored signals.
|
||||
* pinfo [0].kp_proc.p_sigignore
|
||||
*/
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
|
||||
buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
|
||||
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
|
||||
(defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__))
|
||||
buf->sigignore [0] = pinfo [0].PROC_SIGIGNORE.__bits[0];
|
||||
#else
|
||||
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
|
||||
#endif
|
||||
|
||||
/* sigcatch: mask of caught signals.
|
||||
* pinfo [0].kp_proc.p_sigcatch
|
||||
*/
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
|
||||
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
|
||||
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
|
||||
(defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__))
|
||||
buf->sigcatch [0] = pinfo [0].PROC_SIGCATCH.__bits[0];
|
||||
#else
|
||||
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch;
|
||||
#endif
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
148
sysdeps/bsd/procstate.c
Normal file
148
sysdeps/bsd/procstate.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/* Copyright (C) 1998 Joshua Sled
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procstate.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#if !defined(__OpenBSD__)
|
||||
/* && (!defined __bsdi__) */
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_state =
|
||||
(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_UID) +
|
||||
(1L << GLIBTOP_PROC_STATE_GID);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_state_new =
|
||||
0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_state_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state |
|
||||
_glibtop_sysdeps_proc_state_new;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_state_p (glibtop *server,
|
||||
glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
int count = 0;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
#define PROC_COMM ki_comm
|
||||
#define PROC_SVUID ki_svuid
|
||||
#define PROC_SVGID ki_svgid
|
||||
#define PROC_RUID ki_ruid
|
||||
#define PROC_RGID ki_rgid
|
||||
#define PROC_STAT ki_stat
|
||||
|
||||
#else
|
||||
#define PROC_COMM kp_proc.p_comm
|
||||
#define PROC_SVUID kp_eproc.e_pcred.p_svuid
|
||||
#define PROC_SVGID kp_eproc.e_pcred.p_svgid
|
||||
#define PROC_RUID kp_eproc.e_pcred.p_ruid
|
||||
#define PROC_RGID kp_eproc.e_pcred.p_rgid
|
||||
#define PROC_STAT kp_proc.p_stat
|
||||
|
||||
#endif
|
||||
|
||||
g_strlcpy (buf->cmd, pinfo [0].PROC_COMM, sizeof buf->cmd);
|
||||
|
||||
buf->uid = pinfo [0].PROC_SVUID;
|
||||
buf->gid = pinfo [0].PROC_SVGID;
|
||||
|
||||
/* Set the flags for the data we're about to return*/
|
||||
buf->flags = _glibtop_sysdeps_proc_state |
|
||||
_glibtop_sysdeps_proc_state_new;
|
||||
|
||||
#if LIBGTOP_VERSION_CODE >= 1001000
|
||||
switch (pinfo [0].PROC_STAT) {
|
||||
case SIDL:
|
||||
buf->state = 0;
|
||||
break;
|
||||
case SRUN:
|
||||
buf->state = GLIBTOP_PROCESS_RUNNING;
|
||||
break;
|
||||
#ifdef SSLEEP
|
||||
case SSLEEP:
|
||||
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
|
||||
break;
|
||||
#endif
|
||||
case SSTOP:
|
||||
buf->state = GLIBTOP_PROCESS_STOPPED;
|
||||
break;
|
||||
case SZOMB:
|
||||
buf->state = GLIBTOP_PROCESS_ZOMBIE;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#else
|
||||
switch (pinfo [0].PROC_STAT) {
|
||||
case SIDL:
|
||||
buf->state = 'D';
|
||||
break;
|
||||
case SRUN:
|
||||
buf->state = 'R';
|
||||
break;
|
||||
#ifdef SSLEEP
|
||||
case SSLEEP:
|
||||
buf->state = 'S';
|
||||
break;
|
||||
#endif
|
||||
case SSTOP:
|
||||
buf->state = 'T';
|
||||
break;
|
||||
case SZOMB:
|
||||
buf->state = 'Z';
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
|
||||
}
|
||||
252
sysdeps/bsd/proctime.c
Normal file
252
sysdeps/bsd/proctime.c
Normal file
@@ -0,0 +1,252 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proctime.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time_user =
|
||||
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_STIME) +
|
||||
(1L << GLIBTOP_PROC_TIME_CUTIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) +
|
||||
(1L << GLIBTOP_PROC_TIME_START_TIME);
|
||||
|
||||
#define tv2sec(tv) (((guint64) tv.tv_sec * 1000000) + (guint64) tv.tv_usec)
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_time_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time |
|
||||
_glibtop_sysdeps_proc_time_user;
|
||||
}
|
||||
|
||||
/* Taken from /usr/src/sys/kern/kern_resource.c */
|
||||
|
||||
/*
|
||||
* Transform the running time and tick information in proc p into user,
|
||||
* system, and interrupt time usage.
|
||||
*/
|
||||
|
||||
#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
|
||||
|
||||
static void
|
||||
calcru(p, up, sp, ip)
|
||||
struct proc *p;
|
||||
struct timeval *up;
|
||||
struct timeval *sp;
|
||||
struct timeval *ip;
|
||||
{
|
||||
quad_t totusec;
|
||||
u_quad_t u, st, ut, it, tot;
|
||||
long sec, usec;
|
||||
struct timeval tv;
|
||||
|
||||
st = p->p_sticks;
|
||||
ut = p->p_uticks;
|
||||
it = p->p_iticks;
|
||||
|
||||
tot = st + ut + it;
|
||||
if (tot == 0) {
|
||||
st = 1;
|
||||
tot = 1;
|
||||
}
|
||||
|
||||
sec = p->p_rtime.tv_sec;
|
||||
usec = p->p_rtime.tv_usec;
|
||||
|
||||
totusec = (quad_t)sec * 1000000 + usec;
|
||||
|
||||
if (totusec < 0) {
|
||||
/* XXX no %qd in kernel. Truncate. */
|
||||
fprintf (stderr, "calcru: negative time: %ld usec\n",
|
||||
(long)totusec);
|
||||
totusec = 0;
|
||||
}
|
||||
|
||||
|
||||
u = totusec;
|
||||
st = (u * st) / tot;
|
||||
sp->tv_sec = st / 1000000;
|
||||
sp->tv_usec = st % 1000000;
|
||||
ut = (u * ut) / tot;
|
||||
up->tv_sec = ut / 1000000;
|
||||
up->tv_usec = ut % 1000000;
|
||||
if (ip != NULL) {
|
||||
it = (u * it) / tot;
|
||||
ip->tv_sec = it / 1000000;
|
||||
ip->tv_usec = it % 1000000;
|
||||
}
|
||||
}
|
||||
#endif /* !__FreeBSD__ */
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || (defined(OpenBSD) && (OpenBSD >= 199912))
|
||||
register struct rusage *rup;
|
||||
#else
|
||||
struct user *u_addr = (struct user *)USRSTACK;
|
||||
#endif
|
||||
struct pstats pstats;
|
||||
int count;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
|
||||
if (server->sysdeps.proc_time == 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
buf->rtime = pinfo [0].ki_runtime;
|
||||
#elif (defined __FreeBSD__) && (__FreeBSD_version <= 500013)
|
||||
buf->rtime = pinfo [0].kp_proc.p_runtime;
|
||||
#else
|
||||
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
|
||||
#endif
|
||||
|
||||
buf->frequency = 1000000;
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
|
||||
#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || (defined(OpenBSD) && (OpenBSD >= 199912))
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
if (kvm_read (server->machine->kd,
|
||||
(unsigned long) pinfo [0].kp_proc.p_stats,
|
||||
&pstats, sizeof (pstats)) != sizeof (pstats)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (pstats)");
|
||||
return;
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
rup = &pstats.p_ru;
|
||||
calcru(&(pinfo [0]).kp_proc,
|
||||
&rup->ru_utime, &rup->ru_stime, NULL);
|
||||
|
||||
buf->utime = tv2sec (pstats.p_ru.ru_utime);
|
||||
buf->stime = tv2sec (pstats.p_ru.ru_stime);
|
||||
|
||||
buf->cutime = tv2sec (pstats.p_cru.ru_utime);
|
||||
buf->cstime = tv2sec (pstats.p_cru.ru_stime);
|
||||
|
||||
buf->start_time = (guint64) pstats.p_start.tv_sec;
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_time_user;
|
||||
#else
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
#if (__FreeBSD_version >= 500016) || defined(__FreeBSD_kernel__)
|
||||
if ((pinfo [0].ki_flag & PS_INMEM)) {
|
||||
#else
|
||||
if ((pinfo [0].ki_flag & P_INMEM)) {
|
||||
#endif
|
||||
buf->utime = pinfo [0].ki_runtime;
|
||||
buf->stime = tv2sec (pinfo [0].ki_rusage.ru_stime);
|
||||
buf->cutime = tv2sec (pinfo [0].ki_childtime);
|
||||
#if (__FreeBSD_version >= 600000) || (__FreeBSD_kernel_version >= 600000)
|
||||
buf->cstime = tv2sec (pinfo [0].ki_rusage_ch.ru_stime);
|
||||
#else
|
||||
buf->cstime = 0;
|
||||
#endif
|
||||
buf->start_time = tv2sec (pinfo [0].ki_start);
|
||||
buf->flags = _glibtop_sysdeps_proc_time_user;
|
||||
}
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
#elif (__FreeBSD_version <= 500013)
|
||||
|
||||
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
|
||||
kvm_uread (server->machine->kd, &(pinfo [0]).kp_proc,
|
||||
(unsigned long) &u_addr->u_stats,
|
||||
(char *) &pstats, sizeof (pstats)) == sizeof (pstats))
|
||||
{
|
||||
|
||||
buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime);
|
||||
buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime);
|
||||
buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime);
|
||||
buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime);
|
||||
buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start);
|
||||
buf->flags = _glibtop_sysdeps_proc_time_user;
|
||||
glibtop_suid_leave (server);
|
||||
}
|
||||
#else
|
||||
|
||||
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
|
||||
kvm_uread (server->machine->kd, &(pinfo [0]).kp_proc,
|
||||
(unsigned long) &u_addr->u_stats,
|
||||
(char *) &pstats, sizeof (pstats)) == sizeof (pstats))
|
||||
{
|
||||
/* This is taken form the kernel source code of
|
||||
* FreeBSD 2.2.6. */
|
||||
|
||||
/* Well, we just do the same getrusage () does ... */
|
||||
|
||||
register struct rusage *rup;
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
rup = &pstats.p_ru;
|
||||
calcru(&(pinfo [0]).kp_proc,
|
||||
&rup->ru_utime, &rup->ru_stime, NULL);
|
||||
|
||||
buf->utime = tv2sec (pstats.p_ru.ru_utime);
|
||||
buf->stime = tv2sec (pstats.p_ru.ru_stime);
|
||||
|
||||
buf->cutime = tv2sec (pstats.p_cru.ru_utime);
|
||||
buf->cstime = tv2sec (pstats.p_cru.ru_stime);
|
||||
|
||||
buf->start_time = tv2sec (pstats.p_start);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time_user;
|
||||
}
|
||||
#endif
|
||||
glibtop_suid_leave (server);
|
||||
#endif
|
||||
}
|
||||
|
||||
148
sysdeps/bsd/procuid.c
Normal file
148
sysdeps/bsd/procuid.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procuid.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
|
||||
(1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) +
|
||||
(1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) +
|
||||
(1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) +
|
||||
(1L << GLIBTOP_PROC_UID_NICE);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid_groups =
|
||||
0L;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_uid_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid |
|
||||
_glibtop_sysdeps_proc_uid_groups;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
int count = 0;
|
||||
|
||||
#if LIBGTOP_VERSION_CODE >= 1001000
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
struct ucred ucred;
|
||||
void *ucred_ptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
/* It does not work for the swapper task. */
|
||||
if (pid == 0) return;
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1)) {
|
||||
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#define PROC_RUID ki_ruid
|
||||
#define PROC_SVUID ki_svuid
|
||||
#define PROC_RGID ki_rgid
|
||||
#define PROC_SVGID ki_svgid
|
||||
#define PROC_PPID ki_ppid
|
||||
#define PROC_PGID ki_pgid
|
||||
#define PROC_TPGID ki_tpgid
|
||||
#define PROC_NICE ki_nice
|
||||
#define PROC_PRIORITY ki_pri.pri_user
|
||||
#else
|
||||
|
||||
#define PROC_RUID kp_eproc.e_pcred.p_ruid
|
||||
#define PROC_SVUID kp_eproc.e_pcred.p_svuid
|
||||
#define PROC_RGID kp_eproc.e_pcred.p_rgid
|
||||
#define PROC_SVGID kp_eproc.e_pcred.p_svgid
|
||||
#define PROC_PPID kp_eproc.e_ppid
|
||||
#define PROC_PGID kp_eproc.e_pgid
|
||||
#define PROC_TPGID kp_eproc.e_tpgid
|
||||
#define PROC_NICE kp_proc.p_nice
|
||||
#define PROC_PRIORITY kp_proc.p_priority
|
||||
|
||||
#endif
|
||||
|
||||
buf->uid = pinfo [0].PROC_RUID;
|
||||
buf->euid = pinfo [0].PROC_SVUID;
|
||||
buf->gid = pinfo [0].PROC_RGID;
|
||||
buf->egid = pinfo [0].PROC_SVGID;
|
||||
|
||||
buf->ppid = pinfo [0].PROC_PPID;
|
||||
buf->pgrp = pinfo [0].PROC_PGID;
|
||||
buf->tpgid = pinfo [0].PROC_TPGID;
|
||||
|
||||
buf->nice = pinfo [0].PROC_NICE;
|
||||
#if defined(__NetBSD__) && defined(SACTIVE)
|
||||
buf->priority = 0;
|
||||
#else
|
||||
buf->priority = pinfo [0].PROC_PRIORITY;
|
||||
#endif
|
||||
|
||||
/* Set the flags for the data we're about to return*/
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
|
||||
/* Use LibGTop conditionals here so we can more easily merge this
|
||||
* code into the LIBGTOP_STABLE_1_0 branch. */
|
||||
#if 0
|
||||
/* This probably also works with other versions, but not yet
|
||||
* tested. Please remove the conditional if this is true. */
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
||||
ucred_ptr = (void *) pinfo [0].kp_eproc.e_pcred.pc_ucred;
|
||||
|
||||
if (ucred_ptr) {
|
||||
if (kvm_read (server->machine->kd, (unsigned long) ucred_ptr,
|
||||
&ucred, sizeof (ucred)) != sizeof (ucred)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (ucred)");
|
||||
} else {
|
||||
int count = (ucred.cr_ngroups < GLIBTOP_MAX_GROUPS) ?
|
||||
ucred.cr_ngroups : GLIBTOP_MAX_GROUPS;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
buf->groups [i] = ucred.cr_groups [i];
|
||||
buf->ngroups = count;
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_uid_groups;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
119
sysdeps/bsd/sem_limits.c
Normal file
119
sysdeps/bsd/sem_limits.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, August 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/sem_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
_glibtop_init_sem_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* #define KERNEL to get declaration of `struct seminfo'. */
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version < 410000)) || defined(__bsdi__)
|
||||
#define KERNEL 1
|
||||
#else
|
||||
#define _KERNEL 1
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
static unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
|
||||
(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
|
||||
(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
|
||||
(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
|
||||
(1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM);
|
||||
|
||||
/* The values in this structure never change at runtime, so we only
|
||||
* read it once during initialization. We have to use the name `_seminfo'
|
||||
* since `seminfo' is already declared external in <sys/sem.h>. */
|
||||
static struct seminfo _seminfo;
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
{ "_seminfo" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (sem_limits)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&_seminfo, sizeof (_seminfo)) != sizeof (_seminfo)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (seminfo)");
|
||||
return;
|
||||
}
|
||||
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
|
||||
if (server->sysdeps.sem_limits == 0)
|
||||
return;
|
||||
|
||||
buf->semmap = _seminfo.semmap;
|
||||
buf->semmni = _seminfo.semmni;
|
||||
buf->semmns = _seminfo.semmns;
|
||||
buf->semmnu = _seminfo.semmnu;
|
||||
buf->semmsl = _seminfo.semmsl;
|
||||
buf->semopm = _seminfo.semopm;
|
||||
buf->semvmx = _seminfo.semvmx;
|
||||
buf->semaem = _seminfo.semaem;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
#endif /* either a newer BSDI or no BSDI at all. */
|
||||
|
||||
114
sysdeps/bsd/shm_limits.c
Normal file
114
sysdeps/bsd/shm_limits.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, August 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/shm_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
_glibtop_init_shm_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* #define KERNEL to get declaration of `struct shminfo'. */
|
||||
|
||||
#if (defined(__FreeBSD__) && (__FreeBSD_version < 410000)) || defined(__bsdi__)
|
||||
#define KERNEL 1
|
||||
#else
|
||||
#define _KERNEL 1
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
static unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
|
||||
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) +
|
||||
(1L << GLIBTOP_IPC_SHMALL);
|
||||
|
||||
/* The values in this structure never change at runtime, so we only
|
||||
* read it once during initialization. We have to use the name `_shminfo'
|
||||
* since `shminfo' is already declared external in <sys/shm.h>. */
|
||||
static struct shminfo _shminfo;
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst [] = {
|
||||
{ "_shminfo" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (shm_limits)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst [0].n_value,
|
||||
&_shminfo, sizeof (_shminfo)) != sizeof (_shminfo)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (shminfo)");
|
||||
return;
|
||||
}
|
||||
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
if (server->sysdeps.shm_limits == 0)
|
||||
return;
|
||||
|
||||
buf->shmmax = _shminfo.shmmax;
|
||||
buf->shmmin = _shminfo.shmmin;
|
||||
buf->shmmni = _shminfo.shmmni;
|
||||
buf->shmseg = _shminfo.shmseg;
|
||||
buf->shmall = _shminfo.shmall;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
#endif /* either a newer BSDI or no BSDI at all. */
|
||||
|
||||
60
sysdeps/bsd/siglist.c
Normal file
60
sysdeps/bsd/siglist.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/signal.h>
|
||||
|
||||
const glibtop_signame glibtop_sys_siglist [] =
|
||||
{ { 1, "SIGHUP", "Hangup" },
|
||||
{ 2, "SIGINT", "Interrupt" },
|
||||
{ 3, "SIGQUIT", "Quit" },
|
||||
{ 4, "SIGILL", "Illegal Instruction" },
|
||||
{ 5, "SIGTRAP", "Trace/Breakpoint Trap" },
|
||||
{ 6, "SIGABRT", "Abort" },
|
||||
{ 7, "SIGEMT", "Emulation Trap" },
|
||||
{ 8, "SIGFPE", "Arithmetic Exception" },
|
||||
{ 9, "SIGKILL", "Killed" },
|
||||
{ 10, "SIGBUS", "Bus Error" },
|
||||
{ 11, "SIGSEGV", "Segmentation Fault" },
|
||||
{ 12, "SIGSYS", "Bad System Call" },
|
||||
{ 13, "SIGPIPE", "Broken Pipe" },
|
||||
{ 14, "SIGALRM", "Alarm Clock" },
|
||||
{ 15, "SIGTERM", "Terminated" },
|
||||
{ 16, "SIGURG", "Urgent Condition Present On Socket" },
|
||||
{ 17, "SIGSTOP", "Stop (cannot be caught or ignored)" },
|
||||
{ 18, "SIGTSTP", "Stop Signal Generated From Keyboard" },
|
||||
{ 19, "SIGCONT", "Continue After Stop" },
|
||||
{ 20, "SIGCHLD", "Child Status Has Changed" },
|
||||
{ 21, "SIGTTIN", "Background Read Attempted From Control Terminal" },
|
||||
{ 22, "SIGTTOU", "Background Write Attempted To Control Terminal" },
|
||||
{ 23, "SIGIO", "I/O Is Possible On A Descriptor" },
|
||||
{ 24, "SIGXCPU", "CPU Time Limit Exceeded" },
|
||||
{ 25, "SIGXFSZ", "File Size Limit Exceeded" },
|
||||
{ 26, "SIGVTALRM","Virtual Time Alarm" },
|
||||
{ 27, "SIGPROF", "Profiling Timer Alarm" },
|
||||
{ 28, "SIGWINCH","Window Size Change" },
|
||||
{ 29, "SIGINFO", "Status Request From Keyboard" },
|
||||
{ 30, "SIGUSR1", "User Defined Signal 1" },
|
||||
{ 31, "SIGUSR2", "User Defined Signal 2" },
|
||||
{ 32, "SIGTHR", "Thread Interrupt" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
426
sysdeps/bsd/swap.c
Normal file
426
sysdeps/bsd/swap.c
Normal file
@@ -0,0 +1,426 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/swap.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_swap =
|
||||
(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
|
||||
(1L << GLIBTOP_SWAP_FREE) + (1L << GLIBTOP_SWAP_PAGEIN) +
|
||||
(1L << GLIBTOP_SWAP_PAGEOUT);
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#include <sys/conf.h>
|
||||
#ifdef __bsdi__
|
||||
#include <vm/swap_pager.h>
|
||||
#else
|
||||
#if (__FreeBSD_version < 400005) && !defined(__FreeBSD_kernel__)
|
||||
#include <sys/rlist.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/vmmeter.h>
|
||||
|
||||
/* nlist structure for kernel access */
|
||||
|
||||
#if defined(__bsdi__)
|
||||
static struct nlist nlst [] = {
|
||||
{ "_swapstats" }, /* general swap info */
|
||||
{ 0 }
|
||||
};
|
||||
#elif __FreeBSD__ < 4
|
||||
static struct nlist nlst [] = {
|
||||
#define VM_SWAPLIST 0
|
||||
{ "_swaplist" },/* list of free swap areas */
|
||||
#define VM_SWDEVT 1
|
||||
{ "_swdevt" }, /* list of swap devices and sizes */
|
||||
#define VM_NSWAP 2
|
||||
{ "_nswap" }, /* size of largest swap device */
|
||||
#define VM_NSWDEV 3
|
||||
{ "_nswdev" }, /* number of swap devices */
|
||||
#define VM_DMMAX 4
|
||||
{ "_dmmax" }, /* maximum size of a swap block */
|
||||
{ 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
#if (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <sys/swap.h>
|
||||
#else
|
||||
#include <vm/vm_swap.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
|
||||
#else
|
||||
/* nlist structure for kernel access */
|
||||
static struct nlist nlst2 [] = {
|
||||
{ "_cnt" },
|
||||
{ 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_swap_p (glibtop *server)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__FreeBSD_kernel__)
|
||||
#if __FreeBSD__ < 4 || defined(__bsdi__)
|
||||
if (kvm_nlist (server->machine->kd, nlst) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (swap)");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
struct kvm_swap dummy;
|
||||
|
||||
if (kvm_getswapinfo (server->machine->kd, &dummy, 1, 0) != 0) {
|
||||
glibtop_warn_io_r (server, "kvm_swap (swap)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) && !defined(__OpenBSD__)
|
||||
if (kvm_nlist (server->machine->kd, nlst2) < 0) {
|
||||
glibtop_warn_io_r (server, "kvm_nlist (cnt)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
/*
|
||||
* This function is based on a program called swapinfo written
|
||||
* by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
||||
*/
|
||||
|
||||
void
|
||||
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
# if (__FreeBSD__ < 4) && !defined(__FreeBSD_kernel__)
|
||||
char *header;
|
||||
int hlen, nswdev, dmmax;
|
||||
int div, nfree, npfree;
|
||||
struct swdevt *sw;
|
||||
long blocksize, *perdev;
|
||||
struct rlist head;
|
||||
struct rlisthdr swaplist;
|
||||
struct rlist *swapptr;
|
||||
size_t sw_size;
|
||||
u_long ptr;
|
||||
# else
|
||||
int nswdev;
|
||||
struct kvm_swap kvmsw[16];
|
||||
# endif
|
||||
|
||||
#elif defined(__bsdi__)
|
||||
struct swapstats swap;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct swapent *swaplist;
|
||||
#endif
|
||||
|
||||
int nswap, i;
|
||||
guint64 avail = 0, inuse = 0;
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
struct uvmexp uvmexp;
|
||||
size_t length_uvmexp;
|
||||
#else
|
||||
/* To get `pagein' and `pageout'. */
|
||||
struct vmmeter vmm;
|
||||
#endif
|
||||
static int swappgsin = -1;
|
||||
static int swappgsout = -1;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
if (server->sysdeps.swap == 0)
|
||||
return;
|
||||
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
length_uvmexp = sizeof (uvmexp);
|
||||
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
|
||||
glibtop_warn_io_r (server, "sysctl (uvmexp)");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
/* This is used to get the `pagein' and `pageout' members. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst2[0].n_value,
|
||||
&vmm, sizeof (vmm)) != sizeof (vmm)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (cnt)");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (swappgsin < 0) {
|
||||
buf->pagein = 0;
|
||||
buf->pageout = 0;
|
||||
} else {
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
buf->pagein = vmm.v_swappgsin - swappgsin;
|
||||
buf->pageout = vmm.v_swappgsout - swappgsout;
|
||||
#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 599002100)
|
||||
/* no uvmexp.swap{ins,outs} */
|
||||
buf->pagein = 0;
|
||||
buf->pageout = 0;
|
||||
#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
buf->pagein = uvmexp.swapins - swappgsin;
|
||||
buf->pageout = uvmexp.swapouts - swappgsout;
|
||||
#else
|
||||
buf->pagein = vmm.v_swpin - swappgsin;
|
||||
buf->pageout = vmm.v_swpout - swappgsout;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
swappgsin = vmm.v_swappgsin;
|
||||
swappgsout = vmm.v_swappgsout;
|
||||
#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 599002100)
|
||||
swappgsin = 0;
|
||||
swappgsout = 0;
|
||||
#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
|
||||
swappgsin = uvmexp.swapins;
|
||||
swappgsout = uvmexp.swapouts;
|
||||
#else
|
||||
swappgsin = vmm.v_swpin;
|
||||
swappgsout = vmm.v_swpout;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#if (__FreeBSD__ < 4) && !defined(__FreeBSD_kernel__)
|
||||
|
||||
/* Size of largest swap device. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[VM_NSWAP].n_value,
|
||||
&nswap, sizeof (nswap)) != sizeof (nswap)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (nswap)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Number of swap devices. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[VM_NSWDEV].n_value,
|
||||
&nswdev, sizeof (nswdev)) != sizeof (nswdev)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (nswdev)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Maximum size of a swap block. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[VM_DMMAX].n_value,
|
||||
&dmmax, sizeof (dmmax)) != sizeof (dmmax)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (dmmax)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* List of free swap areas. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[VM_SWAPLIST].n_value,
|
||||
&swaplist, sizeof (swaplist)) != sizeof (swaplist)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (swaplist)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Kernel offset of list of swap devices and sizes. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[VM_SWDEVT].n_value,
|
||||
&ptr, sizeof (ptr)) != sizeof (ptr)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (swdevt)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* List of swap devices and sizes. */
|
||||
|
||||
sw_size = nswdev * sizeof (*sw);
|
||||
sw = g_malloc (sw_size);
|
||||
|
||||
if (kvm_read (server->machine->kd, ptr, sw, sw_size) != (ssize_t)sw_size) {
|
||||
glibtop_warn_io_r (server, "kvm_read (*swdevt)");
|
||||
return;
|
||||
}
|
||||
|
||||
perdev = g_malloc (nswdev * sizeof (*perdev));
|
||||
|
||||
/* Count up swap space. */
|
||||
|
||||
nfree = 0;
|
||||
memset (perdev, 0, nswdev * sizeof(*perdev));
|
||||
|
||||
swapptr = swaplist.rlh_list;
|
||||
|
||||
while (swapptr) {
|
||||
int top, bottom, next_block;
|
||||
|
||||
if (kvm_read (server->machine->kd, (int) swapptr, &head,
|
||||
sizeof (struct rlist)) != sizeof (struct rlist)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (swapptr)");
|
||||
return;
|
||||
}
|
||||
|
||||
top = head.rl_end;
|
||||
bottom = head.rl_start;
|
||||
|
||||
nfree += top - bottom + 1;
|
||||
|
||||
/*
|
||||
* Swap space is split up among the configured disks.
|
||||
*
|
||||
* For interleaved swap devices, the first dmmax blocks
|
||||
* of swap space some from the first disk, the next dmmax
|
||||
* blocks from the next, and so on up to nswap blocks.
|
||||
*
|
||||
* The list of free space joins adjacent free blocks,
|
||||
* ignoring device boundries. If we want to keep track
|
||||
* of this information per device, we'll just have to
|
||||
* extract it ourselves.
|
||||
*/
|
||||
while (top / dmmax != bottom / dmmax) {
|
||||
next_block = ((bottom + dmmax) / dmmax);
|
||||
perdev[(bottom / dmmax) % nswdev] +=
|
||||
next_block * dmmax - bottom;
|
||||
bottom = next_block * dmmax;
|
||||
}
|
||||
perdev[(bottom / dmmax) % nswdev] +=
|
||||
top - bottom + 1;
|
||||
|
||||
swapptr = head.rl_next;
|
||||
}
|
||||
|
||||
header = getbsize (&hlen, &blocksize);
|
||||
|
||||
div = blocksize / 512;
|
||||
avail = npfree = 0;
|
||||
for (i = 0; i < nswdev; i++) {
|
||||
int xsize, xfree;
|
||||
|
||||
/*
|
||||
* Don't report statistics for partitions which have not
|
||||
* yet been activated via swapon(8).
|
||||
*/
|
||||
if (!(sw[i].sw_flags & SW_FREED))
|
||||
continue;
|
||||
|
||||
/* The first dmmax is never allocated to avoid trashing of
|
||||
* disklabels
|
||||
*/
|
||||
xsize = sw[i].sw_nblks - dmmax;
|
||||
xfree = perdev[i];
|
||||
inuse = xsize - xfree;
|
||||
npfree++;
|
||||
avail += xsize;
|
||||
}
|
||||
|
||||
/*
|
||||
* If only one partition has been set up via swapon(8), we don't
|
||||
* need to bother with totals.
|
||||
*/
|
||||
inuse = avail - nfree;
|
||||
|
||||
g_free (sw);
|
||||
g_free (perdev);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
|
||||
buf->used = inuse;
|
||||
buf->free = avail;
|
||||
|
||||
buf->total = inuse + avail;
|
||||
|
||||
#else
|
||||
|
||||
nswdev = kvm_getswapinfo(server->machine->kd, kvmsw, 16, 0);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
|
||||
buf->used = kvmsw[nswdev].ksw_used * getpagesize();
|
||||
buf->total = kvmsw[nswdev].ksw_total * getpagesize();
|
||||
|
||||
buf->free = buf->total - buf->used;
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined(__bsdi__)
|
||||
|
||||
/* General info about swap devices. */
|
||||
|
||||
if (kvm_read (server->machine->kd, nlst[0].n_value,
|
||||
&swap, sizeof (swap)) != sizeof (swap)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (swap)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
|
||||
buf->used = swap.swap_total - swap.swap_free;
|
||||
buf->free = swap.swap_free;
|
||||
|
||||
buf->total = swap.swap_total;
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
nswap = swapctl (SWAP_NSWAP, NULL, 0);
|
||||
if (nswap < 0) {
|
||||
glibtop_warn_io_r (server, "swapctl (SWAP_NSWAP)");
|
||||
return;
|
||||
}
|
||||
|
||||
swaplist = g_malloc (nswap * sizeof (struct swapent));
|
||||
|
||||
if (swapctl (SWAP_STATS, swaplist, nswap) != nswap) {
|
||||
glibtop_warn_io_r (server, "swapctl (SWAP_STATS)");
|
||||
g_free (swaplist);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < nswap; i++) {
|
||||
avail += swaplist[i].se_nblks;
|
||||
inuse += swaplist[i].se_inuse;
|
||||
}
|
||||
|
||||
g_free (swaplist);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
|
||||
buf->used = inuse;
|
||||
buf->free = avail;
|
||||
|
||||
buf->total = inuse + avail;
|
||||
#endif
|
||||
}
|
||||
91
sysdeps/bsd/sysinfo.c
Normal file
91
sysdeps/bsd/sysinfo.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/sysinfo.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sysinfo =
|
||||
(1L << GLIBTOP_SYSINFO_CPUINFO);
|
||||
|
||||
static glibtop_sysinfo sysinfo = { .flags = 0 };
|
||||
|
||||
static void
|
||||
init_sysinfo (glibtop *server)
|
||||
{
|
||||
char *model;
|
||||
guint64 ncpus = 1;
|
||||
int mhz = 0;
|
||||
size_t len;
|
||||
|
||||
if (G_LIKELY (sysinfo.flags))
|
||||
return;
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
len = sizeof (ncpus);
|
||||
sysctlbyname ("hw.ncpu", &ncpus, &len, NULL, 0);
|
||||
len = 0;
|
||||
sysctlbyname ("hw.model", NULL, &len, NULL, 0);
|
||||
model = g_malloc (len);
|
||||
sysctlbyname ("hw.model", model, &len, NULL, 0);
|
||||
len = sizeof (mhz);
|
||||
sysctlbyname ("hw.clockrate", &mhz, &len, NULL, 0);
|
||||
|
||||
for (sysinfo.ncpu = 0;
|
||||
sysinfo.ncpu < GLIBTOP_NCPU && sysinfo.ncpu < ncpus;
|
||||
sysinfo.ncpu++) {
|
||||
glibtop_entry * const cpuinfo = &sysinfo.cpuinfo[sysinfo.ncpu];
|
||||
|
||||
cpuinfo->labels = g_ptr_array_new ();
|
||||
|
||||
cpuinfo->values = g_hash_table_new_full(g_str_hash,
|
||||
g_str_equal,
|
||||
NULL, g_free);
|
||||
|
||||
g_ptr_array_add (cpuinfo->labels, "processor");
|
||||
g_hash_table_insert (cpuinfo->values, "processor",
|
||||
g_strdup_printf("%u", (guint)sysinfo.ncpu));
|
||||
|
||||
g_ptr_array_add (cpuinfo->labels, "vendor_id");
|
||||
g_hash_table_insert (cpuinfo->values, "vendor_id",
|
||||
g_strdup(model));
|
||||
|
||||
g_ptr_array_add (cpuinfo->labels, "cpu MHz");
|
||||
g_hash_table_insert (cpuinfo->values, "cpu MHz",
|
||||
g_strdup_printf("%d", mhz));
|
||||
}
|
||||
|
||||
g_free (model);
|
||||
|
||||
sysinfo.flags = _glibtop_sysdeps_sysinfo;
|
||||
}
|
||||
|
||||
const glibtop_sysinfo *
|
||||
glibtop_get_sysinfo_s (glibtop *server)
|
||||
{
|
||||
init_sysinfo (server);
|
||||
return &sysinfo;
|
||||
}
|
||||
92
sysdeps/bsd/uptime.c
Normal file
92
sysdeps/bsd/uptime.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/uptime.h>
|
||||
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime =
|
||||
(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME);
|
||||
|
||||
static const unsigned long _required_cpu_flags =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_IDLE) +
|
||||
(1L << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_uptime_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
time_t now;
|
||||
time_t uptime;
|
||||
int mib[2];
|
||||
struct timeval boottime;
|
||||
size_t size;
|
||||
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_BOOTTIME;
|
||||
size = sizeof(boottime);
|
||||
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
|
||||
boottime.tv_sec != 0) {
|
||||
time(&now);
|
||||
buf->uptime = now - boottime.tv_sec;
|
||||
/* XXX: don't know a useful value to put here. */
|
||||
buf->idletime = 0;
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
#else
|
||||
glibtop_cpu cpu;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
/* We simply calculate it from the CPU usage. */
|
||||
|
||||
glibtop_get_cpu_p (server, &cpu);
|
||||
|
||||
/* Make sure all required fields are present. */
|
||||
|
||||
if ((cpu.flags & _required_cpu_flags) != _required_cpu_flags)
|
||||
return;
|
||||
|
||||
/* Calculate values. */
|
||||
|
||||
buf->uptime = (double) cpu.total / (double) cpu.frequency;
|
||||
buf->idletime = (double) cpu.idle / (double) cpu.frequency;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
#endif
|
||||
}
|
||||
253
sysdeps/common/ChangeLog
Normal file
253
sysdeps/common/ChangeLog
Normal file
@@ -0,0 +1,253 @@
|
||||
2007-05-19 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* default.c:
|
||||
|
||||
Fixed returned type.
|
||||
|
||||
2007-03-16 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry):
|
||||
|
||||
Ignore securityfs and fusectl.
|
||||
Patch by Fryderyk Dziarmagowski <freetz@gmx.net>
|
||||
Closes #418718.
|
||||
|
||||
2007-02-10 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s):
|
||||
|
||||
Make sure avail <= free.
|
||||
Closes #406280.
|
||||
|
||||
2007-01-31 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry):
|
||||
|
||||
Fixed order.
|
||||
Added objfs and ctfs.
|
||||
Closes #400557.
|
||||
|
||||
2006-09-21 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry):
|
||||
|
||||
Added nfsd to the exclude list.
|
||||
|
||||
2006-06-24 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* mountlist.c: (read_filesystem_list):
|
||||
|
||||
Ensure file is closed.
|
||||
|
||||
(glibtop_get_mountlist_s):
|
||||
|
||||
Fixed .flags.
|
||||
|
||||
Patch by hua.zhang@sun.com.
|
||||
Closes #345812.
|
||||
|
||||
2006-04-09 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* Makefile.am: Fixed trivial warning.
|
||||
|
||||
2006-02-21 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Also ignores linprocfs, mfs
|
||||
and devfs.
|
||||
Closes #331856.
|
||||
Patch by Andreas Kohn <andreas.kohn@gmail.com>
|
||||
|
||||
2005-04-26 Jörgen Scheibengruber <mfcn@gmx.de>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Added tmpfs to ignore list.
|
||||
|
||||
2005-03-25 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* error.c: (glibtop_error_io_vr), (glibtop_warn_io_vr):
|
||||
* error_suid.c: (glibtop_error_io_vr), (glibtop_warn_io_vr):
|
||||
s/strerror/g_strerror/g.
|
||||
|
||||
2005-03-11 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Added mqueue to ignore list.
|
||||
|
||||
2005-02-28 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* fsusage.c: * Add support for file system read and write counting
|
||||
(needed for the disk load feature of the multiload applet).
|
||||
|
||||
2005-02-23 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s): Correct file system size calculations.
|
||||
Patch from marcus@freebsd.org (Joe Marcus Clarke).
|
||||
Closes #168232.
|
||||
|
||||
2005-02-15 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* fsusage.c: (_glibtop_get_fsusage_read_write): Fixed G_GNUC attribute usage.
|
||||
Replaced macro by inline function.
|
||||
|
||||
2005-01-18 Benoît Dejean <TazForEver@dlfp.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Re-worked with bsearch.
|
||||
|
||||
2004-12-09 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Ignores "unkown" file system type.
|
||||
|
||||
2004-09-24 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s): Fixed .block_size on Solaris.
|
||||
|
||||
2004-09-24 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* mountlist.c:
|
||||
* mountlist.h: Removed mountlist.h.
|
||||
|
||||
2004-09-23 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Added openpromfs.
|
||||
|
||||
2004-09-22 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s): Linux: Sanitize. Removed calls
|
||||
to obfuscated PROPAGATE_ALL_ONES(x) which seems to return unpredictable
|
||||
values on some arch (e.g sparc).
|
||||
Closes #153141.
|
||||
|
||||
2004-09-22 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mountlist.c: (ignore_mount_entry): Added mntfs to ignore list.
|
||||
|
||||
2004-09-21 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* fsusage.c: (_glibtop_get_fsusage_read_write),
|
||||
(glibtop_get_fsusage_s):
|
||||
* mountlist.c: (glibtop_get_mountlist_s): Back to previous version.
|
||||
|
||||
2004-09-19 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* fsusage.c: (_glibtop_get_fsusage_read_write) : Added new flag.
|
||||
(_glibtop_get_fsusage_read_write): Changed prototype. Returns TRUE on
|
||||
success, then _glibtop_get_fsusage_read_write is set.
|
||||
|
||||
Added comment to locate Linux code.
|
||||
|
||||
* mountlist.c: (read_filesystem_list): Dropped unused need_fs_type parameter.
|
||||
This is now default.
|
||||
Fixed possible leak.
|
||||
|
||||
(ignore_mount_entry): Added "usbfs" to ignored FS.
|
||||
|
||||
(glibtop_get_mountlist_s): Updated.
|
||||
|
||||
2004-08-22 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mountlist.c: (read_filesystem_list): Merged FreeBSD Marcus' patch.
|
||||
|
||||
2004-07-17 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s): Started implementation of read, write.
|
||||
Code should be splitted into arch specific files.
|
||||
|
||||
* mountlist.c: (glibtop_get_mountlist_s): glibify. Used GArray.
|
||||
|
||||
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* procargs.c: (split_args0), (glibtop_get_proc_argv_l),
|
||||
(glibtop_get_proc_argv_p), (glibtop_get_proc_argv_s): Added file to
|
||||
repository. Provides glibtop_get_proc_argv*() for system dependant
|
||||
glibtop_get_proc_args*().
|
||||
|
||||
2004-06-18 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* error.c: (print_server_name), (glibtop_error_r),
|
||||
(glibtop_warn_r), (glibtop_error_io_r), (glibtop_warn_io_r),
|
||||
(glibtop_error), (glibtop_warn), (glibtop_error_io),
|
||||
(glibtop_warn_io): These functions are now globally defined.
|
||||
|
||||
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* Makefile.am:
|
||||
* fsusage-frontend.c:
|
||||
* fsusage.h: Removed files.
|
||||
|
||||
* fsusage.c: (glibtop_get_fsusage_s), (statfs): Merged and cleaned.
|
||||
|
||||
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* mountlist.c: (xatoi) Removed, replaced by ISO strtoull.
|
||||
(fstype_to_string): Cleaned.
|
||||
(read_filesystem_list) : Changed prototype. Cleaned and secured.
|
||||
Replaced broken free by g_free.
|
||||
(ignore_mount_entry): Added.
|
||||
(glibtop_get_mountlist_s): Cleaned. Better allocation algorithm.
|
||||
@all_fs has now a real meaning, see the documentation.
|
||||
|
||||
2004-06-06 Benoît Dejean <tazforever@dlfp.org>
|
||||
|
||||
* gnuslib.c: (connect_to_internet_server): Cleaned.
|
||||
* mountlist.c: (glibtop_get_mountlist_s): Replaced multiple strcpy/cat by
|
||||
g_strdup_printf. Replaced strncpy by g_strlcpy.
|
||||
|
||||
2004-03-15 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* fsusage.c:
|
||||
* fsusage.h: remove use of uintmax_t
|
||||
|
||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* fsusage.c: fix build (we don't have "full-read.h" here)
|
||||
|
||||
2003-12-27 Ole Laursen <olau@hardworking.dk>
|
||||
|
||||
* README.fsusage: Added a few words about the code from GNU
|
||||
Coreutils.
|
||||
|
||||
* fsusage.c, fsusage.h: Resynced from GNU Coreutils 5.0.
|
||||
|
||||
* fsusage-frontend.c: Moved the frontend from fsusage.c to here.
|
||||
|
||||
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am:
|
||||
* fsusage.h: install only one library, libgtop-2.0
|
||||
Fix build-time warnings due to the redefinition of guint64
|
||||
Include glib.h for the definition of guint64
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* inodedb.c: (glibtop_inodedb_close_s): fix compilation, thanks Jeff
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* ChangeLog:
|
||||
* backend.c: (_open_common):
|
||||
* fsusage.c:
|
||||
* fsusage.h:
|
||||
* inodedb.c: (glibtop_inodedb_lookup_s): s/u_int64_t/guint64/
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* inodedb.c:
|
||||
* mountlist.c: (glibtop_get_mountlist_s): fixed compilation
|
||||
|
||||
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am:
|
||||
* inodedb.c: (glibtop_inodedb_open_s), (glibtop_inodedb_close_s):
|
||||
* mountlist.c: (glibtop_get_mountlist_s):
|
||||
* xmalloc.c:
|
||||
* xmalloc_suid.c: replace all the xmalloc crap by glib memory
|
||||
management functions
|
||||
|
||||
2000-01-20 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* fsusage.c (adjust_blocks): Use `guint64' arguments and
|
||||
return value to avoid long int overflows on machines with large
|
||||
disks.
|
||||
|
||||
* fsusage.h (struct fs_usage): Use `guint64' here as well.
|
||||
|
||||
25
sysdeps/common/Makefile.am
Normal file
25
sysdeps/common/Makefile.am
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libgtop_common-2.0.la libgtop_suid_common-2.0.la
|
||||
|
||||
if !LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST
|
||||
mountlist_src = mountlist.c
|
||||
endif
|
||||
|
||||
if !LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE
|
||||
fsusage_src = fsusage.c
|
||||
endif
|
||||
|
||||
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
|
||||
procargs.c \
|
||||
default.c \
|
||||
$(mountlist_src) $(fsusage_src)
|
||||
|
||||
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_common_2_0_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
|
||||
|
||||
libgtop_suid_common_2_0_la_SOURCES = error.c sysdeps_suid.c
|
||||
|
||||
# libgtop_suid_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
694
sysdeps/common/Makefile.in
Normal file
694
sysdeps/common/Makefile.in
Normal file
@@ -0,0 +1,694 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = sysdeps/common
|
||||
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 \
|
||||
$(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 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/libgtop-sysdeps.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libgtop_common_2_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am__libgtop_common_2_0_la_SOURCES_DIST = error.c gnuslib.c procargs.c \
|
||||
default.c mountlist.c fsusage.c
|
||||
@LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST_FALSE@am__objects_1 = mountlist.lo
|
||||
@LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE_FALSE@am__objects_2 = fsusage.lo
|
||||
am_libgtop_common_2_0_la_OBJECTS = error.lo gnuslib.lo procargs.lo \
|
||||
default.lo $(am__objects_1) $(am__objects_2)
|
||||
libgtop_common_2_0_la_OBJECTS = $(am_libgtop_common_2_0_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libgtop_suid_common_2_0_la_LIBADD =
|
||||
am_libgtop_suid_common_2_0_la_OBJECTS = error.lo sysdeps_suid.lo
|
||||
libgtop_suid_common_2_0_la_OBJECTS = \
|
||||
$(am_libgtop_suid_common_2_0_la_OBJECTS)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libgtop_common_2_0_la_SOURCES) \
|
||||
$(libgtop_suid_common_2_0_la_SOURCES)
|
||||
DIST_SOURCES = $(am__libgtop_common_2_0_la_SOURCES_DIST) \
|
||||
$(libgtop_suid_common_2_0_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__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)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB = @DL_LIB@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GTKDOC_CHECK = @GTKDOC_CHECK@
|
||||
GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
|
||||
GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
|
||||
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
|
||||
GTKDOC_MKPDF = @GTKDOC_MKPDF@
|
||||
GTKDOC_REBASE = @GTKDOC_REBASE@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
|
||||
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
|
||||
INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
|
||||
INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
|
||||
INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
|
||||
INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
|
||||
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
|
||||
INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
|
||||
KVM_LIBS = @KVM_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGTOP_BINDIR = @LIBGTOP_BINDIR@
|
||||
LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
|
||||
LIBGTOP_INCS = @LIBGTOP_INCS@
|
||||
LIBGTOP_LIBS = @LIBGTOP_LIBS@
|
||||
LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
|
||||
LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
|
||||
LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
|
||||
LIBGTOP_SERVER = @LIBGTOP_SERVER@
|
||||
LIBGTOP_SERVER_VERSION = @LIBGTOP_SERVER_VERSION@
|
||||
LIBGTOP_VERSION = @LIBGTOP_VERSION@
|
||||
LIBGTOP_VERSION_CODE = @LIBGTOP_VERSION_CODE@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
LT_VERSION_INFO = @LT_VERSION_INFO@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libgtop_have_sysinfo = @libgtop_have_sysinfo@
|
||||
libgtop_need_server = @libgtop_need_server@
|
||||
libgtop_postinstall = @libgtop_postinstall@
|
||||
libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
|
||||
libgtop_top_builddir = @libgtop_top_builddir@
|
||||
libs_xauth = @libs_xauth@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
server_programs = @server_programs@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysdeps_dir = @sysdeps_dir@
|
||||
sysdeps_suid_lib = @sysdeps_suid_lib@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
noinst_LTLIBRARIES = libgtop_common-2.0.la libgtop_suid_common-2.0.la
|
||||
@LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST_FALSE@mountlist_src = mountlist.c
|
||||
@LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE_FALSE@fsusage_src = fsusage.c
|
||||
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
|
||||
procargs.c \
|
||||
default.c \
|
||||
$(mountlist_src) $(fsusage_src)
|
||||
|
||||
|
||||
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_common_2_0_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
|
||||
libgtop_suid_common_2_0_la_SOURCES = error.c sysdeps_suid.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/common/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/common/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libgtop_common-2.0.la: $(libgtop_common_2_0_la_OBJECTS) $(libgtop_common_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_common_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libgtop_common_2_0_la_OBJECTS) $(libgtop_common_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
libgtop_suid_common-2.0.la: $(libgtop_suid_common_2_0_la_OBJECTS) $(libgtop_suid_common_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_suid_common_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libgtop_suid_common_2_0_la_OBJECTS) $(libgtop_suid_common_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsusage.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnuslib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mountlist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procargs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysdeps_suid.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# libgtop_suid_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
448
sysdeps/common/default.c
Normal file
448
sysdeps/common/default.c
Normal file
@@ -0,0 +1,448 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/sysinfo.h>
|
||||
#include <glibtop/union.h>
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_close:
|
||||
*
|
||||
* Close the connection to the server.
|
||||
*/
|
||||
void
|
||||
glibtop_close(void)
|
||||
{
|
||||
glibtop_close_r(glibtop_global_server);
|
||||
}
|
||||
|
||||
/**
|
||||
* SECTION:glibtop
|
||||
* @short_description: Server initilization
|
||||
* @stability: Stable
|
||||
*
|
||||
* You do not need to worry about the #glibtop * server structure if
|
||||
* you don't need - the library exports a #glibtop_global_server
|
||||
* which you can use everywhere a #glibtop * is expected.
|
||||
*
|
||||
* Most of the library and all of the sysdeps function also have an alias
|
||||
* (which is the function name without the <suffix>_l</suffix>,
|
||||
* <suffix>_s</suffix> or <suffix>_r</suffix> suffix) which don't
|
||||
* take a #glibtop * as argument but uses the #glibtop_global_server
|
||||
* instead.
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_init:
|
||||
*
|
||||
* Server initialization.
|
||||
*
|
||||
* Returns: A #glibtop reference.
|
||||
*/
|
||||
glibtop*
|
||||
glibtop_init(void)
|
||||
{
|
||||
return glibtop_init_r(&glibtop_global_server, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_cpu:
|
||||
* @buf: A location to return the CPU usage.
|
||||
*
|
||||
* Get the CPU usage.
|
||||
*
|
||||
* All CPU units are measured in <type>jiffies</type> which are normally
|
||||
* 1/100th of a second (in which case <type>frequency</type> equals 100),
|
||||
* but can also be in any other unit. To get seconds, divide them by
|
||||
* <type>frequency</type>.
|
||||
*/
|
||||
void
|
||||
glibtop_get_cpu(glibtop_cpu *buf)
|
||||
{
|
||||
glibtop_get_cpu_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_fsusage:
|
||||
* @buf: A location to return the file system usage.
|
||||
* @mount_dir: mount dir where to get the information of usage.
|
||||
*
|
||||
* Get the file system usage for an specific @mount_dir.
|
||||
*/
|
||||
void
|
||||
glibtop_get_fsusage(glibtop_fsusage *buf, const char *mount_dir)
|
||||
{
|
||||
glibtop_get_fsusage_l(glibtop_global_server, buf, mount_dir);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_uptime:
|
||||
* @buf: A location to return the system uptime
|
||||
*
|
||||
* When porting LibGTop to a new system, you only need to implement
|
||||
* #uptime and #idletime if there's a faster or better way to obtain them
|
||||
* as using function(glibtop_cpu) for it. Look at
|
||||
* <filename>sysdeps/freebsd/uptime.c</filename> for an
|
||||
* example on how to obtain them using function(glibtop_cpu).
|
||||
*/
|
||||
void
|
||||
glibtop_get_uptime(glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_get_uptime_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_sysinfo:
|
||||
*
|
||||
* Returns: The system information through a #glibtop_sysinfo structure.
|
||||
*/
|
||||
const glibtop_sysinfo *
|
||||
glibtop_get_sysinfo(void)
|
||||
{
|
||||
return glibtop_get_sysinfo_s(glibtop_global_server);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_swap:
|
||||
* @buf: A location to return a #glibtop_swap.
|
||||
*
|
||||
* Get the swap usage.
|
||||
*/
|
||||
void
|
||||
glibtop_get_swap(glibtop_swap *buf)
|
||||
{
|
||||
glibtop_get_swap_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_uid:
|
||||
* @buf: A location to return a #glibtop_proc_uid
|
||||
* @pid: Process id to get the user and tty information
|
||||
*
|
||||
* Get the process user id and tty information.
|
||||
*/
|
||||
void
|
||||
glibtop_get_proc_uid(glibtop_proc_uid *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_uid_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:proctime
|
||||
* @title: Process Time
|
||||
* @short_description: Get process time information
|
||||
* @stability: Stable
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_time:
|
||||
* @buf: Returned process time information - see #glibtop_proc_time.
|
||||
* @pid: Process id
|
||||
*
|
||||
* Get process time information.
|
||||
*/
|
||||
void
|
||||
glibtop_get_proc_time(glibtop_proc_time *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_time_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_proc_state(glibtop_proc_state *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_state_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal(glibtop_proc_signal *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_signal_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_proc_segment(glibtop_proc_segment *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_segment_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
glibtop_open_files_entry *
|
||||
glibtop_get_proc_open_files(glibtop_proc_open_files *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_open_files_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem(glibtop_proc_mem *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_mem_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map(glibtop_proc_map *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_map_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:procargs
|
||||
* @title: Process Arguments
|
||||
* @short_description: Get process command line arguments
|
||||
* @see_also: #libgtop-Process-List
|
||||
* @stability: Stable
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_args:
|
||||
* @buf: Struct with @size of returned string.
|
||||
* @pid: Process id
|
||||
* @max_len: Maximum length of string to return (use zero to get all arguments).
|
||||
*
|
||||
* Get process command line arguments.
|
||||
*
|
||||
* Returns: @pid's command line arguments separated by null bytes; the length of
|
||||
* this string is returned in the @buf size field. You are required to free
|
||||
* the string when done.
|
||||
*/
|
||||
char *
|
||||
glibtop_get_proc_args(glibtop_proc_args *buf, pid_t pid, unsigned max_len)
|
||||
{
|
||||
return glibtop_get_proc_args_l(glibtop_global_server, buf, pid, max_len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_argv
|
||||
* @buf: Struct with @size of combined returned arguments.
|
||||
* @pid: Process id
|
||||
* @max_len: Maximum length of all arguments combined (use zero to get all arguments).
|
||||
*
|
||||
* Get process command line arguments.
|
||||
*
|
||||
* Returns: A NULL-terminated array of strings with all arguments of process pid
|
||||
* (up to @max_len characters). Remember to <function>g_strfreev</function>
|
||||
* the returned array to avoid a memory leak.
|
||||
*/
|
||||
char **
|
||||
glibtop_get_proc_argv(glibtop_proc_args *buf, pid_t pid, unsigned max_len)
|
||||
{
|
||||
return glibtop_get_proc_argv_l(glibtop_global_server, buf, pid, max_len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:proclist
|
||||
* @title: Process List
|
||||
* @short_description: List running processes
|
||||
* @stability: Stable
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_get_proclist
|
||||
* @buf: Extra return information, see #glibtop_proclist.
|
||||
* @which: Criteria for processes in returned list. See the <type>GLIBTOP_KERN_PROC_*</type> and <type>GLIBTOP_EXCLUDE_*</type> constants.
|
||||
* @arg: Extra arguments applied to @which. Only <type>GLIBTOP_KERN_PROC_*</type> constants take arguments, see each constant definition for particular @arg description.
|
||||
*
|
||||
* Returns: A list of running processes or <type>NULL</type> on error. The
|
||||
* returned list is allocated using <function>g_malloc</function> and must be
|
||||
* freed using <function>g_free</function> to avoid a memory leak.
|
||||
*/
|
||||
pid_t*
|
||||
glibtop_get_proclist(glibtop_proclist *buf, gint64 which, gint64 arg)
|
||||
{
|
||||
return glibtop_get_proclist_l(glibtop_global_server, buf, which, arg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel(glibtop_proc_kernel *buf, pid_t pid)
|
||||
{
|
||||
glibtop_get_proc_kernel_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:ppp
|
||||
* @short_description: PPP Usage.
|
||||
* @see_also: #libgtop-netload, #libgtop-netlist
|
||||
* @stability: Stable
|
||||
*
|
||||
* Management of a PPP device.
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_get_ppp:
|
||||
* @buf: A location to return the PPP usage
|
||||
* @short device: The device to ask information
|
||||
*
|
||||
* Get the PPP usage.
|
||||
*/
|
||||
void
|
||||
glibtop_get_ppp(glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
glibtop_get_ppp_l(glibtop_global_server, buf, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* SECTION:netlist
|
||||
* @short_description: Network Devices List.
|
||||
* @see_also: #libgtop-netload
|
||||
* @stability: Stable
|
||||
*
|
||||
* The application class handles ...
|
||||
*/
|
||||
|
||||
/**
|
||||
* glibtop_get_nelist:
|
||||
* @buf:
|
||||
*
|
||||
* Get the list of network devices.
|
||||
*
|
||||
* Returns: A list of network devices.
|
||||
*/
|
||||
char**
|
||||
glibtop_get_netlist(glibtop_netlist *buf)
|
||||
{
|
||||
return glibtop_get_netlist_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* SECTION:netload
|
||||
* @short_description: Network Load.
|
||||
* @see_also: #libtop-netlist
|
||||
* @stability: Stable
|
||||
*
|
||||
* The application class handles ...
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_netload:
|
||||
* @buf: The variable where the results will be assigned.
|
||||
* @interface: The name of the network interface.
|
||||
*
|
||||
* Recolects network statistics for @interface
|
||||
* (which is the same than in <application>ifconfig</application>).
|
||||
* The values are returned into @buf.
|
||||
*/
|
||||
void
|
||||
glibtop_get_netload(glibtop_netload *buf, const char *interface)
|
||||
{
|
||||
glibtop_get_netload_l(glibtop_global_server, buf, interface);
|
||||
}
|
||||
|
||||
|
||||
glibtop_mountentry *
|
||||
glibtop_get_mountlist(glibtop_mountlist *buf, int all_fs)
|
||||
{
|
||||
return glibtop_get_mountlist_l(glibtop_global_server, buf, all_fs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_mem:
|
||||
* @buf: Buffer where the output will be given.
|
||||
*
|
||||
* Get the memory usage. Unless explicitly stated otherwise, all memory
|
||||
* units are in bytes.
|
||||
*/
|
||||
void
|
||||
glibtop_get_mem(glibtop_mem *buf)
|
||||
{
|
||||
glibtop_get_mem_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_loadavg(glibtop_loadavg *buf)
|
||||
{
|
||||
glibtop_get_loadavg_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits(glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_get_msg_limits_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits(glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_get_sem_limits_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits(glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_get_shm_limits_l(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_sysdeps(glibtop_sysdeps *buf)
|
||||
{
|
||||
glibtop_get_sysdeps_r(glibtop_global_server, buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_wd:
|
||||
* @buf:
|
||||
* @pid: Process id to get the user and tty information
|
||||
*
|
||||
* Get the root directory and the working directories
|
||||
*
|
||||
* Returns: A NULL-terminated list of working directories.
|
||||
*/
|
||||
char**
|
||||
glibtop_get_proc_wd(glibtop_proc_wd *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_wd_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_affinity:
|
||||
* @buf:
|
||||
* @pid: Process id to get the affinity
|
||||
*
|
||||
* Get the processor affinity list for a process
|
||||
*
|
||||
* Returns: A list of processor ID of 'buf.number' elements.
|
||||
*/
|
||||
guint16 *
|
||||
glibtop_get_proc_affinity(glibtop_proc_affinity *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_affinity_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* glibtop_get_proc_io: Get the io stats for the given pid
|
||||
* @buf: Buffer where the result will be given
|
||||
* @pid: Process id to get the io stats for
|
||||
*
|
||||
* Get the io stats for a process
|
||||
*
|
||||
* Returns: A list of processor ID of 'buf.number' elements.
|
||||
*/
|
||||
void
|
||||
glibtop_get_proc_io(glibtop_proc_io *buf, pid_t pid)
|
||||
{
|
||||
return glibtop_get_proc_io_l(glibtop_global_server, buf, pid);
|
||||
}
|
||||
223
sysdeps/common/error.c
Normal file
223
sysdeps/common/error.c
Normal file
@@ -0,0 +1,223 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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 <glib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glibtop/error.h>
|
||||
|
||||
enum MESSAGE_LEVEL {
|
||||
MESSAGE_DEBUG,
|
||||
MESSAGE_WARNING,
|
||||
MESSAGE_ERROR
|
||||
};
|
||||
|
||||
#define DEFAULT_NAME "LibGTop-Server"
|
||||
|
||||
/* Prints error message and exits. */
|
||||
|
||||
static void
|
||||
print_message (const glibtop *server, int message_level, const char *format, int error, va_list args)
|
||||
{
|
||||
const char *level;
|
||||
GString* message;
|
||||
|
||||
message = g_string_new(NULL);
|
||||
|
||||
g_string_printf(message, "%s", (server && server->name ? server->name : DEFAULT_NAME));
|
||||
|
||||
if (server && server->pid) {
|
||||
g_string_append_printf(message, "(c=%u/s=%u)", getpid(), server->pid);
|
||||
}
|
||||
else {
|
||||
g_string_append_printf(message, "(c=%u)", getpid());
|
||||
}
|
||||
|
||||
switch (message_level) {
|
||||
case MESSAGE_DEBUG:
|
||||
level = "DEBUG";
|
||||
break;
|
||||
case MESSAGE_WARNING:
|
||||
level = "WARNING";
|
||||
break;
|
||||
case MESSAGE_ERROR:
|
||||
level = "ERROR";
|
||||
break;
|
||||
default:
|
||||
level = "UNKNOWN";
|
||||
}
|
||||
|
||||
g_string_append_printf(message, ": [%s] ", level);
|
||||
|
||||
g_string_append_vprintf(message, format, args);
|
||||
|
||||
if (error) {
|
||||
g_string_append_printf(message, ": %s", g_strerror(error));
|
||||
}
|
||||
|
||||
g_string_append_c(message, '\n');
|
||||
|
||||
fputs(message->str, stderr);
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_vr (glibtop *server, const char *format, va_list args)
|
||||
{
|
||||
print_message (server, MESSAGE_ERROR, format, 0, args);
|
||||
|
||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||
abort ();
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_io_vr (glibtop *server, const char *format, int error, va_list args)
|
||||
{
|
||||
print_message (server, MESSAGE_ERROR, format, error, args);
|
||||
|
||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||
abort ();
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_vr (glibtop *server, const char *format, va_list args)
|
||||
{
|
||||
print_message (server, MESSAGE_WARNING, format, 0, args);
|
||||
|
||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_io_vr (glibtop *server, const char *format, int error, va_list args)
|
||||
{
|
||||
print_message (server, MESSAGE_WARNING, format, error, args);
|
||||
|
||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_error_r (glibtop *server, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_error_vr (server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_warn_r (glibtop *server, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_warn_vr (server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_io_r (glibtop *server, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_error_io_vr (server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_io_r (glibtop *server, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_warn_io_vr (server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_debug_vr (glibtop *server, const char *format, va_list args)
|
||||
{
|
||||
print_message (server, MESSAGE_DEBUG, format, 0, args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_debug_r_real (glibtop *server, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_debug_vr (server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glibtop_error (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_error_vr (glibtop_global_server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_warn_vr (glibtop_global_server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_io (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_error_io_vr (glibtop_global_server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_io (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
335
sysdeps/common/fsusage.c
Normal file
335
sysdeps/common/fsusage.c
Normal file
@@ -0,0 +1,335 @@
|
||||
/* fsusage.c -- return space usage of mounted filesystems
|
||||
Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */
|
||||
# include <sys/fs/s5param.h>
|
||||
#endif
|
||||
|
||||
#if defined HAVE_SYS_FILSYS_H && !defined _CRAY
|
||||
# include <sys/filsys.h> /* SVR2 */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DUSTAT_H /* AIX PS/2 */
|
||||
# include <sys/dustat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATVFS_H /* SVR4 */
|
||||
# include <sys/statvfs.h>
|
||||
int statvfs (const char *path, struct statvfs *buf);
|
||||
#endif
|
||||
|
||||
/* Many space usage primitives use all 1 bits to denote a value that is
|
||||
not applicable or unknown. Propagate this information by returning
|
||||
a guint64 value that is all 1 bits if X is all 1 bits, even if X
|
||||
is unsigned and narrower than guint64. */
|
||||
#define PROPAGATE_ALL_ONES(x) \
|
||||
((sizeof (x) < sizeof (guint64) \
|
||||
&& (~ (x) == (sizeof (x) < sizeof (int) \
|
||||
? - (1 << (sizeof (x) * CHAR_BIT)) \
|
||||
: 0))) \
|
||||
? G_MAXUINT64 : (x))
|
||||
|
||||
/* Extract the top bit of X as an guint64 value. */
|
||||
#define EXTRACT_TOP_BIT(x) ((x) \
|
||||
& ((guint64) 1 << (sizeof (x) * CHAR_BIT - 1)))
|
||||
|
||||
/* If a value is negative, many space usage primitives store it into an
|
||||
integer variable by assignment, even if the variable's type is unsigned.
|
||||
So, if a space usage variable X's top bit is set, convert X to the
|
||||
guint64 value V such that (- (guint64) V) is the negative of
|
||||
the original value. If X's top bit is clear, just yield X.
|
||||
Use PROPAGATE_TOP_BIT if the original value might be negative;
|
||||
otherwise, use PROPAGATE_ALL_ONES. */
|
||||
#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
|
||||
|
||||
/* Fill in the fields of FSP with information about space usage for
|
||||
the filesystem on which PATH resides.
|
||||
DISK is the device on which PATH is mounted, for space-getting
|
||||
methods that need to know it.
|
||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_fsusage =
|
||||
(1L << GLIBTOP_FSUSAGE_BLOCKS) + (1L << GLIBTOP_FSUSAGE_BFREE)
|
||||
+ (1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES)
|
||||
+ (1L << GLIBTOP_FSUSAGE_FFREE) + (1L << GLIBTOP_FSUSAGE_BLOCK_SIZE);
|
||||
|
||||
|
||||
/*
|
||||
* _glibtop_get_fsusage_read_write
|
||||
* New function to retrieve total read and write
|
||||
*
|
||||
* Each arch should have its own function()
|
||||
* and the proper #define. This is more readable than one single
|
||||
* function full of #something where everything is mixed.
|
||||
* These functions are private.
|
||||
*
|
||||
* void _glibtop_<arch>_get_fsusage_read_write(glibtop*server,
|
||||
* glibtop_fsusage *buf,
|
||||
* const char *path);
|
||||
*
|
||||
* TODO: split this file properly, is possible
|
||||
*/
|
||||
|
||||
#ifdef linux
|
||||
void
|
||||
_glibtop_linux_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path);
|
||||
|
||||
static inline void
|
||||
_glibtop_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path)
|
||||
{
|
||||
_glibtop_linux_get_fsusage_read_write(server, buf, path);
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
void
|
||||
_glibtop_freebsd_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path);
|
||||
|
||||
#define _glibtop_get_fsusage_read_write(S, B, P) \
|
||||
_glibtop_freebsd_get_fsusage_read_write(S, B, P)
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
void
|
||||
_glibtop_openbsd_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path);
|
||||
|
||||
#define _glibtop_get_fsusage_read_write(S, B, P) \
|
||||
_glibtop_openbsd_get_fsusage_read_write(S, B, P)
|
||||
|
||||
#else /* default fallback */
|
||||
#warning glibtop_get_fsusage .read .write are not implemented.
|
||||
static inline void
|
||||
_glibtop_get_fsusage_read_write(glibtop *server,
|
||||
glibtop_fsusage *buf,
|
||||
const char *path)
|
||||
{
|
||||
/* NOOP */
|
||||
}
|
||||
#endif /* default fallback */
|
||||
|
||||
/* end _glibtop_get_fsusage_read_write */
|
||||
|
||||
|
||||
|
||||
void
|
||||
glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
|
||||
const char *path)
|
||||
{
|
||||
#if defined STAT_STATFS3_OSF1
|
||||
struct statfs fsd;
|
||||
#elif defined STAT_STATFS2_FS_DATA /* Ultrix */
|
||||
struct fs_data fsd;
|
||||
#elif defined STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
|
||||
struct statfs fsd;
|
||||
#elif defined STAT_STATVFS /* SVR4 */
|
||||
struct statvfs fsd;
|
||||
#elif defined STAT_STATFS2_FSIZE /* 4.4BSD */
|
||||
struct statfs fsd;
|
||||
#elif defined STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
|
||||
struct stafs fsd;
|
||||
#endif
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_fsusage));
|
||||
|
||||
#ifdef STAT_STATFS3_OSF1
|
||||
|
||||
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
|
||||
return;
|
||||
|
||||
buf->block_size = PROPAGATE_ALL_ONES (fsd.f_fsize);
|
||||
|
||||
#endif /* STAT_STATFS3_OSF1 */
|
||||
|
||||
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
|
||||
|
||||
if (statfs (path, &fsd) != 1)
|
||||
return;
|
||||
|
||||
buf->block_size = 1024;
|
||||
buf->blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
|
||||
buf->bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
|
||||
buf->bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen);
|
||||
/* buf->bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0; */
|
||||
buf->files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
|
||||
buf->ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
|
||||
|
||||
#endif /* STAT_STATFS2_FS_DATA */
|
||||
|
||||
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
|
||||
|
||||
if (statfs (path, &fsd) < 0)
|
||||
return;
|
||||
|
||||
buf->block_size = PROPAGATE_ALL_ONES (fsd.f_bsize);
|
||||
|
||||
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
|
||||
|
||||
/* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
|
||||
struct statfs are truncated to 2GB. These conditions detect that
|
||||
truncation, presumably without botching the 4.1.1 case, in which
|
||||
the values are not truncated. The correct counts are stored in
|
||||
undocumented spare fields. */
|
||||
if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0)
|
||||
{
|
||||
fsd.f_blocks = fsd.f_spare[0];
|
||||
fsd.f_bfree = fsd.f_spare[1];
|
||||
fsd.f_bavail = fsd.f_spare[2];
|
||||
}
|
||||
# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
|
||||
|
||||
#endif /* STAT_STATFS2_BSIZE */
|
||||
|
||||
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
|
||||
|
||||
if (statfs (path, &fsd) < 0)
|
||||
return;
|
||||
|
||||
buf->block_size = PROPAGATE_ALL_ONES (fsd.f_fsize);
|
||||
|
||||
#endif /* STAT_STATFS2_FSIZE */
|
||||
|
||||
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
|
||||
|
||||
# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN
|
||||
# define f_bavail f_bfree
|
||||
# endif
|
||||
|
||||
if (statfs (path, &fsd, sizeof fsd, 0) < 0)
|
||||
return;
|
||||
|
||||
/* Empirically, the block counts on most SVR3 and SVR3-derived
|
||||
systems seem to always be in terms of 512-byte blocks,
|
||||
no matter what value f_bsize has. */
|
||||
# if _AIX || defined _CRAY
|
||||
buf->block_size = PROPAGATE_ALL_ONES (fsd.f_bsize);
|
||||
# else
|
||||
buf->block_size = 512;
|
||||
# endif
|
||||
|
||||
#endif /* STAT_STATFS4 */
|
||||
|
||||
#ifdef STAT_STATVFS /* SVR4 */
|
||||
/* Linux, Solaris */
|
||||
|
||||
if (statvfs (path, &fsd) < 0)
|
||||
return;
|
||||
|
||||
#if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)) \
|
||||
|| defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
/* Solaris but not SunOS and FreeBSD */
|
||||
buf->block_size = fsd.f_frsize;
|
||||
#else
|
||||
/* else, including Linux */
|
||||
buf->block_size = fsd.f_bsize;
|
||||
#endif
|
||||
|
||||
#endif /* STAT_STATVFS */
|
||||
|
||||
#if !defined STAT_STATFS2_FS_DATA && !defined STAT_READ_FILSYS
|
||||
/* !Ultrix && !SVR2 */
|
||||
/* Linux */
|
||||
|
||||
buf->blocks = fsd.f_blocks;
|
||||
buf->bfree = fsd.f_bfree;
|
||||
buf->bavail = (fsd.f_bavail > fsd.f_bfree) ? 0 : fsd.f_bavail;
|
||||
buf->files = fsd.f_files;
|
||||
buf->ffree = fsd.f_ffree;
|
||||
|
||||
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */
|
||||
|
||||
buf->flags = _glibtop_sysdeps_fsusage;
|
||||
|
||||
/* setting additional flags is delegated */
|
||||
_glibtop_get_fsusage_read_write(server, buf, path);
|
||||
}
|
||||
|
||||
#if defined _AIX && defined _I386
|
||||
/* AIX PS/2 does not supply statfs. */
|
||||
|
||||
static int
|
||||
statfs (const char *path, struct statfs *fsb)
|
||||
{
|
||||
struct stat stats;
|
||||
struct dustat fsd;
|
||||
|
||||
if (stat (path, &stats))
|
||||
return -1;
|
||||
if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd)))
|
||||
return -1;
|
||||
fsb->f_type = 0;
|
||||
fsb->f_bsize = fsd.du_bsize;
|
||||
fsb->f_blocks = fsd.du_fsize - fsd.du_isize;
|
||||
fsb->f_bfree = fsd.du_tfree;
|
||||
fsb->f_bavail = fsd.du_tfree;
|
||||
fsb->f_files = (fsd.du_isize - 2) * fsd.du_inopb;
|
||||
fsb->f_ffree = fsd.du_tinode;
|
||||
fsb->f_fsid.val[0] = fsd.du_site;
|
||||
fsb->f_fsid.val[1] = fsd.du_pckno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _AIX && _I386 */
|
||||
373
sysdeps/common/gnuslib.c
Normal file
373
sysdeps/common/gnuslib.c
Normal file
@@ -0,0 +1,373 @@
|
||||
/* -*-C-*-
|
||||
* Common library code for the GNU Emacs server and client.
|
||||
*
|
||||
* This file is part of GNU Emacs.
|
||||
*
|
||||
* Copying is permitted under those conditions described by the GNU
|
||||
* General Public License.
|
||||
*
|
||||
* Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on
|
||||
* 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
|
||||
* Emacs distribution.
|
||||
*
|
||||
* Please mail bugs and suggestions to the author at the above address.
|
||||
*/
|
||||
|
||||
/* HISTORY
|
||||
* 11-Nov-1990 bristor@simba
|
||||
* Added EOT stuff.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file incorporates new features added by Bob Weiner <weiner@mot.com>,
|
||||
* Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
|
||||
* Please see the note at the end of the README file for details.
|
||||
*
|
||||
* (If gnuserv came bundled with your emacs, the README file is probably
|
||||
* ../etc/gnuserv.README relative to the directory containing this file)
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/gnuserv.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
static int connect_to_unix_server (void);
|
||||
#endif
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
static int connect_to_internet_server (const char *serverhost, u_short port);
|
||||
#endif
|
||||
|
||||
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
||||
#ifdef HAVE_BROKEN_INET_ADDR
|
||||
#define IN_ADDR struct in_addr
|
||||
#define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == 0xffffffff)
|
||||
#else
|
||||
#if (LONGBITS > 32)
|
||||
#define IN_ADDR unsigned int
|
||||
#else
|
||||
#define IN_ADDR unsigned long
|
||||
#endif
|
||||
#define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) 0xffffffff)
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
int
|
||||
glibtop_make_connection (const char *hostarg, int portarg, int *s)
|
||||
{
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
char *ptr;
|
||||
|
||||
if (hostarg == NULL)
|
||||
hostarg = getenv ("LIBGTOP_HOST");
|
||||
if (portarg == 0 && (ptr = getenv ("LIBGTOP_PORT")) != NULL)
|
||||
portarg = atoi (ptr);
|
||||
#endif
|
||||
|
||||
if (hostarg != NULL) {
|
||||
/* hostname was given explicitly, via cmd line arg or
|
||||
* LIBGTOP_HOST, * so obey it. */
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
if (!strcmp (hostarg, "unix")) {
|
||||
*s = connect_to_unix_server ();
|
||||
return (int) CONN_UNIX;
|
||||
}
|
||||
#endif /* UNIX_DOMAIN_SOCKETS */
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
*s = connect_to_internet_server (hostarg, portarg);
|
||||
return (int) CONN_INTERNET;
|
||||
#endif
|
||||
} else {
|
||||
/* no hostname given. Use unix-domain/sysv-ipc, or *
|
||||
* internet-domain connection to local host if they're not
|
||||
* available. */
|
||||
#if defined(UNIX_DOMAIN_SOCKETS)
|
||||
*s = connect_to_unix_server ();
|
||||
return (int) CONN_UNIX;
|
||||
#elif defined(INTERNET_DOMAIN_SOCKETS)
|
||||
{
|
||||
char localhost[HOSTNAMSZ];
|
||||
|
||||
gethostname (localhost, HOSTNAMSZ); /* use this
|
||||
* host by
|
||||
* default */
|
||||
*s = connect_to_internet_server (localhost, portarg);
|
||||
return (int) CONN_INTERNET;
|
||||
}
|
||||
#endif /* IPC type */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
|
||||
/*
|
||||
* send_string -- send string to socket.
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
send_string (s, msg)
|
||||
int s;
|
||||
const char *msg;
|
||||
{
|
||||
#if 0
|
||||
if (send (s, msg, strlen (msg), 0) < 0) {
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to send\n", progname);
|
||||
exit (1);
|
||||
}; /* if */
|
||||
#else
|
||||
int len, left = strlen (msg);
|
||||
|
||||
while (left > 0) {
|
||||
if ((len = write (s, msg, min2 (left, GSERV_BUFSZ))) < 0) {
|
||||
/* XEmacs addition: robertl@arnet.com */
|
||||
if (errno == EPIPE) {
|
||||
return;
|
||||
}
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to send\n", progname);
|
||||
exit (1);
|
||||
}; /* if */
|
||||
left -= len;
|
||||
msg += len;
|
||||
}; /* while */
|
||||
#endif
|
||||
} /* send_string */
|
||||
|
||||
/*
|
||||
* read_line -- read a \n terminated line from a socket
|
||||
*/
|
||||
static int
|
||||
read_line (int s, char *dest)
|
||||
{
|
||||
int length;
|
||||
int offset = 0;
|
||||
char buffer[GSERV_BUFSZ + 1];
|
||||
|
||||
while ((length = read (s, buffer + offset, 1) > 0) && buffer[offset] != '\n'
|
||||
&& buffer[offset] != EOT_CHR) {
|
||||
offset += length;
|
||||
if (offset >= GSERV_BUFSZ)
|
||||
break;
|
||||
}
|
||||
buffer[offset] = '\0';
|
||||
strcpy (dest, buffer);
|
||||
return 1;
|
||||
} /* read_line */
|
||||
#endif
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||
|
||||
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
/*
|
||||
* connect_to_unix_server -- establish connection with server process via a unix-
|
||||
* domain socket. Returns socket descriptor for server
|
||||
* if successful.
|
||||
*/
|
||||
static int
|
||||
connect_to_unix_server (void)
|
||||
{
|
||||
int s; /* connected socket descriptor */
|
||||
struct sockaddr_un server; /* for unix connections */
|
||||
|
||||
if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
server.sun_family = AF_UNIX;
|
||||
#ifdef HIDE_UNIX_SOCKET
|
||||
sprintf (server.sun_path, "/tmp/lgtddir%d/lgtd", (int) geteuid ());
|
||||
#else /* HIDE_UNIX_SOCKET */
|
||||
sprintf (server.sun_path, "/tmp/lgtd%d", (int) geteuid ());
|
||||
#endif /* HIDE_UNIX_SOCKET */
|
||||
if (connect (s, (struct sockaddr *)&server, strlen (server.sun_path) + 2) < 0)
|
||||
glibtop_error_io ("unable to connect to local");
|
||||
|
||||
return (s);
|
||||
|
||||
} /* connect_to_unix_server */
|
||||
#endif /* UNIX_DOMAIN_SOCKETS */
|
||||
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
/*
|
||||
* internet_addr -- return the internet addr of the hostname or
|
||||
* internet address passed. Return -1 on error.
|
||||
*/
|
||||
long
|
||||
glibtop_internet_addr (const char *host)
|
||||
{
|
||||
struct hostent *hp; /* pointer to host info for remote host */
|
||||
IN_ADDR numeric_addr; /* host address */
|
||||
|
||||
numeric_addr = inet_addr (host);
|
||||
if (!NUMERIC_ADDR_ERROR)
|
||||
return numeric_addr;
|
||||
else if ((hp = gethostbyname (host)) != NULL)
|
||||
return ((struct in_addr *) (hp->h_addr))->s_addr;
|
||||
else {
|
||||
glibtop_warn_io ("gethostbyname (%s)", host);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} /* glibtop_internet_addr */
|
||||
|
||||
#ifdef AUTH_MAGIC_COOKIE
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xauth.h>
|
||||
|
||||
static Xauth *server_xauth = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* connect_to_internet_server -- establish connection with server process via
|
||||
* an internet domain socket. Returns socket
|
||||
* descriptor for server if successful.
|
||||
*/
|
||||
static int
|
||||
connect_to_internet_server (const char *serverhost, u_short port)
|
||||
{
|
||||
int s; /* connected socket descriptor */
|
||||
struct servent *sp; /* pointer to service information */
|
||||
struct sockaddr_in peeraddr_in; /* for peer socket address */
|
||||
char buf[512]; /* temporary buffer */
|
||||
|
||||
/* clear out address structures */
|
||||
memset (&peeraddr_in, 0, sizeof (struct sockaddr_in));
|
||||
|
||||
/* Set up the peer address to which we will connect. */
|
||||
peeraddr_in.sin_family = AF_INET;
|
||||
|
||||
/* look up the server host's internet address */
|
||||
peeraddr_in.sin_addr.s_addr = glibtop_internet_addr (serverhost);
|
||||
if ((long) peeraddr_in.sin_addr.s_addr == -1)
|
||||
glibtop_error ("unable to find %s in /etc/hosts or from YP", serverhost);
|
||||
|
||||
if (port == 0) {
|
||||
if ((sp = getservbyname ("gtopd", "tcp")) == NULL)
|
||||
peeraddr_in.sin_port = htons (DEFAULT_PORT + getuid ());
|
||||
else
|
||||
peeraddr_in.sin_port = sp->s_port;
|
||||
}
|
||||
/* if */
|
||||
else
|
||||
peeraddr_in.sin_port = htons (port);
|
||||
|
||||
/* Create the socket. */
|
||||
if ((s = socket (AF_INET, SOCK_STREAM, 0)) == -1)
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
/* Try to connect to the remote server at the address * which was
|
||||
* just built into peeraddr. */
|
||||
if (connect (s, (struct sockaddr *) &peeraddr_in,
|
||||
sizeof (struct sockaddr_in)) == -1)
|
||||
glibtop_error_io ("unable to connect to remote");
|
||||
|
||||
#ifdef AUTH_MAGIC_COOKIE
|
||||
|
||||
/* send credentials using MIT-MAGIC-COOKIE-1 protocol */
|
||||
|
||||
sprintf (buf, "%d", port);
|
||||
|
||||
server_xauth =
|
||||
XauGetAuthByAddr (FamilyInternet,
|
||||
sizeof (peeraddr_in.sin_addr.s_addr),
|
||||
(char *) &peeraddr_in.sin_addr.s_addr,
|
||||
strlen (buf), buf,
|
||||
strlen (MCOOKIE_X_NAME), MCOOKIE_X_NAME);
|
||||
|
||||
if (server_xauth && server_xauth->data) {
|
||||
sprintf (buf, "%s\n%d\n", MCOOKIE_NAME, server_xauth->data_length);
|
||||
write (s, buf, strlen (buf));
|
||||
write (s, server_xauth->data, server_xauth->data_length);
|
||||
|
||||
return (s);
|
||||
}
|
||||
#endif /* AUTH_MAGIC_COOKIE */
|
||||
|
||||
sprintf (buf, "%s\n", DEFAUTH_NAME);
|
||||
write (s, buf, strlen (buf));
|
||||
|
||||
return (s);
|
||||
|
||||
} /* connect_to_internet_server */
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
|
||||
/*
|
||||
* disconnect_from_server -- inform the server that sending has finished, and wait for
|
||||
* its reply.
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
disconnect_from_server (s, echo)
|
||||
int s;
|
||||
int echo;
|
||||
{
|
||||
#if 0
|
||||
char buffer[REPLYSIZ + 1];
|
||||
|
||||
#else
|
||||
char buffer[GSERV_BUFSZ + 1];
|
||||
|
||||
#endif
|
||||
int add_newline = 1;
|
||||
int length;
|
||||
|
||||
send_string (s, EOT_STR); /* make sure server gets string */
|
||||
|
||||
#if !defined (linux) && !defined (_SCO_DS)
|
||||
/*
|
||||
* shutdown is completely hozed under linux. If s is a unix domain socket,
|
||||
* you'll get EOPNOTSUPP back from it. If s is an internet socket, you get
|
||||
* a broken pipe when you try to read a bit later. The latter
|
||||
* problem is fixed for linux versions >= 1.1.46, but the problem
|
||||
* with unix sockets persists. Sigh.
|
||||
*/
|
||||
|
||||
if (shutdown (s, 1) == -1) {
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to shutdown socket\n", progname);
|
||||
exit (1);
|
||||
}; /* if */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
while ((length = recv (s, buffer, REPLYSIZ, 0)) > 0) {
|
||||
buffer[length] = '\0';
|
||||
if (echo)
|
||||
fputs (buffer, stdout);
|
||||
add_newline = (buffer[length - 1] != '\n');
|
||||
}; /* while */
|
||||
#else
|
||||
while ((length = read (s, buffer, GSERV_BUFSZ)) > 0 ||
|
||||
(length == -1 && errno == EINTR)) {
|
||||
if (length) {
|
||||
buffer[length] = '\0';
|
||||
if (echo) {
|
||||
fputs (buffer, stdout);
|
||||
add_newline = (buffer[length - 1] != '\n');
|
||||
}; /* if */
|
||||
}; /* if */
|
||||
}; /* while */
|
||||
#endif
|
||||
|
||||
if (echo && add_newline)
|
||||
putchar ('\n');
|
||||
|
||||
if (length < 0) {
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to read the reply from the server\n", progname);
|
||||
exit (1);
|
||||
}; /* if */
|
||||
|
||||
} /* disconnect_from_server */
|
||||
#endif
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||
623
sysdeps/common/mountlist.c
Normal file
623
sysdeps/common/mountlist.c
Normal file
@@ -0,0 +1,623 @@
|
||||
/* mountlist.c -- return a list of mounted filesystems
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This program 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/mountlist.h>
|
||||
|
||||
/* A mount table entry. */
|
||||
struct mount_entry
|
||||
{
|
||||
char *me_devname; /* Device node pathname, including "/dev/". */
|
||||
char *me_mountdir; /* Mount point directory pathname. */
|
||||
char *me_type; /* "nfs", "4.2", etc. */
|
||||
dev_t me_dev; /* Device number of me_mountdir. */
|
||||
struct mount_entry *me_next;
|
||||
};
|
||||
|
||||
|
||||
static struct mount_entry *read_filesystem_list (void);
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined (MOUNTED_GETFSSTAT) /* __alpha running OSF_1 */
|
||||
# include <sys/mount.h>
|
||||
# include <sys/fs_types.h>
|
||||
#endif /* MOUNTED_GETFSSTAT */
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
#include <mntent.h>
|
||||
#if !defined(MOUNTED)
|
||||
# if defined(MNT_MNTTAB) /* HP-UX. */
|
||||
# define MOUNTED MNT_MNTTAB
|
||||
# endif
|
||||
# if defined(MNTTABNAME) /* Dynix. */
|
||||
# define MOUNTED MNTTABNAME
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fs_types.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_FREAD /* SVR2. */
|
||||
#include <mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
|
||||
#include <mnttab.h>
|
||||
#include <sys/fstyp.h>
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||
#include <sys/mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
#include <fshelp.h>
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef DOLPHIN
|
||||
/* So special that it's not worth putting this in autoconf. */
|
||||
#undef MOUNTED_FREAD_FSTYP
|
||||
#define MOUNTED_GETMNTTBL
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) && !defined (__OpenBSD__) && !defined(__FreeBSD__)
|
||||
static const char *
|
||||
fstype_to_string (short t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
#ifdef MOUNT_PC
|
||||
case MOUNT_PC:
|
||||
return "pc";
|
||||
#endif
|
||||
#ifdef MOUNT_MFS
|
||||
case MOUNT_MFS:
|
||||
return "mfs";
|
||||
#endif
|
||||
#ifdef MOUNT_LO
|
||||
case MOUNT_LO:
|
||||
return "lo";
|
||||
#endif
|
||||
#ifdef MOUNT_TFS
|
||||
case MOUNT_TFS:
|
||||
return "tfs";
|
||||
#endif
|
||||
#ifdef MOUNT_TMP
|
||||
case MOUNT_TMP:
|
||||
return "tmp";
|
||||
#endif
|
||||
#ifdef MOUNT_UFS
|
||||
case MOUNT_UFS:
|
||||
return "ufs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NFS
|
||||
case MOUNT_NFS:
|
||||
return "nfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_MSDOS
|
||||
case MOUNT_MSDOS:
|
||||
return "msdos" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LFS
|
||||
case MOUNT_LFS:
|
||||
return "lfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LOFS
|
||||
case MOUNT_LOFS:
|
||||
return "lofs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_FDESC
|
||||
case MOUNT_FDESC:
|
||||
return "fdesc" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PORTAL
|
||||
case MOUNT_PORTAL:
|
||||
return "portal" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NULL
|
||||
case MOUNT_NULL:
|
||||
return "null" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UMAP
|
||||
case MOUNT_UMAP:
|
||||
return "umap" ;
|
||||
#endif
|
||||
#ifdef MOUNT_KERNFS
|
||||
case MOUNT_KERNFS:
|
||||
return "kernfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PROCFS
|
||||
case MOUNT_PROCFS:
|
||||
return "procfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_AFS
|
||||
case MOUNT_AFS:
|
||||
return "afs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_CD9660
|
||||
case MOUNT_CD9660:
|
||||
return "cd9660" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UNION
|
||||
case MOUNT_UNION:
|
||||
return "union" ;
|
||||
#endif
|
||||
#ifdef MOUNT_DEVFS
|
||||
case MOUNT_DEVFS:
|
||||
return "devfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_EXT2FS
|
||||
case MOUNT_EXT2FS:
|
||||
return "ext2fs" ;
|
||||
#endif
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO */
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
static const char *
|
||||
fstype_to_string (int t)
|
||||
{
|
||||
struct vfs_ent *e;
|
||||
|
||||
e = getvfsbytype (t);
|
||||
if (!e || !e->vfsent_name)
|
||||
return "none";
|
||||
else
|
||||
return e->vfsent_name;
|
||||
}
|
||||
#endif /* MOUNTED_VMOUNT */
|
||||
|
||||
/* Return a list of the currently mounted filesystems, or NULL on error.
|
||||
Add each entry to the tail of the list so that they stay in order.
|
||||
*/
|
||||
|
||||
static struct mount_entry *
|
||||
read_filesystem_list (void)
|
||||
{
|
||||
struct mount_entry *mount_list;
|
||||
struct mount_entry *me;
|
||||
struct mount_entry *mtail;
|
||||
|
||||
/* Start the list off with a dummy entry. */
|
||||
me = g_new (struct mount_entry, 1);
|
||||
me->me_next = NULL;
|
||||
mount_list = mtail = me;
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
{
|
||||
struct tabmntent *mntlist, *p;
|
||||
struct mntent *mnt;
|
||||
struct mount_entry *me;
|
||||
|
||||
/* the third and fourth arguments could be used to filter mounts,
|
||||
but Crays doesn't seem to have any mounts that we want to
|
||||
remove. Specifically, automount create normal NFS mounts.
|
||||
*/
|
||||
|
||||
if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0)
|
||||
return NULL;
|
||||
p = mntlist;
|
||||
while(p){
|
||||
mnt = p->ment;
|
||||
me = (struct mount_entry*) g_malloc(sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup(mnt->mnt_fsname);
|
||||
me->me_mountdir = g_strdup(mnt->mnt_dir);
|
||||
me->me_type = g_strdup(mnt->mnt_type);
|
||||
me->me_dev = -1;
|
||||
me->me_next = NULL;
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
p = p->next;
|
||||
}
|
||||
freemntlist(mntlist);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
{
|
||||
const struct mntent *mnt;
|
||||
FILE *fp;
|
||||
const char *devopt;
|
||||
|
||||
fp = setmntent (MOUNTED, "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((mnt = getmntent (fp)))
|
||||
{
|
||||
me = g_new(struct mount_entry, 1);
|
||||
me->me_devname = g_strdup (mnt->mnt_fsname);
|
||||
me->me_mountdir = g_strdup (mnt->mnt_dir);
|
||||
me->me_type = g_strdup (mnt->mnt_type);
|
||||
devopt = strstr (mnt->mnt_opts, "dev=");
|
||||
if (devopt)
|
||||
me->me_dev = (dev_t) strtoull( devopt + 4, NULL, 0);
|
||||
else
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
|
||||
if (endmntent (fp) == 0)
|
||||
return NULL;
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1. */
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||
{
|
||||
struct statfs *fsp;
|
||||
int entries;
|
||||
|
||||
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
||||
if (entries < 0)
|
||||
return NULL;
|
||||
while (entries-- > 0)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = g_strdup (fsp->f_mntonname);
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
me->me_type = g_strdup (fsp->f_fstypename);
|
||||
#else
|
||||
me->me_type = g_strdup (fstype_to_string (fsp->f_type));
|
||||
#endif
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
fsp++;
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO */
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
{
|
||||
int offset = 0;
|
||||
int val;
|
||||
struct fs_data fsd;
|
||||
|
||||
while ((val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
||||
(char *) 0)) > 0)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup (fsd.fd_req.devname);
|
||||
me->me_mountdir = g_strdup (fsd.fd_req.path);
|
||||
me->me_type = g_strdup (gt_names[fsd.fd_req.fstype]);
|
||||
me->me_dev = fsd.fd_req.dev;
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
if (val < 0)
|
||||
return NULL;
|
||||
}
|
||||
#endif /* MOUNTED_GETMNT. */
|
||||
|
||||
#if defined (MOUNTED_GETFSSTAT) /* __alpha running OSF_1 */
|
||||
{
|
||||
int numsys, counter, bufsize;
|
||||
struct statfs *stats;
|
||||
|
||||
numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
|
||||
if (numsys < 0)
|
||||
return (NULL);
|
||||
|
||||
bufsize = (1 + numsys) * sizeof (struct statfs);
|
||||
stats = (struct statfs *) g_malloc (bufsize);
|
||||
numsys = getfsstat (stats, bufsize, MNT_WAIT);
|
||||
|
||||
if (numsys < 0)
|
||||
{
|
||||
g_free (stats);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (counter = 0; counter < numsys; counter++)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup (stats[counter].f_mntfromname);
|
||||
me->me_mountdir = g_strdup (stats[counter].f_mntonname);
|
||||
me->me_type = g_strdup (mnt_names[stats[counter].f_type]);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
|
||||
g_free (stats);
|
||||
}
|
||||
#endif /* MOUNTED_GETFSSTAT */
|
||||
|
||||
#if defined (MOUNTED_FREAD) || defined (MOUNTED_FREAD_FSTYP) /* SVR[23]. */
|
||||
{
|
||||
struct mnttab mnt;
|
||||
FILE *fp;
|
||||
fp = fopen ("/etc/mnttab", "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
me->me_devname = g_strdup (mnt.mt_dev);
|
||||
#else
|
||||
me->me_devname = g_strdup_printf("/dev/%s", mnt.mt_dev);
|
||||
#endif
|
||||
me->me_mountdir = g_strdup (mnt.mt_filsys);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
{
|
||||
struct statfs fsd;
|
||||
char typebuf[FSTYPSZ];
|
||||
|
||||
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
||||
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
||||
me->me_type = g_strdup (typebuf);
|
||||
}
|
||||
#else
|
||||
me->me_type = g_strdup ("");
|
||||
#endif
|
||||
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
|
||||
if (fclose (fp) == EOF)
|
||||
return NULL;
|
||||
}
|
||||
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
|
||||
|
||||
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes it's own way */
|
||||
{
|
||||
struct mntent **mnttbl=getmnttbl(),**ent;
|
||||
for (ent=mnttbl;*ent;ent++)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup ( (*ent)->mt_resource);
|
||||
me->me_mountdir = g_strdup( (*ent)->mt_directory);
|
||||
me->me_type = g_strdup ((*ent)->mt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
endmnttbl();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||
{
|
||||
struct mnttab mnt;
|
||||
FILE *fp;
|
||||
int ret;
|
||||
|
||||
fp = fopen (MNTTAB, "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||
{
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = g_strdup (mnt.mnt_special);
|
||||
me->me_mountdir = g_strdup (mnt.mnt_mountp);
|
||||
me->me_type = g_strdup (mnt.mnt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
|
||||
if (fclose (fp) == EOF)
|
||||
return NULL;
|
||||
if (ret > 0)
|
||||
return NULL;
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT2. */
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
{
|
||||
int bufsize;
|
||||
char *entries, *thisent;
|
||||
struct vmount *vmp;
|
||||
|
||||
/* Ask how many bytes to allocate for the mounted filesystem info. */
|
||||
mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize);
|
||||
entries = g_malloc (bufsize);
|
||||
|
||||
/* Get the list of mounted filesystems. */
|
||||
mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
|
||||
|
||||
for (thisent = entries; thisent < entries + bufsize;
|
||||
thisent += vmp->vmt_length)
|
||||
{
|
||||
vmp = (struct vmount *) thisent;
|
||||
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
|
||||
if (vmp->vmt_flags & MNT_REMOTE)
|
||||
{
|
||||
/* Prepend the remote pathname. */
|
||||
me->me_devname = \
|
||||
g_strdup_printf("%s:%s",
|
||||
thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off
|
||||
thisent + vmp->vmt_data[VMT_OBJECT ].vmt_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
me->me_devname = g_strdup (thisent +
|
||||
vmp->vmt_data[VMT_OBJECT].vmt_off);
|
||||
}
|
||||
me->me_mountdir = g_strdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
|
||||
me->me_type = g_strdup (fstype_to_string (vmp->vmt_gfstype));
|
||||
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
g_free (entries);
|
||||
}
|
||||
#endif /* MOUNTED_VMOUNT. */
|
||||
|
||||
/* Free the dummy head. */
|
||||
me = mount_list;
|
||||
mount_list = mount_list->me_next;
|
||||
g_free (me);
|
||||
return mount_list;
|
||||
}
|
||||
|
||||
|
||||
static gboolean ignore_mount_entry(const struct mount_entry *me)
|
||||
{
|
||||
/* keep sorted */
|
||||
static const char ignored[][12] = {
|
||||
"autofs",
|
||||
"binfmt_misc",
|
||||
"ctfs",
|
||||
"devfs",
|
||||
"devpts",
|
||||
"fusectl",
|
||||
"linprocfs",
|
||||
"mfs",
|
||||
"mntfs",
|
||||
"mqueue",
|
||||
"none",
|
||||
"nsfd",
|
||||
"objfs",
|
||||
"openpromfs",
|
||||
"proc",
|
||||
"procfs",
|
||||
"rpc_pipefs",
|
||||
"securityfs",
|
||||
"supermount",
|
||||
"sysfs",
|
||||
"tmpfs",
|
||||
"unknown",
|
||||
"usbdevfs",
|
||||
"usbfs"
|
||||
};
|
||||
|
||||
typedef int (*Comparator)(const void*, const void*);
|
||||
|
||||
return bsearch(me->me_type,
|
||||
ignored, G_N_ELEMENTS(ignored), sizeof ignored[0],
|
||||
(Comparator) strcmp) != NULL;
|
||||
}
|
||||
|
||||
|
||||
glibtop_mountentry *
|
||||
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
|
||||
{
|
||||
struct mount_entry *entries, *cur, *next;
|
||||
|
||||
GArray *mount_array = g_array_new(FALSE, FALSE,
|
||||
sizeof(glibtop_mountentry));
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mountlist));
|
||||
|
||||
/* Read filesystem list. */
|
||||
|
||||
if((entries = read_filesystem_list ()) == NULL)
|
||||
return NULL;
|
||||
|
||||
for (cur = &entries[0]; cur != NULL; cur = next) {
|
||||
|
||||
if(all_fs || !ignore_mount_entry(cur)) {
|
||||
/* add a new glibtop_mountentry */
|
||||
glibtop_mountentry e;
|
||||
|
||||
g_strlcpy(e.devname, cur->me_devname, sizeof e.devname);
|
||||
g_strlcpy(e.mountdir, cur->me_mountdir, sizeof e.mountdir);
|
||||
g_strlcpy(e.type, cur->me_type, sizeof e.type);
|
||||
e.dev = cur->me_dev;
|
||||
|
||||
g_array_append_val(mount_array, e);
|
||||
}
|
||||
|
||||
/* free current mount_entry and move to the next */
|
||||
next = cur->me_next;
|
||||
g_free(cur->me_devname);
|
||||
g_free(cur->me_mountdir);
|
||||
g_free(cur->me_type);
|
||||
g_free(cur);
|
||||
}
|
||||
|
||||
buf->size = sizeof (glibtop_mountentry);
|
||||
buf->number = mount_array->len;
|
||||
buf->total = buf->number * buf->size;
|
||||
|
||||
buf->flags = (1 << GLIBTOP_MOUNTLIST_SIZE)
|
||||
| (1 << GLIBTOP_MOUNTLIST_NUMBER)
|
||||
| (1 << GLIBTOP_MOUNTLIST_TOTAL);
|
||||
|
||||
return (glibtop_mountentry*) g_array_free(mount_array, FALSE);
|
||||
}
|
||||
44
sysdeps/common/procargs.c
Normal file
44
sysdeps/common/procargs.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <config.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
Splitting args0
|
||||
* args0 [......0.. ....0.........0]
|
||||
* Returned value must be free with g_strfreev
|
||||
* args0 is g_free()d
|
||||
*/
|
||||
static char **
|
||||
split_args0(const char * const args0, size_t size)
|
||||
{
|
||||
GPtrArray *argv = g_ptr_array_new();
|
||||
const char *arg;
|
||||
|
||||
/* remember that if there were no args, args0 == NULL and size == 0 */
|
||||
for (arg = args0; arg < (args0 + size); arg += strlen(arg) + 1) {
|
||||
g_ptr_array_add(argv, g_strdup(arg));
|
||||
}
|
||||
|
||||
g_ptr_array_add(argv, NULL);
|
||||
|
||||
g_free((void* /* remove constness */) args0);
|
||||
|
||||
return (char**) g_ptr_array_free(argv, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* public functions
|
||||
*/
|
||||
|
||||
char **
|
||||
glibtop_get_proc_argv_l (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
const char * const args0 = glibtop_get_proc_args_l(server, buf, pid, max_len);
|
||||
return split_args0(args0, buf->size);
|
||||
}
|
||||
98
sysdeps/common/sysdeps_suid.c
Normal file
98
sysdeps/common/sysdeps_suid.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/union.h>
|
||||
#include <glibtop/sysdeps.h>
|
||||
#include <glibtop/init_hooks.h>
|
||||
|
||||
const _glibtop_init_func_t _glibtop_init_hook_p [] = {
|
||||
#if GLIBTOP_SUID_CPU
|
||||
_glibtop_init_cpu_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_MEM
|
||||
_glibtop_init_mem_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_SWAP
|
||||
_glibtop_init_swap_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_UPTIME
|
||||
_glibtop_init_uptime_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_LOADAVG
|
||||
_glibtop_init_loadavg_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_SHM_LIMITS
|
||||
_glibtop_init_shm_limits_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_MSG_LIMITS
|
||||
_glibtop_init_msg_limits_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_SEM_LIMITS
|
||||
_glibtop_init_sem_limits_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROCLIST
|
||||
_glibtop_init_proclist_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_STATE
|
||||
_glibtop_init_proc_state_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_UID
|
||||
_glibtop_init_proc_uid_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_MEM
|
||||
_glibtop_init_proc_mem_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_TIME
|
||||
_glibtop_init_proc_time_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_SIGNAL
|
||||
_glibtop_init_proc_signal_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_KERNEL
|
||||
_glibtop_init_proc_kernel_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||
_glibtop_init_proc_segment_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
_glibtop_init_proc_args_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_MAP
|
||||
_glibtop_init_proc_map_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_NETLOAD
|
||||
_glibtop_init_netload_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_NETLIST
|
||||
_glibtop_init_netlist_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PPP
|
||||
_glibtop_init_ppp_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_IO
|
||||
_glibtop_init_proc_io_p,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
18
sysdeps/cygwin/Makefile.am
Normal file
18
sysdeps/cygwin/Makefile.am
Normal file
@@ -0,0 +1,18 @@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la
|
||||
|
||||
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c mountlist.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c siglist.c \
|
||||
sysinfo.c netload.c ppp.c glibtop_private.c \
|
||||
netlist.c procaffinity.c procopenfiles.c procwd.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
|
||||
noinst_HEADERS = glibtop_private.h
|
||||
762
sysdeps/cygwin/Makefile.in
Normal file
762
sysdeps/cygwin/Makefile.in
Normal file
@@ -0,0 +1,762 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = sysdeps/cygwin
|
||||
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 \
|
||||
$(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 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/libgtop-sysdeps.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(libgtopinclude_HEADERS) \
|
||||
$(noinst_HEADERS) $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
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 mountlist.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 netlist.lo \
|
||||
procaffinity.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@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES)
|
||||
DIST_SOURCES = $(libgtop_sysdeps_2_0_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libgtopincludedir)"
|
||||
HEADERS = $(libgtopinclude_HEADERS) $(noinst_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__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
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB = @DL_LIB@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GTKDOC_CHECK = @GTKDOC_CHECK@
|
||||
GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
|
||||
GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
|
||||
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
|
||||
GTKDOC_MKPDF = @GTKDOC_MKPDF@
|
||||
GTKDOC_REBASE = @GTKDOC_REBASE@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
|
||||
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
|
||||
INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
|
||||
INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
|
||||
INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
|
||||
INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
|
||||
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
|
||||
INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
|
||||
KVM_LIBS = @KVM_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGTOP_BINDIR = @LIBGTOP_BINDIR@
|
||||
LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
|
||||
LIBGTOP_INCS = @LIBGTOP_INCS@
|
||||
LIBGTOP_LIBS = @LIBGTOP_LIBS@
|
||||
LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
|
||||
LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
|
||||
LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
|
||||
LIBGTOP_SERVER = @LIBGTOP_SERVER@
|
||||
LIBGTOP_SERVER_VERSION = @LIBGTOP_SERVER_VERSION@
|
||||
LIBGTOP_VERSION = @LIBGTOP_VERSION@
|
||||
LIBGTOP_VERSION_CODE = @LIBGTOP_VERSION_CODE@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
LT_VERSION_INFO = @LT_VERSION_INFO@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libgtop_have_sysinfo = @libgtop_have_sysinfo@
|
||||
libgtop_need_server = @libgtop_need_server@
|
||||
libgtop_postinstall = @libgtop_postinstall@
|
||||
libgtop_sysdeps_dir = @libgtop_sysdeps_dir@
|
||||
libgtop_top_builddir = @libgtop_top_builddir@
|
||||
libs_xauth = @libs_xauth@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
server_programs = @server_programs@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysdeps_dir = @sysdeps_dir@
|
||||
sysdeps_suid_lib = @sysdeps_suid_lib@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la
|
||||
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c mountlist.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procargs.c procmap.c siglist.c \
|
||||
sysinfo.c netload.c ppp.c glibtop_private.c \
|
||||
netlist.c procaffinity.c procopenfiles.c procwd.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
noinst_HEADERS = glibtop_private.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/cygwin/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/cygwin/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libgtop_sysdeps-2.0.la: $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_DEPENDENCIES) $(EXTRA_libgtop_sysdeps_2_0_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libgtop_sysdeps_2_0_la_OBJECTS) $(libgtop_sysdeps_2_0_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glibtop_private.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadavg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mountlist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netload.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procaffinity.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procargs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prockernel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proclist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procmem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procopenfiles.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsegment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procsignal.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procstate.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proctime.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procuid.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procwd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shm_limits.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/siglist.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysinfo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-libgtopincludeHEADERS: $(libgtopinclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libgtopincludedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgtopincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libgtopincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-libgtopincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(libgtopinclude_HEADERS)'; test -n "$(libgtopincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(libgtopincludedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libgtopincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-libgtopincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libgtopincludeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-libgtopincludeHEADERS install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-libgtopincludeHEADERS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
29
sysdeps/cygwin/close.c
Normal file
29
sysdeps/cygwin/close.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
||||
103
sysdeps/cygwin/cpu.c
Normal file
103
sysdeps/cygwin/cpu.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/cpu.h>
|
||||
|
||||
#include "glibtop_private.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
|
||||
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
|
||||
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu_smp =
|
||||
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
|
||||
(1L << GLIBTOP_XCPU_NICE) + (1L << GLIBTOP_XCPU_SYS) +
|
||||
(1L << GLIBTOP_XCPU_IDLE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_cpu_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
|
||||
if (server->ncpu)
|
||||
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_smp;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
#define FILENAME "/proc/stat"
|
||||
|
||||
void
|
||||
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
char buffer [BUFSIZ], *p;
|
||||
int i;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
|
||||
|
||||
/*
|
||||
* GLOBAL
|
||||
*/
|
||||
|
||||
p = skip_token (buffer); /* "cpu" */
|
||||
|
||||
buf->user = strtoull (p, &p, 0);
|
||||
buf->nice = strtoull (p, &p, 0);
|
||||
buf->sys = strtoull (p, &p, 0);
|
||||
buf->idle = strtoull (p, &p, 0);
|
||||
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
|
||||
|
||||
buf->frequency = 100;
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
|
||||
/*
|
||||
* PER CPU
|
||||
*/
|
||||
|
||||
for (i = 0; i <= server->ncpu; i++) {
|
||||
|
||||
p = skip_line(p); /* move to ^ */
|
||||
|
||||
if (!check_cpu_line_warn(server, p, i))
|
||||
break;
|
||||
|
||||
p = skip_token(p); /* "cpuN" */
|
||||
|
||||
buf->xcpu_user [i] = strtoull (p, &p, 0);
|
||||
buf->xcpu_nice [i] = strtoull (p, &p, 0);
|
||||
buf->xcpu_sys [i] = strtoull (p, &p, 0);
|
||||
buf->xcpu_idle [i] = strtoull (p, &p, 0);
|
||||
buf->xcpu_total[i] = buf->xcpu_user [i] \
|
||||
+ buf->xcpu_nice [i] \
|
||||
+ buf->xcpu_sys [i] \
|
||||
+ buf->xcpu_idle [i];
|
||||
}
|
||||
|
||||
if(server->ncpu) /* ok, that's a real SMP */
|
||||
buf->flags |= _glibtop_sysdeps_cpu_smp;
|
||||
}
|
||||
42
sysdeps/cygwin/glibtop_machine.h
Normal file
42
sysdeps/cygwin/glibtop_machine.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
pid_t last_pid;
|
||||
int no_update;
|
||||
int fd_stat, fd_meminfo, fd_loadavg;
|
||||
char proc_stat [BUFSIZ], proc_statm [BUFSIZ];
|
||||
char proc_status [BUFSIZ];
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
221
sysdeps/cygwin/glibtop_private.c
Normal file
221
sysdeps/cygwin/glibtop_private.c
Normal file
@@ -0,0 +1,221 @@
|
||||
#include <config.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "glibtop_private.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
unsigned long long
|
||||
get_scaled(const char *buffer, const char *key)
|
||||
{
|
||||
const char *ptr = buffer;
|
||||
char *next;
|
||||
unsigned long long value;
|
||||
|
||||
if (key) {
|
||||
if (G_LIKELY((ptr = strstr(buffer, key))))
|
||||
ptr += strlen(key);
|
||||
else {
|
||||
g_warning("Could not read key '%s' in buffer '%s'",
|
||||
key, buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
value = strtoull(ptr, &next, 0);
|
||||
|
||||
for ( ; *next; ++next) {
|
||||
if (*next == 'k') {
|
||||
value *= 1024;
|
||||
break;
|
||||
} else if (*next == 'M') {
|
||||
value *= 1024 * 1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
skip_token (const char *p)
|
||||
{
|
||||
p = next_token(p);
|
||||
while (*p && !isspace(*p)) p++;
|
||||
p = next_token(p);
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read functions
|
||||
*/
|
||||
enum TRY_FILE_TO_BUFFER
|
||||
{
|
||||
TRY_FILE_TO_BUFFER_OK = 0,
|
||||
TRY_FILE_TO_BUFFER_OPEN = -1,
|
||||
TRY_FILE_TO_BUFFER_READ = -2
|
||||
};
|
||||
|
||||
/*
|
||||
* Doesn't handle bufsiz == 0
|
||||
*/
|
||||
int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
||||
{
|
||||
char path[4096];
|
||||
int fd;
|
||||
size_t len = 0;
|
||||
ssize_t nread = 0;
|
||||
va_list pa;
|
||||
|
||||
if (G_UNLIKELY(bufsiz <= sizeof(char*)))
|
||||
g_warning("Huhu, bufsiz of %lu looks bad", (gulong)bufsiz);
|
||||
|
||||
va_start(pa, format);
|
||||
|
||||
/* C99 also provides vsnprintf */
|
||||
g_vsnprintf(path, sizeof path, format, pa);
|
||||
|
||||
va_end(pa);
|
||||
|
||||
bufsiz--; /* reserve 1 for trailing NUL */
|
||||
buffer [0] = '\0';
|
||||
|
||||
if((fd = open (path, O_RDONLY)) < 0)
|
||||
return TRY_FILE_TO_BUFFER_OPEN;
|
||||
|
||||
while (len < bufsiz) {
|
||||
nread = read (fd, buffer + len, bufsiz - len);
|
||||
|
||||
if (G_UNLIKELY(nread < 0)) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
len += nread;
|
||||
|
||||
if (nread == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
if (nread < 0)
|
||||
return TRY_FILE_TO_BUFFER_READ;
|
||||
|
||||
buffer [len] = '\0';
|
||||
|
||||
return TRY_FILE_TO_BUFFER_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filename)
|
||||
{
|
||||
switch(try_file_to_buffer(buffer, bufsiz, "%s", filename))
|
||||
{
|
||||
case TRY_FILE_TO_BUFFER_OPEN:
|
||||
glibtop_error_io_r (server, "open (%s)", filename);
|
||||
case TRY_FILE_TO_BUFFER_READ:
|
||||
glibtop_error_io_r (server, "read (%s)", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static unsigned long
|
||||
read_boot_time(glibtop *server)
|
||||
{
|
||||
char* line = NULL;
|
||||
size_t size = 0;
|
||||
FILE* stat;
|
||||
unsigned long btime = 0;
|
||||
|
||||
if (!(stat = fopen("/proc/stat", "r"))) {
|
||||
glibtop_error_io_r(server, "fopen(\"/proc/stat\")");
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (getline(&line, &size, stat) != -1) {
|
||||
if (!strncmp(line, "btime", 5)) {
|
||||
btime = strtoul(skip_token(line), NULL, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(line);
|
||||
fclose(stat);
|
||||
out:
|
||||
return btime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned long
|
||||
get_boot_time(glibtop *server)
|
||||
{
|
||||
static unsigned long boot_time = 0UL;
|
||||
|
||||
if(G_UNLIKELY(!boot_time))
|
||||
{
|
||||
boot_time = read_boot_time(server);
|
||||
}
|
||||
|
||||
return boot_time;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
get_page_size(void)
|
||||
{
|
||||
static size_t pagesize = 0;
|
||||
|
||||
if(G_UNLIKELY(!pagesize))
|
||||
{
|
||||
pagesize = getpagesize();
|
||||
}
|
||||
|
||||
return pagesize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
check_cpu_line(glibtop *server, const char *line, unsigned i)
|
||||
{
|
||||
char start[10];
|
||||
|
||||
g_snprintf(start, sizeof start, "cpu%u", i);
|
||||
|
||||
return g_str_has_prefix(line, start);
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = readlink(path, buf, bufsiz - 1);
|
||||
|
||||
if (ret == -1) {
|
||||
g_warning("Could not read link %s : %s", path, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buf[ret] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
152
sysdeps/cygwin/glibtop_private.h
Normal file
152
sysdeps/cygwin/glibtop_private.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/* Copyright (C) 2004 Benoît Dejean
|
||||
This file is part of LibGTop 2.0.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __CYGWIN__GLIBTOP_PRIVATE_H__
|
||||
#define __CYGWIN__GLIBTOP_PRIVATE_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
static inline char*
|
||||
next_token(const char *p)
|
||||
{
|
||||
while (isspace(*p)) p++;
|
||||
return (char*) p;
|
||||
}
|
||||
|
||||
char *
|
||||
skip_token (const char *p);
|
||||
|
||||
static inline char *
|
||||
skip_multiple_token (const char *p, size_t count)
|
||||
{
|
||||
while(count--)
|
||||
p = skip_token (p);
|
||||
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
|
||||
static inline char *
|
||||
skip_line (const char *p)
|
||||
{
|
||||
while (*p && *p != '\n') p++;
|
||||
return (char *) (*p ? p+1 : p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Smart strtoul which handles binary suffixes
|
||||
* e.g: get_scaled("Size: 32 kB", "Size:") == 32768
|
||||
* key can be NULL if there's not prefix to strip (or prefix size is known
|
||||
*/
|
||||
unsigned long long
|
||||
get_scaled(const char *buffer, const char *key);
|
||||
|
||||
|
||||
/* aborts on error */
|
||||
void
|
||||
file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filename);
|
||||
|
||||
/* return < 0 on error, otherwise 0 on success */
|
||||
int
|
||||
try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...) G_GNUC_PRINTF(3, 4);
|
||||
|
||||
|
||||
/* some inline functions that wrap proc path
|
||||
* as fast as macros :)
|
||||
*/
|
||||
|
||||
static inline int
|
||||
proc_file_to_buffer (char *buffer, size_t bufsiz, const char *fmt, pid_t pid)
|
||||
{
|
||||
return try_file_to_buffer(buffer, bufsiz, fmt, pid);
|
||||
}
|
||||
|
||||
static inline int
|
||||
proc_stat_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
|
||||
{
|
||||
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/stat", pid);
|
||||
}
|
||||
|
||||
static inline int
|
||||
proc_status_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
|
||||
{
|
||||
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/status", pid);
|
||||
}
|
||||
|
||||
static inline int
|
||||
proc_statm_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
|
||||
{
|
||||
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/statm", pid);
|
||||
}
|
||||
|
||||
|
||||
static inline char *
|
||||
proc_stat_after_cmd (char *p)
|
||||
{
|
||||
p = strrchr (p, ')');
|
||||
if (G_LIKELY(p))
|
||||
*p++ = '\0';
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
unsigned long
|
||||
get_boot_time(glibtop *server);
|
||||
|
||||
|
||||
size_t
|
||||
get_page_size(void);
|
||||
|
||||
|
||||
gboolean
|
||||
check_cpu_line(glibtop *server, const char *line, unsigned n);
|
||||
|
||||
|
||||
static inline gboolean
|
||||
check_cpu_line_warn(glibtop *server, const char *line, unsigned i)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
ret = check_cpu_line(server, line, i);
|
||||
|
||||
if (G_UNLIKELY(!ret))
|
||||
glibtop_warn_io_r(server,
|
||||
"'%s' does not start with 'cpu%u'",
|
||||
line, i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CYGWIN__GLIBTOP_PRIVATE_H__ */
|
||||
50
sysdeps/cygwin/glibtop_server.h
Normal file
50
sysdeps/cygwin/glibtop_server.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __CYGWIN__GLIBTOP_SERVER_H__
|
||||
#define __CYGWIN__GLIBTOP_SERVER_H__
|
||||
|
||||
#define GLIBTOP_SUID_CPU 0
|
||||
#define GLIBTOP_SUID_MEM 0
|
||||
#define GLIBTOP_SUID_SWAP 0
|
||||
#define GLIBTOP_SUID_UPTIME 0
|
||||
#define GLIBTOP_SUID_LOADAVG 0
|
||||
#define GLIBTOP_SUID_SHM_LIMITS 0
|
||||
#define GLIBTOP_SUID_MSG_LIMITS 0
|
||||
#define GLIBTOP_SUID_SEM_LIMITS 0
|
||||
#define GLIBTOP_SUID_PROCLIST 0
|
||||
#define GLIBTOP_SUID_PROC_STATE 0
|
||||
#define GLIBTOP_SUID_PROC_UID 0
|
||||
#define GLIBTOP_SUID_PROC_MEM 0
|
||||
#define GLIBTOP_SUID_PROC_TIME 0
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
||||
#define GLIBTOP_SUID_PROC_KERNEL 0
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
||||
#define GLIBTOP_SUID_PROC_ARGS 0
|
||||
#define GLIBTOP_SUID_PROC_MAP 0
|
||||
#define GLIBTOP_SUID_NETLOAD 0
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PROC_AFFINITY 0
|
||||
#define GLIBTOP_SUID_PROC_WD 0
|
||||
#define GLIBTOP_SUID_PPP 0
|
||||
#define GLIBTOP_SUID_PROC_FILE 0
|
||||
|
||||
#endif /* __CYGWIN__GLIBTOP_SERVER_H__ */
|
||||
81
sysdeps/cygwin/loadavg.c
Normal file
81
sysdeps/cygwin/loadavg.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/loadavg.h>
|
||||
|
||||
#include "glibtop_private.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1L << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg_tasks =
|
||||
(1L << GLIBTOP_LOADAVG_NR_RUNNING) +
|
||||
(1L << GLIBTOP_LOADAVG_NR_TASKS) +
|
||||
(1L << GLIBTOP_LOADAVG_LAST_PID);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_loadavg_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load load averange. */
|
||||
|
||||
#define FILENAME "/proc/loadavg"
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
char buffer [BUFSIZ], *p, *old;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
|
||||
|
||||
buf->loadavg [0] = g_ascii_strtod (buffer, &p);
|
||||
buf->loadavg [1] = g_ascii_strtod (p, &p);
|
||||
buf->loadavg [2] = g_ascii_strtod (p, &p);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
|
||||
p = next_token(p);
|
||||
|
||||
/* Older Linux versions don't have the nr_running/nr_tasks fields. */
|
||||
|
||||
old = p;
|
||||
while (*p) {
|
||||
if (*p == '/')
|
||||
break;
|
||||
if (!isdigit (*p))
|
||||
return;
|
||||
p++;
|
||||
}
|
||||
|
||||
buf->nr_running = strtoull (old, &p, 0); p++;
|
||||
buf->nr_tasks = strtoull (p, &p, 0);
|
||||
buf->last_pid = strtoull (p, &p, 0);
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_loadavg_tasks;
|
||||
}
|
||||
61
sysdeps/cygwin/mem.c
Normal file
61
sysdeps/cygwin/mem.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/mem.h>
|
||||
|
||||
#include "glibtop_private.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
|
||||
(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_SHARED) +
|
||||
(1L << GLIBTOP_MEM_USER);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
#define FILENAME "/proc/meminfo"
|
||||
|
||||
void
|
||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
char buffer [BUFSIZ];
|
||||
|
||||
memset(buf, 0, sizeof *buf);
|
||||
|
||||
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
|
||||
|
||||
buf->total = get_scaled(buffer, "MemTotal:");
|
||||
buf->free = get_scaled(buffer, "MemFree:");
|
||||
buf->used = buf->total - buf->free;
|
||||
buf->shared = 0;
|
||||
|
||||
buf->user = buf->total - buf->free;
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
}
|
||||
164
sysdeps/cygwin/mountlist.c
Normal file
164
sysdeps/cygwin/mountlist.c
Normal file
@@ -0,0 +1,164 @@
|
||||
/* mountlist.c -- return a list of mounted filesystems
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is a fork of sysdeps/common/mountlist.c.
|
||||
|
||||
This program 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
mode: C
|
||||
c-file-style: "gnu"
|
||||
End:
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/mountlist.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
|
||||
/* IgnoreList */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GHashTable *table;
|
||||
} IgnoreList;
|
||||
|
||||
|
||||
static IgnoreList*
|
||||
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);
|
||||
return ig;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ignore_list_delete(IgnoreList* ig)
|
||||
{
|
||||
if (ig) {
|
||||
g_hash_table_destroy(ig->table);
|
||||
g_free(ig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ignore_list_add(IgnoreList* ig, const char* fs)
|
||||
{
|
||||
g_hash_table_insert(ig->table, g_strdup(fs), GINT_TO_POINTER(1));
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
ignore_list_has(IgnoreList* ig, const char* fs)
|
||||
{
|
||||
gpointer data;
|
||||
data = g_hash_table_lookup(ig->table, fs);
|
||||
return data != NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ~IgnoreList */
|
||||
|
||||
|
||||
static gboolean
|
||||
ignore_fs(const char *fstype, IgnoreList** ig)
|
||||
{
|
||||
if (!*ig) {
|
||||
FILE* fs;
|
||||
char line[128];
|
||||
|
||||
*ig = ignore_list_new();
|
||||
|
||||
ignore_list_add(*ig, "none");
|
||||
|
||||
if ((fs = fopen("/proc/filesystems", "r")) != NULL) {
|
||||
while (fgets(line, sizeof line, fs)) {
|
||||
if (!strncmp(line, "nodev", 5)) {
|
||||
char *type;
|
||||
type = g_strstrip(line + 5);
|
||||
ignore_list_add(*ig, type);
|
||||
}
|
||||
}
|
||||
fclose(fs);
|
||||
}
|
||||
}
|
||||
|
||||
return ignore_list_has(*ig, fstype);
|
||||
}
|
||||
|
||||
|
||||
glibtop_mountentry *
|
||||
glibtop_get_mountlist_s(glibtop *server, glibtop_mountlist *buf, int all_fs)
|
||||
{
|
||||
const struct mntent *mnt;
|
||||
FILE *fp;
|
||||
GArray* entries;
|
||||
IgnoreList* ig = NULL;
|
||||
|
||||
memset(buf, 0, sizeof(glibtop_mountlist));
|
||||
|
||||
/* wild guess, preallocate 8 entries
|
||||
on a desktop, almost everyone has / and a tmpfs for udev
|
||||
if all_fs, there are also proc, sys, fuse, binfmt, etc */
|
||||
entries = g_array_sized_new(FALSE, FALSE, sizeof(glibtop_mountentry), 8);
|
||||
|
||||
if (!(fp = setmntent(MOUNTED, "r"))) {
|
||||
glibtop_warn_io_r(server, "Could not open %s", MOUNTED);
|
||||
goto out;
|
||||
}
|
||||
|
||||
while ((mnt = getmntent(fp)))
|
||||
{
|
||||
glibtop_mountentry *me;
|
||||
gsize len;
|
||||
|
||||
if (!all_fs && ignore_fs(mnt->mnt_type, &ig))
|
||||
continue;
|
||||
|
||||
len = entries->len;
|
||||
g_array_set_size(entries, len + 1);
|
||||
me = &g_array_index(entries, glibtop_mountentry, len);
|
||||
|
||||
g_strlcpy(me->devname, mnt->mnt_fsname, sizeof me->devname);
|
||||
g_strlcpy(me->mountdir, mnt->mnt_dir, sizeof me->mountdir);
|
||||
g_strlcpy(me->type, mnt->mnt_type, sizeof me->type);
|
||||
}
|
||||
|
||||
endmntent(fp);
|
||||
|
||||
|
||||
out:
|
||||
ignore_list_delete(ig);
|
||||
|
||||
buf->size = sizeof(glibtop_mountentry);
|
||||
buf->number = entries->len;
|
||||
buf->total = buf->number * buf->size;
|
||||
buf->flags = (1 << GLIBTOP_MOUNTLIST_SIZE)
|
||||
| (1 << GLIBTOP_MOUNTLIST_NUMBER)
|
||||
| (1 << GLIBTOP_MOUNTLIST_TOTAL);
|
||||
|
||||
return (glibtop_mountentry*) g_array_free(entries, FALSE);
|
||||
}
|
||||
59
sysdeps/cygwin/msg_limits.c
Normal file
59
sysdeps/cygwin/msg_limits.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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/msg_limits.h>
|
||||
|
||||
#define _KERNEL
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNB) +
|
||||
(1L << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGSSZ) +
|
||||
(1L << GLIBTOP_IPC_MSGTQL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_msg_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
struct msginfo msginfo;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
msgctl (0, IPC_INFO, (void*) &msginfo);
|
||||
|
||||
buf->msgmax = msginfo.msgmax;
|
||||
buf->msgmnb = msginfo.msgmnb;
|
||||
buf->msgmni = msginfo.msgmni;
|
||||
buf->msgssz = msginfo.msgssz;
|
||||
buf->msgtql = msginfo.msgtql;
|
||||
buf->flags = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
39
sysdeps/cygwin/netlist.c
Normal file
39
sysdeps/cygwin/netlist.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* This file is part of LibGTop 2.0.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/netlist.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netlist = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netlist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netlist = _glibtop_sysdeps_netlist;
|
||||
}
|
||||
|
||||
char**
|
||||
glibtop_get_netlist_s (glibtop *server, glibtop_netlist *buf)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_netlist));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
44
sysdeps/cygwin/netload.c
Normal file
44
sysdeps/cygwin/netload.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netload = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netload_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
}
|
||||
|
||||
/* Provides network statistics. */
|
||||
|
||||
void
|
||||
glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
}
|
||||
68
sysdeps/cygwin/open.c
Normal file
68
sysdeps/cygwin/open.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "glibtop_private.h"
|
||||
|
||||
/* ======================================================= */
|
||||
|
||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||
|
||||
#define FILENAME "/proc/stat"
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server, const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
char buffer [BUFSIZ], *p = buffer;
|
||||
|
||||
server->name = program_name;
|
||||
|
||||
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
|
||||
|
||||
p = skip_line(p); /* cpu */
|
||||
|
||||
for (server->real_ncpu = 0; /* nop */; server->real_ncpu++) {
|
||||
|
||||
if (!check_cpu_line(server, p, server->real_ncpu)) {
|
||||
server->real_ncpu--;
|
||||
break;
|
||||
}
|
||||
|
||||
p = skip_line(p);
|
||||
}
|
||||
|
||||
server->ncpu = MIN(GLIBTOP_NCPU - 1, server->real_ncpu);
|
||||
|
||||
if (server->real_ncpu != server->ncpu) {
|
||||
glibtop_warn_r(server,
|
||||
"This machine has %d CPUs, "
|
||||
"%d are being monitored.",
|
||||
server->real_ncpu + 1,
|
||||
server->ncpu + 1);
|
||||
}
|
||||
}
|
||||
43
sysdeps/cygwin/ppp.c
Normal file
43
sysdeps/cygwin/ppp.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/ppp.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_ppp = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_ppp_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
}
|
||||
|
||||
/* Provides PPP/ISDN information. */
|
||||
|
||||
void
|
||||
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
}
|
||||
39
sysdeps/cygwin/procaffinity.c
Normal file
39
sysdeps/cygwin/procaffinity.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* This file is part of LibGTop 2.0.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/procaffinity.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_affinity = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_affinity_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_affinity = _glibtop_sysdeps_proc_affinity;
|
||||
}
|
||||
|
||||
guint16*
|
||||
glibtop_get_proc_affinity_s (glibtop *server, glibtop_proc_affinity *buf, pid_t pid)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_affinity));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
70
sysdeps/cygwin/procargs.c
Normal file
70
sysdeps/cygwin/procargs.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
(1L << GLIBTOP_PROC_ARGS_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
char filename[48]; /* magiv */
|
||||
|
||||
char *args;
|
||||
gsize length;
|
||||
GError *error = NULL;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
sprintf (filename, "/proc/%d/cmdline", pid);
|
||||
|
||||
if(!g_file_get_contents(filename, &args, &length, &error)) {
|
||||
g_error_free(error);
|
||||
buf->size = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(max_len && max_len < length) {
|
||||
args = g_realloc(args, max_len);
|
||||
args[max_len - 1] = '\0';
|
||||
length = max_len;
|
||||
}
|
||||
|
||||
buf->size = length;
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return args;
|
||||
}
|
||||
43
sysdeps/cygwin/prockernel.c
Normal file
43
sysdeps/cygwin/prockernel.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
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.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_kernel_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user