Imported Upstream version 1.4.5
This commit is contained in:
parent
62d1e7d5fe
commit
6a280f6f24
412 changed files with 168642 additions and 0 deletions
74
plugins-root/Makefile.am
Normal file
74
plugins-root/Makefile.am
Normal file
|
@ -0,0 +1,74 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl -I$(top_srcdir)/plugins @SSLINCLUDE@
|
||||
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
LIBS = @LIBINTL@ @LIBS@ @SSLLIBS@
|
||||
|
||||
noinst_PROGRAMS = check_dhcp check_icmp @EXTRAS_ROOT@
|
||||
|
||||
EXTRA_PROGRAMS = pst3
|
||||
|
||||
EXTRA_DIST = pst3.c
|
||||
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a
|
||||
NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
|
||||
TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)
|
||||
|
||||
TESTS = @PLUGIN_TEST@
|
||||
|
||||
test:
|
||||
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
|
||||
|
||||
setuid_root_mode = 4550
|
||||
|
||||
# /* Author Coreutils team - see ACKNOWLEDGEMENTS */
|
||||
|
||||
INSTALL_SUID = \
|
||||
for f in $(noinst_PROGRAMS) ; do \
|
||||
p=$$f; \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p; \
|
||||
echo " chown root $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
chown root $(DESTDIR)$(libexecdir)/$$p; \
|
||||
echo " chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p; \
|
||||
done
|
||||
|
||||
install-root: $(noinst_PROGRAMS)
|
||||
@$(INSTALL_SUID)
|
||||
|
||||
install-exec-local: $(noinst_PROGRAMS)
|
||||
@TMPFILE=$(DESTDIR)$(libexecdir)/.setuid-$$$$; \
|
||||
rm -f $$TMPFILE; \
|
||||
echo > $$TMPFILE; \
|
||||
## See if we can create a setuid root executable in $(libexecdir).
|
||||
## If not, then don't even try to install setuid plugins.
|
||||
can_create_suid_root_executable=no; \
|
||||
chown root $$TMPFILE > /dev/null 2>&1 \
|
||||
&& chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
|
||||
&& can_create_suid_root_executable=yes; \
|
||||
rm -f $$TMPFILE; \
|
||||
if test $$can_create_suid_root_executable = yes; then \
|
||||
$(INSTALL_SUID); \
|
||||
else \
|
||||
echo "WARNING: insufficient access; not installing setuid plugins"; \
|
||||
echo "NOTE: to install setuid plugins, run 'make install-root' as root"; \
|
||||
fi
|
||||
|
||||
# /* Author Coreutils team sub-citation */
|
||||
|
||||
##############################################################################
|
||||
# the actual targets
|
||||
check_dhcp_LDADD = $(NETLIBS)
|
||||
check_icmp_LDADD = $(NETLIBS) $(SOCKETLIBS)
|
||||
pst3_LDADD = -lkvm
|
||||
|
||||
check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS)
|
||||
check_icmp_DEPENDENCIES = check_icmp.c $(NETOBJS)
|
665
plugins-root/Makefile.in
Normal file
665
plugins-root/Makefile.in
Normal file
|
@ -0,0 +1,665 @@
|
|||
# Makefile.in generated by automake 1.9.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
|
||||
SOURCES = check_dhcp.c check_icmp.c pst3.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
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@
|
||||
noinst_PROGRAMS = check_dhcp$(EXEEXT) check_icmp$(EXEEXT) \
|
||||
@EXTRAS_ROOT@ $(am__empty)
|
||||
EXTRA_PROGRAMS = pst3$(EXEEXT)
|
||||
subdir = plugins-root
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/afs.m4 \
|
||||
$(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/basename.m4 \
|
||||
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/exitfail.m4 \
|
||||
$(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/fcntl-safer.m4 \
|
||||
$(top_srcdir)/m4/fstypename.m4 $(top_srcdir)/m4/fsusage.m4 \
|
||||
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/ls-mntd-fs.m4 \
|
||||
$(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/np_coreutils.m4 $(top_srcdir)/m4/np_curl.m4 \
|
||||
$(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/regex.m4 \
|
||||
$(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/stdbool.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unistd-safer.m4 \
|
||||
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/xalloc.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
check_dhcp_SOURCES = check_dhcp.c
|
||||
check_dhcp_OBJECTS = check_dhcp.$(OBJEXT)
|
||||
am__DEPENDENCIES_1 = ../plugins/utils.o ../lib/libnagiosplug.a \
|
||||
../lib/libcoreutils.a
|
||||
am__DEPENDENCIES_2 =
|
||||
am__DEPENDENCIES_3 = ../plugins/netutils.o $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_2)
|
||||
am__DEPENDENCIES_4 = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2)
|
||||
check_icmp_SOURCES = check_icmp.c
|
||||
check_icmp_OBJECTS = check_icmp.$(OBJEXT)
|
||||
pst3_SOURCES = pst3.c
|
||||
pst3_OBJECTS = pst3.$(OBJEXT)
|
||||
pst3_DEPENDENCIES =
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = check_dhcp.c check_icmp.c pst3.c
|
||||
DIST_SOURCES = check_dhcp.c check_icmp.c pst3.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
INSTALL = @INSTALL@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_H = @ALLOCA_H@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BASENAME = @BASENAME@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DEPLIBS = @DEPLIBS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRAS = @EXTRAS@
|
||||
EXTRAS_ROOT = @EXTRAS_ROOT@
|
||||
EXTRA_NETOBJS = @EXTRA_NETOBJS@
|
||||
EXTRA_TEST = @EXTRA_TEST@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GETOPT_H = @GETOPT_H@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
HAVE__BOOL = @HAVE__BOOL@
|
||||
HOSTNAME = @HOSTNAME@
|
||||
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@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
KRBINCLUDE = @KRBINCLUDE@
|
||||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBINTL@ @LIBS@ @SSLLIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
MYSQLCFLAGS = @MYSQLCFLAGS@
|
||||
MYSQLCONFIG = @MYSQLCONFIG@
|
||||
MYSQLINCLUDE = @MYSQLINCLUDE@
|
||||
MYSQLLIBS = @MYSQLLIBS@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
NEED_VA_LIST = @NEED_VA_LIST@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PATH_TO_APTGET = @PATH_TO_APTGET@
|
||||
PATH_TO_DIG = @PATH_TO_DIG@
|
||||
PATH_TO_FPING = @PATH_TO_FPING@
|
||||
PATH_TO_LMSTAT = @PATH_TO_LMSTAT@
|
||||
PATH_TO_LSPS = @PATH_TO_LSPS@
|
||||
PATH_TO_MAILQ = @PATH_TO_MAILQ@
|
||||
PATH_TO_NSLOOKUP = @PATH_TO_NSLOOKUP@
|
||||
PATH_TO_PING = @PATH_TO_PING@
|
||||
PATH_TO_PING6 = @PATH_TO_PING6@
|
||||
PATH_TO_PS = @PATH_TO_PS@
|
||||
PATH_TO_QMAIL_QSTAT = @PATH_TO_QMAIL_QSTAT@
|
||||
PATH_TO_QSTAT = @PATH_TO_QSTAT@
|
||||
PATH_TO_QUAKESTAT = @PATH_TO_QUAKESTAT@
|
||||
PATH_TO_RPCINFO = @PATH_TO_RPCINFO@
|
||||
PATH_TO_SMBCLIENT = @PATH_TO_SMBCLIENT@
|
||||
PATH_TO_SNMPGET = @PATH_TO_SNMPGET@
|
||||
PATH_TO_SNMPGETNEXT = @PATH_TO_SNMPGETNEXT@
|
||||
PATH_TO_SSH = @PATH_TO_SSH@
|
||||
PATH_TO_SWAP = @PATH_TO_SWAP@
|
||||
PATH_TO_SWAPINFO = @PATH_TO_SWAPINFO@
|
||||
PATH_TO_UPTIME = @PATH_TO_UPTIME@
|
||||
PATH_TO_WHO = @PATH_TO_WHO@
|
||||
PERL = @PERL@
|
||||
PGINCLUDE = @PGINCLUDE@
|
||||
PGLIBS = @PGLIBS@
|
||||
PKG_ARCH = @PKG_ARCH@
|
||||
PLUGIN_TEST = @PLUGIN_TEST@
|
||||
POSUB = @POSUB@
|
||||
POW_LIB = @POW_LIB@
|
||||
PYTHON = @PYTHON@
|
||||
RADIUSLIBS = @RADIUSLIBS@
|
||||
RANLIB = @RANLIB@
|
||||
RELEASE = @RELEASE@
|
||||
REV_DATESTAMP = @REV_DATESTAMP@
|
||||
REV_TIMESTAMP = @REV_TIMESTAMP@
|
||||
SCRIPT_TEST = @SCRIPT_TEST@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
SOCKETLIBS = @SOCKETLIBS@
|
||||
SSLINCLUDE = @SSLINCLUDE@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
STDBOOL_H = @STDBOOL_H@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
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@
|
||||
check_tcp_ssl = @check_tcp_ssl@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_trusted_path = @with_trusted_path@
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl -I$(top_srcdir)/plugins @SSLINCLUDE@
|
||||
localedir = $(datadir)/locale
|
||||
EXTRA_DIST = pst3.c
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a
|
||||
NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)
|
||||
TESTS = @PLUGIN_TEST@
|
||||
setuid_root_mode = 4550
|
||||
|
||||
# /* Author Coreutils team - see ACKNOWLEDGEMENTS */
|
||||
INSTALL_SUID = \
|
||||
for f in $(noinst_PROGRAMS) ; do \
|
||||
p=$$f; \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p; \
|
||||
echo " chown root $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
chown root $(DESTDIR)$(libexecdir)/$$p; \
|
||||
echo " chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p"; \
|
||||
chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p; \
|
||||
done
|
||||
|
||||
|
||||
# /* Author Coreutils team sub-citation */
|
||||
|
||||
##############################################################################
|
||||
# the actual targets
|
||||
check_dhcp_LDADD = $(NETLIBS)
|
||||
check_icmp_LDADD = $(NETLIBS) $(SOCKETLIBS)
|
||||
pst3_LDADD = -lkvm
|
||||
check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS)
|
||||
check_icmp_DEPENDENCIES = check_icmp.c $(NETOBJS)
|
||||
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 \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins-root/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu plugins-root/Makefile
|
||||
.PRECIOUS: 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
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
check_dhcp$(EXEEXT): $(check_dhcp_OBJECTS) $(check_dhcp_DEPENDENCIES)
|
||||
@rm -f check_dhcp$(EXEEXT)
|
||||
$(LINK) $(check_dhcp_LDFLAGS) $(check_dhcp_OBJECTS) $(check_dhcp_LDADD) $(LIBS)
|
||||
check_icmp$(EXEEXT): $(check_icmp_OBJECTS) $(check_icmp_DEPENDENCIES)
|
||||
@rm -f check_icmp$(EXEEXT)
|
||||
$(LINK) $(check_icmp_LDFLAGS) $(check_icmp_OBJECTS) $(check_icmp_LDADD) $(LIBS)
|
||||
pst3$(EXEEXT): $(pst3_OBJECTS) $(pst3_DEPENDENCIES)
|
||||
@rm -f pst3$(EXEEXT)
|
||||
$(LINK) $(pst3_LDFLAGS) $(pst3_OBJECTS) $(pst3_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_dhcp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_icmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pst3.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
list='$(TESTS)'; \
|
||||
if test -n "$$list"; then \
|
||||
for tst in $$list; do \
|
||||
if test -f ./$$tst; then dir=./; \
|
||||
elif test -f $$tst; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xpass=`expr $$xpass + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "XPASS: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
echo "PASS: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xfail=`expr $$xfail + 1`; \
|
||||
echo "XFAIL: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
else \
|
||||
skip=`expr $$skip + 1`; \
|
||||
echo "SKIP: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
if test "$$xfail" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
|
||||
fi; \
|
||||
else \
|
||||
if test "$$xpass" -eq 0; then \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dashes="$$banner"; \
|
||||
skipped=""; \
|
||||
if test "$$skip" -ne 0; then \
|
||||
skipped="($$skip tests were not run)"; \
|
||||
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$skipped"; \
|
||||
fi; \
|
||||
report=""; \
|
||||
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
|
||||
report="Please report to $(PACKAGE_BUGREPORT)"; \
|
||||
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$report"; \
|
||||
fi; \
|
||||
dashes=`echo "$$dashes" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
test -z "$$skipped" || echo "$$skipped"; \
|
||||
test -z "$$report" || echo "$$report"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0; \
|
||||
else :; fi
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$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
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-exec-local
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
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-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
|
||||
clean-generic clean-libtool clean-noinstPROGRAMS ctags \
|
||||
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-exec install-exec-am \
|
||||
install-exec-local install-info install-info-am install-man \
|
||||
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 uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
|
||||
test:
|
||||
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
|
||||
|
||||
install-root: $(noinst_PROGRAMS)
|
||||
@$(INSTALL_SUID)
|
||||
|
||||
install-exec-local: $(noinst_PROGRAMS)
|
||||
@TMPFILE=$(DESTDIR)$(libexecdir)/.setuid-$$$$; \
|
||||
rm -f $$TMPFILE; \
|
||||
echo > $$TMPFILE; \
|
||||
can_create_suid_root_executable=no; \
|
||||
chown root $$TMPFILE > /dev/null 2>&1 \
|
||||
&& chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
|
||||
&& can_create_suid_root_executable=yes; \
|
||||
rm -f $$TMPFILE; \
|
||||
if test $$can_create_suid_root_executable = yes; then \
|
||||
$(INSTALL_SUID); \
|
||||
else \
|
||||
echo "WARNING: insufficient access; not installing setuid plugins"; \
|
||||
echo "NOTE: to install setuid plugins, run 'make install-root' as root"; \
|
||||
fi
|
||||
# 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:
|
1289
plugins-root/check_dhcp.c
Normal file
1289
plugins-root/check_dhcp.c
Normal file
File diff suppressed because it is too large
Load diff
1250
plugins-root/check_icmp.c
Normal file
1250
plugins-root/check_icmp.c
Normal file
File diff suppressed because it is too large
Load diff
252
plugins-root/pst3.c
Normal file
252
plugins-root/pst3.c
Normal file
|
@ -0,0 +1,252 @@
|
|||
/* pst3.c
|
||||
*
|
||||
* Third version to get process arg info; this time by using
|
||||
* a combination of reading the /proc/<pid>/psinfo structures
|
||||
* and reading the complete arg vector from kernel memory structures.
|
||||
*
|
||||
* Developed and tested under Solaris 5.8 (both 32 and 64 bit modes).
|
||||
*
|
||||
* NOTE: This program must be setuid-root (or run by root) to work!
|
||||
*
|
||||
* Written: 2005-04-28 R.W.Ingraham
|
||||
*/
|
||||
|
||||
|
||||
#define _KMEMUSER 1
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <procfs.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define PROC_DIR "/proc"
|
||||
#define MAX_PATH 1024
|
||||
|
||||
|
||||
/*
|
||||
* Structures
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
|
||||
static char * szProg;
|
||||
static kvm_t * kd;
|
||||
static struct proc * pProc;
|
||||
static struct user * pUser;
|
||||
static char ** myArgv;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
static int HandleFile (struct dirent *pDent);
|
||||
static int HandlePsInfo (char *szPath, psinfo_t *pPsInfo);
|
||||
static int GetArgVectors (pid_t pid);
|
||||
static void ShowArgVectors (void);
|
||||
static void ReleaseArgVectors();
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
DIR *pDir;
|
||||
struct dirent *pDent;
|
||||
int retcode = 0;
|
||||
|
||||
|
||||
/* Set our program name global */
|
||||
if ((szProg = strrchr(argv[0], '/')) != NULL)
|
||||
szProg++;
|
||||
else
|
||||
szProg = argv[0];
|
||||
|
||||
/* Make sure that our euid is root */
|
||||
if (geteuid() != 0)
|
||||
{
|
||||
fprintf(stderr, "%s: This program can only be run by the root user!\n", szProg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Get a handle to the running kernel image */
|
||||
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, argv[0])) == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: Failed to open kernel memory: %s\n", szProg, strerror(errno));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* Open the /proc directory */
|
||||
if ((pDir = opendir(PROC_DIR)) != NULL)
|
||||
{
|
||||
/* Display column headings */
|
||||
printf("S UID PPID VSZ RSS %%CPU COMMAND ARGS\n");
|
||||
|
||||
/* Zip through all of the process entries */
|
||||
while ((pDent = readdir(pDir)) != NULL)
|
||||
{
|
||||
/* Handle each pid sub-directory */
|
||||
HandleFile(pDent);
|
||||
}
|
||||
|
||||
/* Close the directory */
|
||||
closedir(pDir);
|
||||
}
|
||||
else /* ERROR: Failure to open PROC_DIR */
|
||||
{
|
||||
fprintf(stderr, "%s: Failed to open \"%s\": %s\n", szProg, PROC_DIR, strerror(errno));
|
||||
retcode = 3;
|
||||
}
|
||||
|
||||
/* Close the handle to the running kernel image */
|
||||
kvm_close(kd);
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static int HandleFile (struct dirent *pDent)
|
||||
{
|
||||
char szPath[MAX_PATH];
|
||||
psinfo_t sPsInfo;
|
||||
int fd, len;
|
||||
int rc = 0;
|
||||
|
||||
/* Skip files beginning with a "." */
|
||||
if (pDent->d_name[0] == '.')
|
||||
return 0;
|
||||
|
||||
/* Cosntruct the path to the psinfo file */
|
||||
len = sprintf(szPath, "%s/%s/psinfo", PROC_DIR, pDent->d_name);
|
||||
|
||||
/* Open the psinfo file for this pid and print out its arg vectors */
|
||||
if ((fd = open(szPath, O_RDONLY)) >= 0)
|
||||
{
|
||||
/* Read the psinfo struct */
|
||||
if ((len = read(fd, &sPsInfo, sizeof(sPsInfo))) != sizeof(sPsInfo))
|
||||
{
|
||||
rc = errno;
|
||||
fprintf(stderr, "%s: Read error of psinfo structure (%d)\n", szPath, len);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Close the psinfo file */
|
||||
close(fd);
|
||||
|
||||
/* Pass psinfo struct to reporting function */
|
||||
HandlePsInfo(szPath, &sPsInfo);
|
||||
}
|
||||
else if (errno != ENOENT)
|
||||
{
|
||||
rc = errno;
|
||||
fprintf(stderr, "%s: %s\n", szPath, strerror(errno));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static int HandlePsInfo (char *szPath, psinfo_t *pPsInfo)
|
||||
{
|
||||
int retcode;
|
||||
char *thisProg;
|
||||
|
||||
/* Make sure that the process is still there */
|
||||
if ((retcode = GetArgVectors(pPsInfo->pr_pid)) == 0)
|
||||
{
|
||||
/* We use the program name from the kvm argv[0] instead
|
||||
* of pr_fname from the psinfo struct because pr_fname
|
||||
* may be truncated.
|
||||
*
|
||||
* Also, strip-off leading path information.
|
||||
*/
|
||||
if ((thisProg = strrchr(myArgv[0], '/')) != NULL)
|
||||
thisProg++;
|
||||
else
|
||||
thisProg = myArgv[0];
|
||||
|
||||
/* Display the ps columns (except for argv) */
|
||||
printf("%c %5d %5d %6lu %6lu %4.1f %s ",
|
||||
pPsInfo->pr_lwp.pr_sname,
|
||||
(int)(pPsInfo->pr_euid),
|
||||
(int)(pPsInfo->pr_ppid),
|
||||
(unsigned long)(pPsInfo->pr_size),
|
||||
(unsigned long)(pPsInfo->pr_rssize),
|
||||
((float)(pPsInfo->pr_pctcpu) / 0x8000 * 100.0),
|
||||
thisProg);
|
||||
|
||||
/* Display the arg vectors associated with this pid */
|
||||
ShowArgVectors();
|
||||
|
||||
/* Release the arg vector buffer memory */
|
||||
ReleaseArgVectors();
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static int GetArgVectors (pid_t pid)
|
||||
{
|
||||
int retcode = 1;
|
||||
|
||||
/* Get the proc structure for the specified PID */
|
||||
if ((pProc = kvm_getproc(kd, pid)) != NULL)
|
||||
{
|
||||
/* Save a copy of the process' u-area */
|
||||
if ((pUser = kvm_getu(kd, pProc)) != NULL)
|
||||
{
|
||||
/* Reconstruct the process' argv vector array */
|
||||
if (kvm_getcmd(kd, pProc, pUser, &myArgv, NULL) == 0)
|
||||
{
|
||||
retcode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static void ShowArgVectors (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; myArgv[i]; i++)
|
||||
{
|
||||
printf(" %s", myArgv[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static void ReleaseArgVectors()
|
||||
{
|
||||
/* NOOP */
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
Loading…
Add table
Add a link
Reference in a new issue