New upstream version 2.38.0
This commit is contained in:
16
sysdeps/darwin/Makefile.am
Normal file
16
sysdeps/darwin/Makefile.am
Normal file
@@ -0,0 +1,16 @@
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ @LIBGTOP_INCS@
|
||||
|
||||
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_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 netload.c ppp.c netlist.c procopenfiles.c procwd.c
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
|
||||
noinst_HEADERS = glibtop_suid.h
|
||||
767
sysdeps/darwin/Makefile.in
Normal file
767
sysdeps/darwin/Makefile.in
Normal file
@@ -0,0 +1,767 @@
|
||||
# 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/darwin
|
||||
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_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_suid_2_0_la_LIBADD =
|
||||
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 netload.lo \
|
||||
ppp.lo netlist.lo procopenfiles.lo procwd.lo
|
||||
libgtop_sysdeps_suid_2_0_la_OBJECTS = \
|
||||
$(am_libgtop_sysdeps_suid_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_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) $(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@ @LIBGTOP_INCS@
|
||||
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_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 netload.c ppp.c netlist.c procopenfiles.c procwd.c
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
||||
noinst_HEADERS = glibtop_suid.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/darwin/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu sysdeps/darwin/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)
|
||||
|
||||
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)$(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)/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:
|
||||
27
sysdeps/darwin/close.c
Normal file
27
sysdeps/darwin/close.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
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/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_p (glibtop *server)
|
||||
{ }
|
||||
91
sysdeps/darwin/cpu.c
Normal file
91
sysdeps/darwin/cpu.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/vm_map.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) +
|
||||
(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_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
processor_cpu_load_info_data_t *pinfo;
|
||||
mach_msg_type_number_t info_count;
|
||||
natural_t processor_count;
|
||||
int i;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
if (host_processor_info (mach_host_self (),
|
||||
PROCESSOR_CPU_LOAD_INFO,
|
||||
&processor_count,
|
||||
(processor_info_array_t*)&pinfo,
|
||||
&info_count)) {
|
||||
glibtop_warn_io_r (server, "host_processor_info (cpu)");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < server->ncpu; i++) {
|
||||
buf->xcpu_user [i] = pinfo[i].cpu_ticks [CPU_STATE_USER];
|
||||
buf->xcpu_sys [i] = pinfo[i].cpu_ticks [CPU_STATE_SYSTEM];
|
||||
buf->xcpu_idle [i] = pinfo[i].cpu_ticks [CPU_STATE_IDLE];
|
||||
buf->xcpu_nice [i] = pinfo[i].cpu_ticks [CPU_STATE_NICE];
|
||||
buf->xcpu_total[i] = buf->xcpu_user [i] + buf->xcpu_sys [i] +
|
||||
buf->xcpu_idle [i] + buf->xcpu_nice [i];
|
||||
|
||||
buf->user += buf->xcpu_user [i];
|
||||
buf->sys += buf->xcpu_sys [i];
|
||||
buf->idle += buf->xcpu_idle [i];
|
||||
buf->nice += buf->xcpu_nice [i];
|
||||
buf->total += buf->xcpu_total[i];
|
||||
}
|
||||
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count);
|
||||
|
||||
buf->frequency = 100;
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
33
sysdeps/darwin/glibtop_machine.h
Normal file
33
sysdeps/darwin/glibtop_machine.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
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 __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
uid_t uid, euid; /* Real and effective user id */
|
||||
gid_t gid, egid; /* Real and effective group id */
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
51
sysdeps/darwin/glibtop_server.h
Normal file
51
sysdeps/darwin/glibtop_server.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
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 __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 (1 << GLIBTOP_SYSDEPS_PROC_WD)
|
||||
#define GLIBTOP_SUID_PROC_AFFINITY 0
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
46
sysdeps/darwin/glibtop_suid.h
Normal file
46
sysdeps/darwin/glibtop_suid.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 __GLIBTOP_SUID_H__
|
||||
#define __GLIBTOP_SUID_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <glibtop_machine.h>
|
||||
|
||||
static inline void glibtop_suid_enter (glibtop *server) {
|
||||
setreuid (server->machine->uid, server->machine->euid);
|
||||
};
|
||||
|
||||
static inline void glibtop_suid_leave (glibtop *server) {
|
||||
if (setreuid (server->machine->euid, server->machine->uid))
|
||||
_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
|
||||
65
sysdeps/darwin/loadavg.c
Normal file
65
sysdeps/darwin/loadavg.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/loadavg.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <stdlib.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, (1 << GLIBTOP_SYSDEPS_LOADAVG), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
if (getloadavg (ldavg, 3) != 3) {
|
||||
glibtop_warn_io_r (server, "getloadavg");
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill in the struct */
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
for (i = 0; i < 3; i++) {
|
||||
buf->loadavg [i] = ldavg [i];
|
||||
}
|
||||
}
|
||||
|
||||
70
sysdeps/darwin/mem.c
Normal file
70
sysdeps/darwin/mem.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/mem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/host_info.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
|
||||
(1L << GLIBTOP_MEM_FREE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_mem_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
vm_statistics_data_t vm_info;
|
||||
mach_msg_type_number_t info_count;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
info_count = HOST_VM_INFO_COUNT;
|
||||
if (host_statistics (mach_host_self (), HOST_VM_INFO,
|
||||
(host_info_t)&vm_info, &info_count)) {
|
||||
glibtop_warn_io_r (server, "host_statistics (vm_statistics)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->total = (vm_info.active_count + vm_info.inactive_count +
|
||||
vm_info.free_count + vm_info.wire_count) * vm_page_size;
|
||||
buf->free = vm_info.free_count * vm_page_size;
|
||||
buf->used = buf->total - buf->free;
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
47
sysdeps/darwin/msg_limits.c
Normal file
47
sysdeps/darwin/msg_limits.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/msg_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
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, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
}
|
||||
66
sysdeps/darwin/netlist.c
Normal file
66
sysdeps/darwin/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);
|
||||
}
|
||||
|
||||
165
sysdeps/darwin/netload.c
Normal file
165
sysdeps/darwin/netload.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/route.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netload =
|
||||
(1L << GLIBTOP_NETLOAD_IF_FLAGS) +
|
||||
(1L << GLIBTOP_NETLOAD_MTU) +
|
||||
/* (1L << GLIBTOP_NETLOAD_SUBNET) + */
|
||||
/* (1L << GLIBTOP_NETLOAD_ADDRESS) + */
|
||||
(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);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_netload_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
}
|
||||
|
||||
/* Provides Network statistics. */
|
||||
|
||||
void
|
||||
glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
int mib[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
|
||||
size_t bufsize;
|
||||
char *rtbuf, *ptr, *eob;
|
||||
struct if_msghdr *ifm;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_NETLOAD), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
|
||||
if (sysctl (mib, 6, NULL, &bufsize, NULL, 0) < 0)
|
||||
return;
|
||||
|
||||
rtbuf = (char*)g_malloc (bufsize);
|
||||
if (rtbuf == NULL)
|
||||
return;
|
||||
|
||||
if (sysctl (mib, 6, rtbuf, &bufsize, NULL, 0) < 0) {
|
||||
g_free (rtbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
eob = rtbuf + bufsize;
|
||||
ptr = rtbuf;
|
||||
while (ptr < eob) {
|
||||
struct sockaddr_dl *sdl;
|
||||
|
||||
ifm = (struct if_msghdr*) ptr;
|
||||
|
||||
if (ifm->ifm_type != RTM_IFINFO)
|
||||
break;
|
||||
ptr += ifm->ifm_msglen;
|
||||
|
||||
while (ptr < eob) {
|
||||
struct if_msghdr *nextifm = (struct if_msghdr*) ptr;
|
||||
|
||||
if (nextifm->ifm_type != RTM_NEWADDR)
|
||||
break;
|
||||
ptr += nextifm->ifm_msglen;
|
||||
}
|
||||
|
||||
sdl = (struct sockaddr_dl*) (ifm + 1);
|
||||
if (sdl->sdl_family != AF_LINK)
|
||||
continue;
|
||||
if (strlen (interface) != sdl->sdl_nlen)
|
||||
continue;
|
||||
if (strcmp (interface, sdl->sdl_data) == 0)
|
||||
goto FOUND;
|
||||
}
|
||||
g_free (rtbuf);
|
||||
return;
|
||||
|
||||
FOUND:
|
||||
if (ifm->ifm_flags & IFF_UP)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_UP;
|
||||
if (ifm->ifm_flags & IFF_BROADCAST)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_BROADCAST;
|
||||
if (ifm->ifm_flags & IFF_DEBUG)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_DEBUG;
|
||||
if (ifm->ifm_flags & IFF_LOOPBACK)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_LOOPBACK;
|
||||
if (ifm->ifm_flags & IFF_POINTOPOINT)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_POINTOPOINT;
|
||||
if (ifm->ifm_flags & IFF_RUNNING)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_RUNNING;
|
||||
if (ifm->ifm_flags & IFF_NOARP)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_NOARP;
|
||||
if (ifm->ifm_flags & IFF_NOARP)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_PROMISC;
|
||||
if (ifm->ifm_flags & IFF_ALLMULTI)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_ALLMULTI;
|
||||
if (ifm->ifm_flags & IFF_OACTIVE)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_OACTIVE;
|
||||
if (ifm->ifm_flags & IFF_SIMPLEX)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_SIMPLEX;
|
||||
if (ifm->ifm_flags & IFF_LINK0)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_LINK0;
|
||||
if (ifm->ifm_flags & IFF_LINK1)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_LINK1;
|
||||
if (ifm->ifm_flags & IFF_LINK2)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_LINK2;
|
||||
if (ifm->ifm_flags & IFF_ALTPHYS)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_ALTPHYS;
|
||||
if (ifm->ifm_flags & IFF_MULTICAST)
|
||||
buf->if_flags |= GLIBTOP_IF_FLAGS_MULTICAST;
|
||||
buf->mtu = ifm->ifm_data.ifi_mtu;
|
||||
buf->subnet = 0; /* FIXME */
|
||||
buf->address = 0; /* FIXME */
|
||||
buf->packets_in = ifm->ifm_data.ifi_ipackets;
|
||||
buf->packets_out = ifm->ifm_data.ifi_opackets;
|
||||
buf->packets_total = buf->packets_in + buf->packets_out;
|
||||
buf->bytes_in = ifm->ifm_data.ifi_ibytes;
|
||||
buf->bytes_out = ifm->ifm_data.ifi_obytes;
|
||||
buf->bytes_total = buf->bytes_in + buf->bytes_out;
|
||||
buf->errors_in = ifm->ifm_data.ifi_ierrors;
|
||||
buf->errors_out = ifm->ifm_data.ifi_oerrors;
|
||||
buf->errors_total = buf->errors_in + buf->errors_out;
|
||||
buf->collisions = ifm->ifm_data.ifi_collisions;
|
||||
buf->flags = _glibtop_sysdeps_netload;
|
||||
g_free (buf);
|
||||
}
|
||||
55
sysdeps/darwin/nosuid.c
Normal file
55
sysdeps/darwin/nosuid.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_interface.h>
|
||||
|
||||
#include <glibtop/error.h>
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
processor_cpu_load_info_data_t *pinfo;
|
||||
mach_msg_type_number_t info_count;
|
||||
natural_t processor_count;
|
||||
|
||||
if (host_processor_info (mach_host_self (),
|
||||
PROCESSOR_CPU_LOAD_INFO,
|
||||
&processor_count,
|
||||
(processor_info_array_t*)&pinfo,
|
||||
&info_count)) {
|
||||
glibtop_error_io_r (server, "host_processor_info");
|
||||
}
|
||||
server->ncpu = (processor_count <= GLIBTOP_NCPU) ?
|
||||
processor_count : GLIBTOP_NCPU;
|
||||
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
||||
100
sysdeps/darwin/open.c
Normal file
100
sysdeps/darwin/open.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
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/cpu.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
#include <glibtop_machine.h>
|
||||
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_interface.h>
|
||||
|
||||
#include <glibtop/init_hooks.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <unistd.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_INIT) == 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_INIT;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
processor_cpu_load_info_data_t *pinfo;
|
||||
mach_msg_type_number_t info_count;
|
||||
natural_t processor_count;
|
||||
|
||||
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
|
||||
|
||||
server->name = program_name;
|
||||
|
||||
server->machine->uid = getuid ();
|
||||
server->machine->euid = geteuid ();
|
||||
server->machine->gid = getgid ();
|
||||
server->machine->egid = getegid ();
|
||||
|
||||
/* 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. */
|
||||
|
||||
if (host_processor_info (mach_host_self (),
|
||||
PROCESSOR_CPU_LOAD_INFO,
|
||||
&processor_count,
|
||||
(processor_info_array_t*)&pinfo,
|
||||
&info_count)) {
|
||||
glibtop_error_io_r (server, "host_processor_info");
|
||||
}
|
||||
server->ncpu = (processor_count <= GLIBTOP_NCPU) ?
|
||||
processor_count : GLIBTOP_NCPU;
|
||||
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count);
|
||||
}
|
||||
47
sysdeps/darwin/ppp.c
Normal file
47
sysdeps/darwin/ppp.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/ppp.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_ppp = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_ppp_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
}
|
||||
|
||||
/* Provides PPP/ISDN information. */
|
||||
|
||||
void
|
||||
glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PPP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
}
|
||||
44
sysdeps/darwin/procaffinity.c
Normal file
44
sysdeps/darwin/procaffinity.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/procaffinity.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
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)
|
||||
{
|
||||
memset(buf, 0, sizeof *buf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
130
sysdeps/darwin/procargs.c
Normal file
130
sysdeps/darwin/procargs.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <limits.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)
|
||||
{
|
||||
char argbuf[4096];
|
||||
char *start, *end, *str;
|
||||
size_t bufsize = 4096;
|
||||
int mib [3];
|
||||
unsigned length;
|
||||
char *args;
|
||||
int *ip;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
mib [0] = CTL_KERN;
|
||||
mib [1] = KERN_PROCARGS;
|
||||
mib [2] = pid;
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
if (sysctl (mib, 3, argbuf, &bufsize, NULL, 0) < 0) {
|
||||
glibtop_suid_leave (server);
|
||||
return NULL;
|
||||
}
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
end = &argbuf[bufsize];
|
||||
|
||||
ip = (int *)end - 2;
|
||||
while (*--ip) {
|
||||
if (ip == (int *)argbuf) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
start = (char *)(ip + 1);
|
||||
while (*--ip) {
|
||||
if (ip == (int *)argbuf) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
ip++;
|
||||
|
||||
if ((ip[0] & 0xbfff0000) == 0xbfff0000) {
|
||||
ip += 2;
|
||||
start = (char*)(ip + (strlen ((char*)ip) + 3) / 4);
|
||||
while (!*start)
|
||||
start++;
|
||||
}
|
||||
|
||||
for (str = start + strlen (start); str < end - 1; str++) {
|
||||
if (*str == '=') {
|
||||
while (*str != '\0' && str > start)
|
||||
str--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
end = str;
|
||||
|
||||
if (start[0] == '-' || start[0] == '?' || start[0] <= ' ') {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length = end - start;
|
||||
if (max_len != 0 && length > max_len)
|
||||
length = max_len;
|
||||
args = g_malloc(length + 1);
|
||||
if (args == NULL) {
|
||||
glibtop_warn_io_r (server, "malloc(procargs)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy (args, start, length);
|
||||
args [length] = '\0';
|
||||
|
||||
buf->size = length;
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return args;
|
||||
}
|
||||
48
sysdeps/darwin/prockernel.c
Normal file
48
sysdeps/darwin/prockernel.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_kernel_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
}
|
||||
104
sysdeps/darwin/proclist.c
Normal file
104
sysdeps/darwin/proclist.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proclist.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
|
||||
(1L << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proclist_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
pid_t *
|
||||
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
|
||||
gint64 which, gint64 arg)
|
||||
{
|
||||
unsigned count, total, i;
|
||||
pid_t *pids_chain;
|
||||
int mib[4];
|
||||
struct kinfo_proc *kp;
|
||||
size_t length;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
mib [0] = CTL_KERN;
|
||||
mib [1] = KERN_PROC;
|
||||
mib [2] = (int)(which & GLIBTOP_KERN_PROC_MASK);
|
||||
mib [3] = (int)arg;
|
||||
|
||||
if (sysctl (mib, 4, NULL, &length, NULL, 0) < 0) {
|
||||
glibtop_warn_io_r (server, "sysctl (proclist)");
|
||||
return NULL;
|
||||
}
|
||||
if ((kp = (struct kinfo_proc *) g_malloc(length)) == NULL) {
|
||||
glibtop_warn_io_r (server, "malloc (proclist)");
|
||||
return NULL;
|
||||
}
|
||||
if (sysctl (mib, 4, kp, &length, NULL, 0) < 0) {
|
||||
glibtop_warn_io_r (server, "sysctl (proclist)");
|
||||
g_free (kp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
count = length / sizeof (struct kinfo_proc);
|
||||
pids_chain = g_malloc(count * sizeof (unsigned));
|
||||
if (pids_chain == NULL) {
|
||||
glibtop_warn_io_r (server, "g_realloc (proclist)");
|
||||
g_free (kp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (total = 0, i = 0; i < count; i++) {
|
||||
if ((which & GLIBTOP_EXCLUDE_IDLE) &&
|
||||
(kp [i].kp_proc.p_stat != SRUN))
|
||||
continue;
|
||||
if ((which & GLIBTOP_EXCLUDE_SYSTEM) &&
|
||||
(kp [i].kp_eproc.e_pcred.p_ruid == 0))
|
||||
continue;
|
||||
pids_chain [total++] = (unsigned) kp [i].kp_proc.p_pid;
|
||||
}
|
||||
|
||||
g_free (kp);
|
||||
|
||||
buf->number = total;
|
||||
buf->size = sizeof (unsigned);
|
||||
buf->total = total * sizeof (unsigned);
|
||||
buf->flags = _glibtop_sysdeps_proclist;
|
||||
|
||||
return pids_chain;
|
||||
}
|
||||
|
||||
134
sysdeps/darwin/procmap.c
Normal file
134
sysdeps/darwin/procmap.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/vm_map.h>
|
||||
|
||||
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_proc_map_entry =
|
||||
(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
|
||||
(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
glibtop_map_entry *maps;
|
||||
mach_port_t task;
|
||||
vm_address_t address;
|
||||
natural_t nesting_depth;
|
||||
int n;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS) {
|
||||
glibtop_suid_leave (server);
|
||||
glibtop_warn_io_r (server, "task_for_pid (procmap)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
maps = NULL;
|
||||
n = 0;
|
||||
address = 0;
|
||||
nesting_depth = 0;
|
||||
while (1) {
|
||||
vm_region_submap_info_data_64_t info;
|
||||
mach_msg_type_number_t info_count;
|
||||
vm_size_t size;
|
||||
|
||||
info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
|
||||
if (vm_region_recurse_64 (task, &address, &size, &nesting_depth,
|
||||
(vm_region_recurse_info_64_t)&info, &info_count))
|
||||
break;
|
||||
|
||||
if (info.is_submap) {
|
||||
nesting_depth++;
|
||||
continue;
|
||||
}
|
||||
|
||||
maps = g_realloc (maps, (n + 1) * sizeof (glibtop_map_entry));
|
||||
if (!maps) {
|
||||
glibtop_suid_leave (server);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset (maps + n, 0, sizeof (glibtop_map_entry));
|
||||
|
||||
maps[n].start = address;
|
||||
maps[n].end = address + size - 1;
|
||||
maps[n].offset = info.offset;
|
||||
if (info.protection & VM_PROT_READ)
|
||||
maps[n].perm |= GLIBTOP_MAP_PERM_READ;
|
||||
if (info.protection & VM_PROT_WRITE)
|
||||
maps[n].perm |= GLIBTOP_MAP_PERM_WRITE;
|
||||
if (info.protection & VM_PROT_EXECUTE)
|
||||
maps[n].perm |= GLIBTOP_MAP_PERM_EXECUTE;
|
||||
if (info.share_mode == SM_PRIVATE ||
|
||||
info.share_mode == SM_PRIVATE_ALIASED)
|
||||
maps[n].perm |= GLIBTOP_MAP_PERM_PRIVATE;
|
||||
if (info.share_mode == SM_SHARED ||
|
||||
info.share_mode == SM_TRUESHARED ||
|
||||
info.share_mode == SM_SHARED_ALIASED)
|
||||
maps[n].perm |= GLIBTOP_MAP_PERM_SHARED;
|
||||
|
||||
maps[n].flags = _glibtop_sysdeps_proc_map_entry;
|
||||
|
||||
address += size;
|
||||
n++;
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
buf->number = n;
|
||||
buf->size = sizeof (glibtop_map_entry);
|
||||
buf->total = n * sizeof (glibtop_map_entry);
|
||||
buf->flags = _glibtop_sysdeps_proc_map;
|
||||
|
||||
return maps;
|
||||
}
|
||||
245
sysdeps/darwin/procmem.c
Normal file
245
sysdeps/darwin/procmem.c
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmem.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/mach_traps.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/vm_map.h>
|
||||
#include <mach/shared_memory_server.h>
|
||||
|
||||
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_SHARE) +
|
||||
(1L << GLIBTOP_PROC_MEM_RSS);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_mem_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
|
||||
|
||||
#define SHARED_TABLE_SIZE 137
|
||||
#define TEXT_SEGMENT_START (GLOBAL_SHARED_TEXT_SEGMENT)
|
||||
#define TEXT_SEGMENT_END (GLOBAL_SHARED_TEXT_SEGMENT + SHARED_TEXT_REGION_SIZE)
|
||||
#define DATA_SEGMENT_START (GLOBAL_SHARED_DATA_SEGMENT)
|
||||
#define DATA_SEGMENT_END (GLOBAL_SHARED_DATA_SEGMENT + SHARED_DATA_REGION_SIZE)
|
||||
|
||||
struct shared_info {
|
||||
unsigned obj_id;
|
||||
unsigned share_mode;
|
||||
unsigned page_count;
|
||||
unsigned ref_count;
|
||||
unsigned task_ref_count;
|
||||
vm_size_t size;
|
||||
struct shared_info *next;
|
||||
};
|
||||
typedef struct shared_info shared_table[SHARED_TABLE_SIZE];
|
||||
typedef struct shared_info shared_info;
|
||||
|
||||
static void
|
||||
shared_table_init (shared_table table)
|
||||
{
|
||||
memset (table, 0, sizeof (shared_table));
|
||||
}
|
||||
|
||||
static void
|
||||
shared_table_free (glibtop *server, shared_table table)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SHARED_TABLE_SIZE; i++) {
|
||||
shared_info *info = table [i].next;
|
||||
|
||||
while (info) {
|
||||
shared_info *next = info->next;
|
||||
g_free (info);
|
||||
info = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shared_table_register (glibtop *server, shared_table table,
|
||||
vm_region_top_info_data_t *top, vm_size_t size)
|
||||
{
|
||||
shared_info *info, *last;
|
||||
|
||||
info = last = &table [top->obj_id % SHARED_TABLE_SIZE];
|
||||
while (info) {
|
||||
if (info->obj_id == top->obj_id) {
|
||||
info->task_ref_count++;
|
||||
return;
|
||||
}
|
||||
last = info;
|
||||
info = info->next;
|
||||
}
|
||||
|
||||
info = g_malloc (sizeof (shared_info));
|
||||
if (info) {
|
||||
info->obj_id = top->obj_id;
|
||||
info->share_mode = top->share_mode;
|
||||
info->page_count = top->shared_pages_resident;
|
||||
info->ref_count = top->ref_count;
|
||||
info->task_ref_count = 1;
|
||||
info->size = size;
|
||||
info->next = NULL;
|
||||
last->next = info;
|
||||
}
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
task_basic_info_data_t tinfo;
|
||||
mach_msg_type_number_t info_count;
|
||||
vm_size_t vsize, resident, private, vprivate, shared;
|
||||
kern_return_t retval;
|
||||
shared_table stable;
|
||||
vm_address_t address;
|
||||
mach_port_t task;
|
||||
int i, split;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
address = 0;
|
||||
split = 0;
|
||||
vsize = resident = private = vprivate = shared = 0;
|
||||
shared_table_init (stable);
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
retval = task_for_pid (mach_task_self (), pid, &task);
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
if (retval)
|
||||
return;
|
||||
|
||||
info_count = TASK_BASIC_INFO_COUNT;
|
||||
if (task_info (task, TASK_BASIC_INFO, (task_info_t)&tinfo, &info_count)) {
|
||||
glibtop_warn_io_r (server, "task_info (procmem)");
|
||||
return;
|
||||
}
|
||||
vsize = tinfo.virtual_size;
|
||||
resident = tinfo.resident_size;
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
while (1) {
|
||||
vm_region_basic_info_data_64_t basic;
|
||||
vm_region_top_info_data_t top;
|
||||
mach_port_t object_name;
|
||||
vm_size_t size;
|
||||
|
||||
info_count = VM_REGION_BASIC_INFO_COUNT_64;
|
||||
if (vm_region_64 (task, &address, &size, VM_REGION_BASIC_INFO,
|
||||
(vm_region_info_t)&basic,
|
||||
&info_count, &object_name))
|
||||
break;
|
||||
|
||||
info_count = VM_REGION_TOP_INFO_COUNT;
|
||||
if (vm_region_64 (task, &address, &size, VM_REGION_TOP_INFO,
|
||||
(vm_region_info_t)&top,
|
||||
&info_count, &object_name))
|
||||
break;
|
||||
|
||||
if (address >= TEXT_SEGMENT_START && address < DATA_SEGMENT_END) {
|
||||
if (!split && top.share_mode == SM_EMPTY) {
|
||||
if (basic.reserved)
|
||||
split = 1;
|
||||
}
|
||||
if (top.share_mode != SM_PRIVATE) {
|
||||
address += size;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (top.share_mode) {
|
||||
case SM_COW:
|
||||
if (top.ref_count == 1) {
|
||||
private += top.private_pages_resident * vm_page_size;
|
||||
private += top.shared_pages_resident * vm_page_size;
|
||||
vprivate += size;
|
||||
} else {
|
||||
shared_table_register (server, stable, &top, size);
|
||||
vprivate += top.private_pages_resident * vm_page_size;
|
||||
}
|
||||
break;
|
||||
case SM_PRIVATE:
|
||||
private += top.private_pages_resident * vm_page_size;
|
||||
vprivate += size;
|
||||
break;
|
||||
case SM_SHARED:
|
||||
shared_table_register (server, stable, &top, size);
|
||||
break;
|
||||
}
|
||||
|
||||
address += size;
|
||||
}
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
for (i = 0; i < SHARED_TABLE_SIZE; i++) {
|
||||
shared_info *sinfo = &stable[i];
|
||||
|
||||
while (sinfo) {
|
||||
if (sinfo->share_mode == SM_SHARED &&
|
||||
sinfo->ref_count == sinfo->task_ref_count) {
|
||||
private += sinfo->page_count * vm_page_size;
|
||||
vprivate += sinfo->size;
|
||||
} else {
|
||||
shared += sinfo->page_count * vm_page_size;
|
||||
}
|
||||
sinfo = sinfo->next;
|
||||
}
|
||||
}
|
||||
shared_table_free (server, stable);
|
||||
|
||||
if (split)
|
||||
vsize -= DATA_SEGMENT_END - TEXT_SEGMENT_START;
|
||||
|
||||
buf->size = vprivate;
|
||||
buf->vsize = vsize;
|
||||
buf->resident = resident;
|
||||
buf->share = shared;
|
||||
buf->rss = private;
|
||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
43
sysdeps/darwin/procopenfiles.c
Normal file
43
sysdeps/darwin/procopenfiles.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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/error.h>
|
||||
#include <glibtop/procopenfiles.h>
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_open_files_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_open_files = 0;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_open_files_entry *
|
||||
glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
|
||||
{
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_open_files));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
48
sysdeps/darwin/procsegment.c
Normal file
48
sysdeps/darwin/procsegment.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
|
||||
#include <glibtop_suid.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, (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
}
|
||||
76
sysdeps/darwin/procsignal.c
Normal file
76
sysdeps/darwin/procsignal.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procsignal.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
int mib[4];
|
||||
size_t length;
|
||||
struct kinfo_proc kinfo;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
mib [0] = CTL_KERN;
|
||||
mib [1] = KERN_PROC;
|
||||
mib [2] = KERN_PROC_PID;
|
||||
mib [3] = pid;
|
||||
|
||||
length = sizeof (struct kinfo_proc);
|
||||
if (sysctl (mib, 4, &kinfo, &length, NULL, 0) < 0) {
|
||||
glibtop_warn_io_r (server, "sysctl (procuid)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->signal[0] = kinfo.kp_proc.p_siglist;
|
||||
buf->blocked[0] = kinfo.kp_proc.p_sigmask;
|
||||
buf->sigignore[0] = kinfo.kp_proc.p_sigignore;
|
||||
buf->sigcatch[0] = kinfo.kp_proc.p_sigcatch;
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
94
sysdeps/darwin/procstate.c
Normal file
94
sysdeps/darwin/procstate.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procstate.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_state =
|
||||
(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_STATE) +
|
||||
(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_state_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
int mib[4];
|
||||
size_t length;
|
||||
struct kinfo_proc kinfo;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_STATE), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
mib [0] = CTL_KERN;
|
||||
mib [1] = KERN_PROC;
|
||||
mib [2] = KERN_PROC_PID;
|
||||
mib [3] = pid;
|
||||
|
||||
length = sizeof (struct kinfo_proc);
|
||||
if (sysctl (mib, 4, &kinfo, &length, NULL, 0) < 0) {
|
||||
glibtop_warn_io_r (server, "sysctl (procstat)");
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy (buf->cmd, kinfo.kp_proc.p_comm, sizeof (buf->cmd) - 1);
|
||||
buf->cmd [sizeof (buf->cmd) - 1] = 0;
|
||||
buf->uid = kinfo.kp_eproc.e_pcred.p_svuid;
|
||||
buf->gid = kinfo.kp_eproc.e_pcred.p_svgid;
|
||||
switch (kinfo.kp_proc.p_stat) {
|
||||
case SIDL:
|
||||
buf->state = 0;
|
||||
break;
|
||||
case SRUN:
|
||||
buf->state = 'R';
|
||||
break;
|
||||
case SSLEEP:
|
||||
buf->state = 'S';
|
||||
break;
|
||||
case SSTOP:
|
||||
buf->state = 'T';
|
||||
break;
|
||||
case SZOMB:
|
||||
buf->state = 'Z';
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
buf->flags = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
118
sysdeps/darwin/proctime.c
Normal file
118
sysdeps/darwin/proctime.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/proctime.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/mach_port.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/vm_map.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_STIME) +
|
||||
(1L << GLIBTOP_PROC_TIME_FREQUENCY) + (1L << GLIBTOP_PROC_TIME_START_TIME);
|
||||
|
||||
#define tv2sec(tv) (((u_int64_t) tv.seconds * 1000000) + (u_int64_t) tv.microseconds)
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_time_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
unsigned int count;
|
||||
task_basic_info_data_t ti;
|
||||
task_thread_times_info_data_t tti;
|
||||
task_port_t task;
|
||||
time_value_t utime = {0, 0}, stime = {0, 0};
|
||||
size_t length;
|
||||
struct kinfo_proc kinfo;
|
||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_TIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
mib[3] = pid;
|
||||
length = sizeof (kinfo);
|
||||
if (sysctl (mib, 4, &kinfo, &length, NULL, 0) < 0) {
|
||||
glibtop_suid_leave (server);
|
||||
return;
|
||||
}
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
if (task_for_pid (mach_task_self(), pid, &task) != KERN_SUCCESS) {
|
||||
glibtop_suid_leave (server);
|
||||
return;
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
count = TASK_BASIC_INFO_COUNT;
|
||||
if (task_info(task, TASK_BASIC_INFO, (task_info_t)&ti, &count) != KERN_SUCCESS) {
|
||||
glibtop_warn_io_r (server, "task_info (proctime)");
|
||||
if (task != mach_task_self())
|
||||
mach_port_deallocate (mach_task_self(), task);
|
||||
return;
|
||||
}
|
||||
|
||||
count = TASK_THREAD_TIMES_INFO_COUNT;
|
||||
if (task_info(task, TASK_THREAD_TIMES_INFO, (task_info_t)&tti, &count) != KERN_SUCCESS) {
|
||||
glibtop_warn_io_r (server, "task_info (proctime)");
|
||||
if (task != mach_task_self())
|
||||
mach_port_deallocate (mach_task_self(), task);
|
||||
return;
|
||||
}
|
||||
|
||||
time_value_add (&utime, &ti.user_time);
|
||||
time_value_add (&stime, &ti.system_time);
|
||||
time_value_add (&utime, &tti.user_time);
|
||||
time_value_add (&stime, &tti.system_time);
|
||||
|
||||
/* use the same frequency as cpu.c */
|
||||
buf->utime = tv2sec (utime) / 10000;
|
||||
buf->stime = tv2sec (stime) / 10000;
|
||||
buf->frequency = 1000000 / 10000;
|
||||
buf->start_time = kinfo.kp_proc.p_starttime.tv_sec;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
83
sysdeps/darwin/procuid.c
Normal file
83
sysdeps/darwin/procuid.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procuid.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
|
||||
(1L << GLIBTOP_PROC_UID_GID) + (1L << GLIBTOP_PROC_UID_EGID) +
|
||||
(1L << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_PPID) +
|
||||
(1L << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_TTY) +
|
||||
(1L << GLIBTOP_PROC_UID_TPGID);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_uid_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
int mib[4];
|
||||
size_t length;
|
||||
struct kinfo_proc kinfo;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_UID), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
mib [0] = CTL_KERN;
|
||||
mib [1] = KERN_PROC;
|
||||
mib [2] = KERN_PROC_PID;
|
||||
mib [3] = pid;
|
||||
|
||||
length = sizeof (struct kinfo_proc);
|
||||
if (sysctl (mib, 4, &kinfo, &length, NULL, 0) < 0) {
|
||||
glibtop_warn_io_r (server, "sysctl (procuid)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->uid = kinfo.kp_eproc.e_pcred.p_ruid;
|
||||
buf->euid = kinfo.kp_eproc.e_pcred.p_svuid;
|
||||
buf->gid = kinfo.kp_eproc.e_pcred.p_rgid;
|
||||
buf->egid = kinfo.kp_eproc.e_pcred.p_svgid;
|
||||
buf->ppid = kinfo.kp_eproc.e_ppid;
|
||||
buf->pgrp = kinfo.kp_eproc.e_pgid;
|
||||
buf->tpgid = kinfo.kp_eproc.e_tpgid;
|
||||
buf->nice = kinfo.kp_proc.p_nice;
|
||||
buf->priority = kinfo.kp_proc.p_priority;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
50
sysdeps/darwin/procwd.c
Normal file
50
sysdeps/darwin/procwd.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
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/procwd.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_wd = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_proc_wd_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_wd = _glibtop_sysdeps_proc_wd;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
char **
|
||||
glibtop_get_proc_wd_p (glibtop *server, glibtop_proc_wd *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_WD, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_wd));
|
||||
return NULL;
|
||||
}
|
||||
47
sysdeps/darwin/sem_limits.c
Normal file
47
sysdeps/darwin/sem_limits.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/sem_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sem_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
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, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
}
|
||||
47
sysdeps/darwin/shm_limits.c
Normal file
47
sysdeps/darwin/shm_limits.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/shm_limits.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
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, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
}
|
||||
60
sysdeps/darwin/siglist.c
Normal file
60
sysdeps/darwin/siglist.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/signal.h>
|
||||
|
||||
const glibtop_signame glibtop_sys_siglist [] =
|
||||
{ { 1, "SIGHUP", NULL }, /* hangup */
|
||||
{ 2, "SIGINT", NULL }, /* interrupt */
|
||||
{ 3, "SIGQUIT", NULL }, /* quit */
|
||||
{ 4, "SIGILL", NULL }, /* illegal instruction */
|
||||
{ 5, "SIGTRAP", NULL }, /* trace trap */
|
||||
{ 6, "SIGTRAP", NULL }, /* abort */
|
||||
{ 7, "SIGEMT", NULL }, /* EMT instruction */
|
||||
{ 8, "SIGFPE", NULL }, /* floating point exception */
|
||||
{ 9, "SIGKILL", NULL }, /* kill */
|
||||
{ 10, "SIGBUS", NULL }, /* bus error */
|
||||
{ 11, "SIGSEGV", NULL }, /* segmentation violation */
|
||||
{ 12, "SIGSYS", NULL }, /* bad argument to system call */
|
||||
{ 13, "SIGPIPE", NULL }, /* write on a pipe with no one to read it */
|
||||
{ 14, "SIGALRM", NULL }, /* alarm clock */
|
||||
{ 15, "SIGTERM", NULL }, /* software termination signal from kill */
|
||||
{ 16, "SIGURG", NULL }, /* urgent condition on IO channel */
|
||||
{ 17, "SIGSTOP", NULL }, /* sendable stop signal not from tty */
|
||||
{ 18, "SIGTSTP", NULL }, /* stop signal from tty */
|
||||
{ 19, "SIGCONT", NULL }, /* continue a stopped process */
|
||||
{ 20, "SIGCHLD", NULL }, /* to parent on child stop or exit */
|
||||
{ 21, "SIGTTIN", NULL }, /* to readers pgrp upon background tty read */
|
||||
{ 22, "SIGTTOU", NULL }, /* like TTIN for output */
|
||||
{ 23, "SIGIO", NULL }, /* input/output possible signal */
|
||||
{ 24, "SIGXCPU", NULL }, /* exceeded CPU time limit */
|
||||
{ 25, "SIGXFSZ", NULL }, /* exceeded file size limit */
|
||||
{ 26, "SIGVTALRM", NULL }, /* virtual time alarm */
|
||||
{ 27, "SIGPROF", NULL }, /* profiling time alarm */
|
||||
{ 28, "SIGWINCH", NULL }, /* window size changes */
|
||||
{ 29, "SIGWINFO", NULL }, /* information request */
|
||||
{ 30, "SIGUSR1", NULL }, /* user defined signal 1 */
|
||||
{ 31, "SIGUSR2", NULL }, /* user defined signal 2 */
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
110
sysdeps/darwin/swap.c
Normal file
110
sysdeps/darwin/swap.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/swap.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/host_info.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <dirent.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);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
_glibtop_init_swap_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
vm_statistics_data_t vm_info;
|
||||
mach_msg_type_number_t info_count;
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
struct statfs sfs;
|
||||
u_int64_t total, used;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
total = used = 0;
|
||||
|
||||
dirp = opendir ("/private/var/vm");
|
||||
if (!dirp) {
|
||||
glibtop_warn_io_r (server, "opendir (swap)");
|
||||
return;
|
||||
}
|
||||
while ((dp = readdir (dirp)) != NULL) {
|
||||
struct stat sb;
|
||||
char fname [MAXNAMLEN];
|
||||
|
||||
if (strncmp (dp->d_name, "swapfile", 8))
|
||||
continue;
|
||||
|
||||
strcpy (fname, "/private/var/vm/");
|
||||
strcat (fname, dp->d_name);
|
||||
if (stat (fname, &sb) < 0)
|
||||
continue;
|
||||
|
||||
used += sb.st_size;
|
||||
}
|
||||
closedir (dirp);
|
||||
|
||||
if (statfs ("/private/var/vm", &sfs) < 0) {
|
||||
glibtop_warn_io_r (server, "statfs (swap)");
|
||||
return;
|
||||
}
|
||||
total = (u_int64_t)sfs.f_bfree * sfs.f_bsize + used;
|
||||
|
||||
info_count = HOST_VM_INFO_COUNT;
|
||||
if (host_statistics (mach_host_self (), HOST_VM_INFO,
|
||||
(host_info_t) &vm_info, &info_count)) {
|
||||
glibtop_warn_io_r (server, "host_statistics (swap)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->total = total;
|
||||
buf->used = used;
|
||||
buf->free = total - used;
|
||||
buf->pagein = vm_info.pageins;
|
||||
buf->pageout = vm_info.pageouts;
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
90
sysdeps/darwin/sysinfo.c
Normal file
90
sysdeps/darwin/sysinfo.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
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 <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.cpufrequency", &mhz, &len, NULL, 0);
|
||||
mhz = mhz / 1000000;
|
||||
|
||||
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;
|
||||
}
|
||||
66
sysdeps/darwin/uptime.c
Normal file
66
sysdeps/darwin/uptime.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 <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/uptime.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <time.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime =
|
||||
(1L << GLIBTOP_UPTIME_UPTIME);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
int mib [] = { CTL_KERN, KERN_BOOTTIME };
|
||||
struct timeval boottime;
|
||||
size_t size = sizeof (boottime);
|
||||
time_t now;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
/* copied from gkrellm port */
|
||||
|
||||
if (sysctl (mib, 2, &boottime, &size, NULL, 0) == -1)
|
||||
return;
|
||||
time (&now);
|
||||
|
||||
buf->uptime = now - boottime.tv_sec + 30;
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
Reference in New Issue
Block a user