...
 
Commits (666)
......@@ -2,6 +2,7 @@
*.o
*.so
*.swp
*.trs
.deps
.libs
.version
......@@ -19,6 +20,7 @@ config.rpath
config.status
config.sub
configure
cov-int
depcomp
free
INSTALL
......@@ -50,6 +52,7 @@ slabtop
snice
stamp-h1
sysctl
test-driver
tload
top/Makefile
top/Makefile.in
......@@ -61,3 +64,5 @@ watch
*~
*.log
*.sum
*.exe
*.mo
# This file is generated by GitLab CI
Testsuites:
before_script:
- apt-get update -qq && apt-get install -y -qq autopoint autoconf automake libtool-bin gettext libncursesw5-dev dejagnu libnuma-dev libsystemd-dev
MakeCheck:
script:
- "./autogen.sh"
- "./configure"
- make
- make check
- make clean
tags:
except:
- tags
- "./autogen.sh"
- "./configure"
- make
- make check
- make clean
CYGWINFLAGS =
if CYGWIN
CYGWINFLAGS += -lintl
usrbin_exec_PROGRAMS =
endif
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir) \
-I$(top_srcdir)/include \
-DLOCALEDIR=\"$(localedir)\"
-DLOCALEDIR=\"$(localedir)\" \
@HARDEN_CFLAGS@
AM_LDFLAGS = @HARDEN_LDFLAGS@
PACKAGE_VERSION = @PACKAGE_VERSION@
......@@ -14,10 +23,23 @@ SUBDIRS = \
testsuite
AM_CFLAGS = -Iproc
LDADD = ./proc/libprocps.la
LDADD = ./proc/libprocps.la $(CYGWINFLAGS)
if CYGWIN
AM_LDFLAGS += ./proc/libprocps.la $(CYGWINFLAGS)
endif
transform = s/pscommand/ps/; $(program_transform_name)
transform =
if !CYGWIN
transform += s/pscommand/ps/; $(program_transform_name)
sbin_PROGRAMS = \
sysctl
else
transform += s/pscommand/procps/; $(program_transform_name)
endif
if !CYGWIN
bin_PROGRAMS = \
ps/pscommand \
free \
......@@ -29,9 +51,17 @@ bin_PROGRAMS = \
uptime \
vmstat \
w
sbin_PROGRAMS = \
sysctl
else
usrbin_exec_PROGRAMS += \
ps/pscommand \
free \
pgrep \
pkill \
pmap \
uptime \
vmstat \
w
endif
lib_LTLIBRARIES = \
proc/libprocps.la
......@@ -41,14 +71,30 @@ dist_man_MANS = \
pgrep.1 \
pkill.1 \
pmap.1 \
pwdx.1 \
sysctl.8 \
sysctl.conf.5 \
tload.1 \
uptime.1 \
vmstat.8 \
w.1 \
doc/libproc.3 \
doc/procps_linux_version.3 \
doc/procps_pids_new.3 \
doc/procps_pids_reap.3 \
doc/procps_pids_ref.3 \
doc/procps_pids_reset.3 \
doc/procps_pids_select.3 \
doc/procps_pids_sort.3 \
doc/procps_pids_unref.3 \
doc/procps_uptime.3 \
doc/procps_uptime_sprint.3 \
doc/procps_uptime_sprint_short.3
if !CYGWIN
dist_man_MANS += \
pwdx.1 \
tload.1 \
sysctl.8 \
sysctl.conf.5 \
ps/ps.1
endif
EXTRA_DIST = \
.version \
......@@ -58,18 +104,26 @@ EXTRA_DIST = \
misc/git-version-gen \
Documentation/CodingStyle.md \
Documentation/TODO \
sysctl.conf \
ps/HACKING \
ps/regression \
$(DIST_MAN_POTS)
if !CYGWIN
EXTRA_DIST += \
sysctl.conf
endif
procpsngdir = $(docdir)
dist_procpsng_DATA = \
Documentation/bugs.md \
Documentation/FAQ
if BUILD_PIDOF
if !CYGWIN
bin_PROGRAMS += pidof
else
usrbin_exec_PROGRAMS += pidof
endif
dist_man_MANS += pidof.1
pidof_SOURCES = pidof.c lib/fileutils.c
else
......@@ -77,41 +131,69 @@ else
endif
if BUILD_KILL
if CYGWIN
transform += ;s/^kill/prockill/; $(program_transform_name)
usrbin_exec_PROGRAMS += kill
else
bin_PROGRAMS += kill
endif
dist_man_MANS += kill.1
kill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c
kill_SOURCES = kill.c lib/strutils.c lib/fileutils.c lib/signals.c
kill_LDADD =
else
EXTRA_DIST += kill.1
endif
if WITH_NCURSES
if !CYGWIN
bin_PROGRAMS += \
slabtop \
watch \
top/top
else
usrbin_exec_PROGRAMS += \
watch \
top/top
endif
dist_man_MANS += \
slabtop.1 \
watch.1 \
top/top.1
if !CYGWIN
bin_PROGRAMS += \
slabtop
dist_man_MANS += \
slabtop.1
slabtop_SOURCES = slabtop.c lib/strutils.c lib/fileutils.c
slabtop_LDADD = $(LDADD) @NCURSES_LIBS@
endif
watch_SOURCES = watch.c lib/strutils.c lib/fileutils.c
watch_LDADD = @WATCH_NCURSES_LIBS@
watch_LDADD = @WATCH_NCURSES_LIBS@ $(CYGWINFLAGS)
top_top_SOURCES = \
top/top.h \
top/top.c \
top/top_nls.h \
top/top_nls.c \
lib/fileutils.c
lib/fileutils.c \
lib/signals.c
if CYGWIN
top_top_SOURCES += lib/strverscmp.c
endif
top_top_LDADD = $(LDADD) @NCURSES_LIBS@ $(DL_LIB)
endif
if BUILD_SKILL
if !CYGWIN
bin_PROGRAMS += \
skill \
snice
skill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c
snice_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c
else
usrbin_exec_PROGRAMS += \
skill \
snice
endif
skill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/signals.c
snice_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/signals.c
dist_man_MANS += \
skill.1 \
snice.1
......@@ -122,12 +204,18 @@ else
endif
free_SOURCES = free.c lib/strutils.c lib/fileutils.c
pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
pgrep_SOURCES = pgrep.c lib/fileutils.c lib/signals.c
pkill_SOURCES = pgrep.c lib/fileutils.c lib/signals.c
pmap_SOURCES = pmap.c lib/fileutils.c
if !CYGWIN
pwdx_SOURCES = pwdx.c lib/fileutils.c
pwdx_LDADD=
sysctl_SOURCES = sysctl.c lib/fileutils.c
pwdx_LDADD= $(CYGWINFLAGS)
sysctl_SOURCES = \
sysctl.c \
lib/fileutils.c \
lib/procio.c
sysctl_LDADD=
endif
tload_SOURCES = tload.c lib/strutils.c lib/fileutils.c
uptime_SOURCES = uptime.c lib/fileutils.c
vmstat_SOURCES = vmstat.c lib/strutils.c lib/fileutils.c
......@@ -136,9 +224,9 @@ w_SOURCES = w.c lib/fileutils.c
# proc/libprocps.la
# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
LIBprocps_CURRENT=5
LIBprocps_CURRENT=7
LIBprocps_REVISION=0
LIBprocps_AGE=0
LIBprocps_AGE=1
proc_libprocps_la_LIBADD = $(LIB_KPARTS)
......@@ -152,50 +240,62 @@ proc_libprocps_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/proc/libprocps.sym
proc_libprocps_la_SOURCES = \
proc/alloc.c \
proc/alloc.h \
proc/devname.c \
proc/devname.h \
proc/diskstats.c \
proc/diskstats.h \
proc/escape.c \
proc/escape.h \
proc/procps-private.h \
proc/meminfo.c \
proc/meminfo.h \
proc/namespace.c \
proc/namespace.h \
proc/numa.c \
proc/numa.h \
proc/pids.c \
proc/pids.h \
proc/procps.h \
proc/pwcache.c \
proc/pwcache.h \
proc/readproc.c \
proc/readproc.h \
proc/sig.c \
proc/sig.h \
proc/slab.c \
proc/slab.h \
proc/slabinfo.c \
proc/slabinfo.h \
proc/stat.c \
proc/stat.h \
proc/sysinfo.c \
proc/sysinfo.h \
proc/version.c \
proc/version.h \
proc/vmstat.c \
proc/vmstat.h \
proc/wchan.c \
proc/wchan.h \
proc/whattime.c \
proc/whattime.h
proc/uptime.c \
proc/uptime.h \
proc/xtra-procps-debug.h
proc_libprocps_la_includedir = $(includedir)/proc/
proc_libprocps_la_include_HEADERS = \
proc/alloc.h \
proc/devname.h \
proc/diskstats.h \
proc/escape.h \
proc/meminfo.h \
proc/namespace.h \
proc/numa.h \
proc/pids.h \
proc/procps.h \
proc/pwcache.h \
proc/readproc.h \
proc/sig.h \
proc/slab.h \
proc/slabinfo.h \
proc/stat.h \
proc/sysinfo.h \
proc/uptime.h \
proc/version.h \
proc/vmstat.h \
proc/wchan.h \
proc/whattime.h
dist_man_MANS += \
proc/openproc.3 \
proc/readproc.3 \
proc/readproctab.3
proc/xtra-procps-debug.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
......@@ -215,30 +315,68 @@ ps_pscommand_SOURCES = \
ps/select.c \
ps/sortformat.c \
ps/stacktrace.c \
lib/fileutils.c
lib/fileutils.c \
lib/signals.c
# lib/test_* binaries
# Test programs required for dejagnu
noinst_PROGRAMS = \
lib/test_strutils \
lib/test_fileutils \
lib/test_nsutils \
lib/test_process
lib_test_strutils_SOURCES = lib/test_strutils.c lib/strutils.c
lib_test_strutils_LDADD =
lib_test_strutils_LDADD = $(CYGWINFLAGS)
lib_test_fileutils_SOURCES = lib/test_fileutils.c lib/fileutils.c
lib_test_fileutils_LDADD =
lib_test_nsutils_SOURCES = lib/test_nsutils.c lib/nsutils.c
lib_test_nsutils_LDADD =
lib_test_fileutils_LDADD = $(CYGWINFLAGS)
lib_test_process_SOURCES = lib/test_process.c
lib_test_process_LDADD =
lib_test_process_LDADD = $(CYGWINFLAGS)
proc_test_sysinfo_SOURCES = proc/test_sysinfo.c
proc_test_sysinfo_LDADD = proc/libprocps.la
proc_test_namespace_SOURCES = proc/test_namespace.c
proc_test_namespace_LDADD = proc/libprocps.la
proc_test_pids_SOURCES = proc/test_pids.c
proc_test_pids_LDADD = proc/libprocps.la
proc_test_uptime_SOURCES = include/tests.h proc/test_uptime.c
proc_test_uptime_LDADD = proc/libprocps.la
proc_test_version_SOURCES = include/tests.h proc/test_version.c
proc_test_version_LDADD = proc/libprocps.la
lib_test_strtod_nol_SOURCES = lib/test_strtod_nol.c lib/strutils.c
lib_test_strtod_nol_LDADD = $(CYGWINFLAGS)
if CYGWIN
skill_LDADD = $(CYGWINFLAGS)
kill_LDADD = $(CYGWINFLAGS)
free_LDADD = $(CYGWINFLAGS)
pgrep_LDADD = $(CYGWINFLAGS)
pkill_LDADD = $(CYGWINFLAGS)
pidof_LDADD = $(CYGWINFLAGS)
pmap_LDADD = $(CYGWINFLAGS)
snice_LDADD = $(CYGWINFLAGS)
tload_LDADD = $(CYGWINFLAGS)
uptime_LDADD = $(CYGWINFLAGS)
w_LDADD = $(CYGWINFLAGS)
vmstat_LDADD = $(CYGWINFLAGS)
endif
if EXAMPLE_FILES
if !CYGWIN
sysconf_DATA = sysctl.conf
endif
endif
BUILT_SOURCES = $(top_srcdir)/.version
# Test programs not used by dejagnu but run directly
TESTS = proc/test_sysinfo \
proc/test_pids \
proc/test_namespace \
proc/test_uptime \
proc/test_version \
lib/test_strtod_nol
check_PROGRAMS = $(TESTS)
$(top_srcdir)/.version:
touch $(top_srcdir)/.version
echo $(VERSION) > $@-t && mv $@-t $@
......
procps-ng-NEXT
procps-ng-3.3.14
----------------
* ps: sort by cgroup Debian #692279
* pgrep: Don't segfault on non match Debian #894917
* pgrep/pkill: Revert so matches all namespaces issue #91
* free: Fix scaling on 32-bit systems issue #89
* library: Build on non-glibc systems issue #88
* library: Just check for SIGLOST and don't delete it issue #93
procps-ng-3.3.13
----------------
* library: Increment to 7:0:1
No changes, no removals
New fuctions: numa_init, numa_max_node, numa_node_of_cpu,
numa_uninit, xalloc_err_handler
* doc: Document I idle state in ps.1 and top.1 Debian #886967
* free: fix some of the SI multiples issue #45
* kill: -l space between name parses correctly Debian #854407
* library: dont use vm_min_free on non Linux Debian #831396
* library: dont use SIGPWR on FreeBSD Debian #832148
* library: don't strip off wchan prefixes (ps & top) Redhat #1322111
* pgrep: warn about 15+ char name only if -f not used
* pgrep/pkill: only match in same namespace by default merge #41
* pidof: specify separator between pids merge #58
* pkill: Return 0 only if we can kill process Debian #852758
* pmap: fix duplicate output line under '-x' option Redhat #1374061
* ps: avoid eip/esp address truncations Debian #846361
* ps: recognizes SCHED_DEADLINE as valid CPU scheduler
* ps: display NUMA node under which a thread ran issue #58
* ps: Add seconds display for cputime and time merge #43
* ps: Add LUID field merge #57 Redhat #1518986
* sysctl: Permit empty string for value issue #74
* sysctl: Don't segv when file not available issue #76
* sysctl: Read and write large buffers merge #56
* top: add config file support for XDG specification
* top: eliminated minor libnuma memory leak
* top: show fewer memory decimal places (configurable) issue #50
* top: provide command line switch for memory scaling Redhat #1034466, issue #53
* top: provide command line switch for CPU States issue #55
* top: provides more accurate cpu usage at startup Redhat #1182327
* top: display NUMA node under which a thread ran issue #58
* top: fix argument parsing quirk resulting in SEGV Redhat #1450429
* top: delay interval accepts non-locale radix point Redhat #1182248
* top: address a wishlist man page NLS suggestion Debian #865689
* top: fix potential distortion in 'Mem' graph display issue #64
* top: provide proper multi-byte string handling issue #68
* top: startup defaults are fully customizable Redhat #1153049, #1499410, issues #6, #78
* see man page 6c. SYSTEM Configuration File
* watch: define HOST_NAME_MAX where not defined Debian #830734
* vmstat: Fix alignment for disk partition format issue #69
* watch: Support ANSI 39,49 reset sequences issue #73
procps-ng-3.3.12
----------------
* libprocps API 6:0:0
* build: formerly optional --enable-oomem unconditional
* free: man document rewritten for shared Debian #755233
* free: interpret intervals in non-locale way Debian #692113
* kill: report error if cannot kill process Debian #733172
* library: refine calculation of 'cached' memory
* library: find tty quicker Debian #770215
* library: eliminate threads display inconsistencies Redhat #1284091
* pidof: check cmd if space found in argv0
* pmap: fixed detail parsing on long mapping lines
* pmap: fix occasional incorrect memory usage values Redhat #1262864
* ps: sort by cgroup Debian #692279
* ps: display control group name with -o cgname
* ps: fallback to attr/current for context Debian #786956
* ps: enabled broken 'thcount' option Redhat #1174313
* tests: conditionally add prctl Debian #816237
* top: displays the 3 new linux-4.5 RES memory fields
* top: man page memory fields corrected + new narrative
* top: added display of CGNAME (control group name)
* top: is now more responsive to cpus brought online
* top: namespace cols use suppressible zero
* top: zero suppress ('0') includes out-of-memory & nice
* top: better 'i' toggle management when scrolled
* top: the '=' key now includes active locate requests
* vmstat: devices exceeding 15 chars now displayed Redhat #586078
* watch: hostname added to header
* watch: better handling ANSI including esc[m Debian #830313
* watch: use locale-independent float Debian #692113
procps-ng-3.3.11
----------------
......
......@@ -49,4 +49,4 @@ page.
The email list for the developers and users of procps is found at
http://www.freelists.org/archive/procps/
This email list discusses the development of procps and is used by distributions
to also forward or discuss bugs.
\ No newline at end of file
to also forward or discuss bugs.
......@@ -12,7 +12,8 @@ AC_CONFIG_SRCDIR([free.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_USE_SYSTEM_EXTENSIONS(_GNU_SOURCE)
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CC_STDC
......@@ -43,7 +44,7 @@ AC_PROG_MAKE_SET
# Checks for header files.
AC_HEADER_MAJOR
AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h libintl.h limits.h locale.h netinet/in.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h values.h wchar.h wctype.h])
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h values.h wchar.h wctype.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
......@@ -66,8 +67,30 @@ AC_FUNC_MALLOC
AC_FUNC_MBRTOWC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRCOLL
AC_FUNC_STRTOD
usrbin_execdir='${exec_prefix}/bin'
AC_SUBST([usrbin_execdir])
if test "x$host_os" = xcygwin
then
prefix=/usr
sysconfdir='${prefix}/etc'
libexecdir='${prefix}/lib'
localstatedir='${prefix}/var'
datadir='${prefix}/share'
mandir='${prefix}/share/man'
infodir='${prefix}/share/info'
AC_SUBST([prefix])
AC_SUBST([sysconfdir])
AC_SUBST([libexecdir])
AC_SUBST([localstatedir])
AC_SUBST([datadir])
AC_SUBST([mandir])
AC_SUBST([infodir])
fi
AM_GNU_GETTEXT_VERSION([0.14.1])
AM_GNU_GETTEXT([external])
if test -d "$srcdir/po"
......@@ -115,6 +138,29 @@ if test "$enable_libselinux" = "yes"; then
AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
fi
# Enable hardened compile and link flags
AC_ARG_ENABLE([harden_flags],
[AS_HELP_STRING([--enable-harden-flags], [enable hardened compilier and linker flags])],
[enable_harden_flags=$enableval],
[enable_harden_flags="no"])
# Check that harden CFLAGS and LDFLAGS will compile
AS_IF([test "$enable_harden_flags" = "yes"],
HARDEN_CFLAGS="-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security"
[HARDEN_LDFLAGS="-fPIE -pie -Wl,-z,relro -Wl,-z,now"]
[ AC_MSG_CHECKING([compiler supports harden flags])
save_harden_cflags="$CFLAGS"
CFLAGS="$CFLAGS $HARDEN_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,,)],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); HARDEN_CFLAGS='']
)
CFLAGS="$save_harden_cflags"],
[HARDEN_CFLAGS=""
HARDEN_LDFLAGS=""])
AC_SUBST([HARDEN_CFLAGS])
AC_SUBST([HARDEN_LDFLAGS])
# Optional packages - AC_ARG_WITH
AC_ARG_WITH([ncurses],
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
......@@ -167,6 +213,7 @@ AC_ARG_ENABLE([kill],
)
AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu)
AM_CONDITIONAL(CYGWIN, test "x$host_os" = xcygwin)
AC_ARG_ENABLE([skill],
AS_HELP_STRING([--enable-skill], [build skill and snice]),
......@@ -180,14 +227,6 @@ AC_ARG_ENABLE([examples],
)
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
AC_ARG_ENABLE([oomem],
AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]),
[], [enable_oomem=no]
)
if test "x$enable_oomem" = xyes; then
AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top])
fi
AC_ARG_ENABLE([sigwinch],
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
[], [enable_sigwinch=no]
......@@ -205,11 +244,11 @@ if test "x$enable_wide_percent" = xyes; then
fi
AC_ARG_ENABLE([wide-memory],
AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]),
[], [enable_wide_memory=yes]
AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
[], [enable_wide_memory=no]
)
if test "x$enable_wide_memory" = xno; then
AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
fi
AC_ARG_ENABLE([modern-top],
......@@ -258,7 +297,7 @@ then
fi
AC_SUBST(DEJAGNU)
AC_CHECK_FUNCS([__fpending alarm atexit dup2 getpagesize gettimeofday iswprint memchr memmove memset munmap nl_langinfo putenv regcomp rpmatch select setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul strtoull strverscmp uname utmpname wcwidth])
AC_CHECK_FUNCS([__fpending alarm atexit dup2 gethostname getpagesize gettimeofday iswprint memchr memmove memset nl_langinfo putenv regcomp rpmatch select setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strspn strstr strtol strtoul strverscmp utmpname wcwidth])
AC_CONFIG_FILES([Makefile
include/Makefile
......
......@@ -11,6 +11,8 @@ if [ -d man-po ] ; then
mkdir -p man-po
fi
PO_FILES="man-po/*.po"
po4a-updatepo -f man -m ${SRCDIR}/free.1 \
-m ${SRCDIR}/kill.1 \
-m ${SRCDIR}/pgrep.1 \
......@@ -28,7 +30,7 @@ po4a-updatepo -f man -m ${SRCDIR}/free.1 \
-m ${SRCDIR}/vmstat.8 \
-m ${SRCDIR}/w.1 \
-m ${SRCDIR}/watch.1 \
-p man-po/template-man.pot
-p man-po/template-man.pot ${PO_FILES}
po4a-updatepo -f man -m ${SRCDIR}/ps/ps.1 \
-p man-po/template-man-ps.pot
......
.\" t
.\" (C) Copyright 2016-2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH LIBPROC 3 2016-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
libproc \-
Miscelleanous information about libproc
.SH SYNOPSIS
.B #include <proc/procps.h>
Link with \fI\-lprocps\fR.
.SH DESCRIPTION
This manual describes some of the anciallary information about the
libproc library.
.SS PID FETCH TYPE
The enum \fIpids_fetch_type\fR is used by the functions \fBprocps_pids_get\fR
and \fB procps_pids_reap\fR to determine if the only the process information
should be collected or the thread information as well.
.TS
lB l l.
PIDS_FETCH_TASKS_ONLY Only collect task (process) information
PIDS_FETCH_THREADS_TOO Collect both task and thread information
.TE
.SS PIDS COUNT
The \fBpids_count\fR structure shows some overall count of
processes in various states. Note that if you use
.BR procps_pids_select (3)
then the counts are for the matching processes only.
The structure is a series of integers and have the following
members.
The following information is found in the structure:
.PP
.in +4n
.nf
struct pids_counts {
int total; /* total number of processes */
int running; /* processes running in R state */
int sleeping; /* processes sleeping in S or D state */
int stopped; /* processes stopped in T state */
int zombied; /* zombie processes in Z state */
};
.fi
.in
.SS PIDS FETCH
This is the structure returned by \fBprocps_pids_reap\fR(3) and
\fBprocps_pids_select\fR(3) and contains a \fBPIDS STACK\fR and
some count information.
.PP
.in +4n
.nf
struct pids_fetch {
struct pids_counts *counts; /* Overall process counts */
struct pids_stack **stacks; /* Detailed process information */
};
.fi
.in
.SS PID ITEMS
The enum \fIpids_item\fR is used by the functions
.BR procps_pids_new (3),
.BR procps_pids_reset "(3) and"
.BR procps_pids_sort (3).
The following items can be fetched for a process:
.TS
l l l
---
lB l l.
Item Type Description
PIDS_ADDR_END_CODE ul_int The address below which program text can run
PIDS_ADDR_KSTK_EIP ul_int Instruction pointer
PIDS_ADDR_KSTK_ESP ul_int Stack pointer
PIDS_ADDR_START_CODE ul_int The address above which program text can run
PIDS_ADDR_START_STACK ul_int Address of the start (bottom) of the stack
PIDS_ALARM sl_int ??
PIDS_CGNAME str The name of the control group for the process
PIDS_CGROUP str List of control groups
PIDS_CGROUP_V strv List of control groups
PIDS_CMD str Command name (only the executable name)
PIDS_CMDLINE str Full command line
PIDS_CMDLINE_V strv Full command line
PIDS_ENVIRON str The process environment
PIDS_ENVIRON_V strv The process environment
PIDS_EXIT_SIGNAL s_int Signal sent to parent when this process dies
PIDS_FLAGS ul_int Process flags
PIDS_FLT_MAJ ul_int Number of major page faults
PIDS_FLT_MAJ_C ul_int Cumulative major page faults
PIDS_FLT_MAJ_DELTA ul_int Number of major page faults since last fetch
PIDS_FLT_MIN ul_int Number of minor page faults
PIDS_FLT_MIN_C ul_int Culmative minor page faults
PIDS_FLT_MIN_DELTA ul_int Number of minor page faults since last fetch
PIDS_ID_EGID u_int Effective group ID number
PIDS_ID_EGROUP str Effective group name
PIDS_ID_EUID u_int Effective user ID number
PIDS_ID_EUSER str Effective user name
PIDS_ID_FGID u_int File system access group ID number
PIDS_ID_FGROUP str File system access group name
PIDS_ID_FUID u_int File system access user ID number
PIDS_ID_FUSER str File system access user name
PIDS_ID_PGRP s_int Process group ID, or process ID of group leader
PIDS_ID_PID s_int Proccess ID number
PIDS_ID_PPID s_int Process ID number of parent
PIDS_ID_RGID u_int Real group ID number
PIDS_ID_RGROUP str Real group name
PIDS_ID_RUID u_int Real user ID number
PIDS_ID_RUSER str Real user name
PIDS_ID_SESSION s_int Session ID number, or process ID of session leader
PIDS_ID_SGID u_int Saved group ID number
PIDS_ID_SGROUP str Saved group name
PIDS_ID_SUID u_int Saved user ID number
PIDS_ID_SUSER str Saved user nameSaved user name
PIDS_ID_TGID s_int Thread group ID number, or process ID of thread group leader
PIDS_ID_TPGID s_int Process ID of foreground process group on the tty
PIDS_LXCNAME str Linux container name
PIDS_MEM_CODE sl_int Memory size for code, measured in KiB
PIDS_MEM_CODE_PGS ul_int Memory size for code, measured in pages
PIDS_MEM_DATA sl_int Memory size for data + stack, measued in KiB
PIDS_MEM_DATA_PGS ul_int Memory size for data + stack, measured in pages
PIDS_MEM_RES sl_int Resident set size, measured in KiB
PIDS_MEM_RES_PGS ul_int Resident set size, measured in pages
PIDS_MEM_SHR sl_int Shared memory, measured in KiB
PIDS_MEM_SHR_PGS ul_int Shared memory, measured in pages
PIDS_MEM_VIRT sl_int Virtual memory, measured in KiB
PIDS_MEM_VIRT_PGS ul_int Virtual memory, measured in pages
PIDS_NICE sl_int Nice value
PIDS_NLWP s_int Number of lwps (threads) in the process
PIDS_NS_IPC ul_int Current IPC namespace
PIDS_NS_MNT ul_int Current mount namespace
PIDS_NS_NET ul_int Current network namespace
PIDS_NS_PID ul_int Current PID namespace
PIDS_NS_USER ul_int Current user namespace
PIDS_NS_UTS ul_int Current UTC namespace
PIDS_OOM_ADJ s_int Out Of Memory Adjust
PIDS_OOM_SCORE s_int Process Out Of Memory Score
PIDS_PRIORITY s_int Kernel scheduling priority
PIDS_PROCESSOR u_int Current CPU the process is running on
PIDS_RSS ul_int Resident set size
PIDS_RSS_RLIM ul_int Soft limit of RSS in bytes
PIDS_RTPRIO s_int Realtime priority
PIDS_SCHED_CLASS s_int Scheduling class, see \fBsched\fR(7)
PIDS_SD_MACH str Systemd machine name
PIDS_SD_OUID str Systemd owner user ID
PIDS_SD_SEAT str Systemd seat
PIDS_SD_SESS str Systemd session
PIDS_SD_SLICE str Systemd slice
PIDS_SD_UNIT str Systemd unit
PIDS_SD_UUNIT str Systemd user unit
PIDS_SIGBLOCKED str Bitmap of blocked signals
PIDS_SIGCATCH str Bitmap of caught signals
PIDS_SIGIGNORE str Bitmap of ignored signals
PIDS_SIGNALS str Bitmap of pending signals
PIDS_SIGPENDING str Bitmap of pending signals
PIDS_STATE s_ch Process state codes
PIDS_SUPGIDS str IDs of the supplementary groups
PIDS_SUPGROUPS str Name of the supplementary groups
PIDS_TICS_ALL ull_int Sum of user and system time
PIDS_TICS_ALL_C ull_int Cumulative sum of user and system time
PIDS_TICS_ALL_DELTA s_int Difference of sum of user and system time since last fetch
PIDS_TICKS_BLKIO s_int Aggregated block I/O delays
PIDS_TICS_GUEST ull_int Amount of time process has been in guest mode in ticks
PIDS_TICS_GUEST_C ull_int Guest time of the process's children
PIDS_TICS_SYSTEM ull_int Amount of time process has been in system mode in ticks
PIDS_TICS_SYSTEM_C ull_int System time of the process's children
PIDS_TICS_USER ull_int Amount of time process has been scheduled in user mode in ticks
PIDS_TICS_USER_C ull_int ??
PIDS_TIME_ALL ull_int ??
PIDS_TIME_ELAPSED ull_int Total seconds since process started
PIDS_TIME_START ull_int Time the process started
PIDS_TTY s_int Controlling terminal ID number
PIDS_TTY_NAME str Controlling terminal name
PIDS_TTY_NUMBER str Controlling terminal number
PIDS_VM_DATA ul_int Size of data segment
PIDS_VM_EXE ul_int Size of text segment
PIDS_VM_LIB ul_int Shared library code size
PIDS_VM_LOCK ul_int Locked memory size, see \fBmlock\fR(3)
PIDS_VM_RSS ul_int Resident set size
PIDS_VM_RSS_ANON ul_int Resident anonymous memory
PIDS_VM_RSS_FILE ul_int Resident file mappings
PIDS_VM_RSS_LOCKED ul_int Locked memory size
PIDS_VM_RSS_SHARED ul_int Resident shared memory
PIDS_VM_SIZE ul_int Virtual memory size
PIDS_VM_STACK ul_int Size of stack segment
PIDS_VM_SWAP ul_int Swapped out virtual memory size by anonymous pages
PIDS_VM_USED ul_int Used memory, sum of PIDS_VM_SWAP and PIDS_VM_RSS
PIDS_VSIZE_PGS ul_int Virtual memory size, measured in pages
PIDS_WCHAN_NAME str Name of the kernel function in which the process is sleeping.
.TE
.SS PIDS STACK
The structure \fIstruct pids_stack\fR is a stack or list of information
about a particular process found in another structure \fIpids_result\fR.
The \fIpids_result\fR structure containts the following information:
.PP
.in +4n
.nf
struct pids_result {
enum pids_item item;
union {
signed char s_ch;
signed int s_int;
unsigned int u_int;
unsigned long ul_int;
unsigned long long ull_int;
char *str;
char **strv;
} result;
};
.fi
.in
To extract the values out of the stack, the
macro \fBPROCPS_PIDS_VAL\fR is used the following way
.PP
.RI \fBPROCPS_PIDS_VAL\fR( index , type , stack )
where:
.TP
.I index
is the index of the \fIitems\fR defined with the function
.BR procps_pids_new (3)
.TP
.I type
type for returned value, see type column in \fBPID ITEMS\fR table.
.TP
.I stack
is the stack returned by \fBprocps_pids_get()\fR. It is also can be
accessed from the \fIpids_fetch\fR structure which is returned by
\fBprocps_pids_reap\fR.
.SH SEE ALSO
.BR mlock (3),
.BR proc (5),
.BR sched (7),
.BR user_namespaces (7).
.\" (C) Copyright 2016 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_LINUX_VERSION 3 2016-05-01 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_linux_version \-
provide current version of Linux as an integer
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.B int procps_linux_version(void);
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
The function
.BR procps_linux_version ()
returns the current Linux version as an integer. On non-Linux systems that
have an emulated proc filesystem this function returns the version of the
Linux emulation instead.
The Linux version consists of a triple of positive integers representing
the major, minor and patch versions of the kernel.
.PP
The library provides 3 macros for separating out the components.
.RS 4
.TP 1.2i
.BR LINUX_VERSION_MAJOR (ver)
Extract the major component from the given version integer.
.TP
.BR LINUX_VERSION_MINOR (ver)
Extract the minor component from the given version integer.
.TP
.BR LINUX_VERSION_PATCH (ver)
Extract the patch component from the given version integer.
.RE
.PP
To encode a given Linux version, such as using it to compare against the current
version, use the following macro:
.TP
.BI LINUX_VERSION( major , minor , patch )
.SH RETURN VALUE
The
.BR procps_linux_version ()
returns a positive integer encoding the Linux version if successful. Otherwise
returns a negative integer to one of the values defined below.
.TP
.B -EIO
The procps library was unable to read the osrelease file.
.TP
.B -ERANGE
Unable to parse the osrelease file.
.PP
.BR procps_linux_version ()
may also return any (negated) value that \fBfopen\fR() may set errno to.
.SH FILES
.TP
.I /proc/sys/kernel/osrelease
Contains the release version of the Linux kernel or proc filesystem.
.SH VERSIONS
.B procps_linux_version()
first appeared in libproc-2 version 0.0.
.SH BUGS
Due to the way the three numbers are encoded into a single integer,
.BR procps_linux_version ()
and the associated macros assume 255 for the maximum value for the
minor and patch level and 32767 (hex 0x7fff) for the maximum value
for the major version. In other words, when Linux v 32768.0.0 comes
out, this function will break.
.\" Maj/6yr - In 7452 we'll think of something
.SH SEE ALSO
.BR fopen (3),
.BR proc (5).
.\" (C) Copyright 2016-2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_NEW 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_new \-
Create a PID information structure
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "int procps_pids_new(struct pids_info **" info ", enum pids_item *" items ", int " numitems ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
.BR procps_pids_new ()
creates a new PID information structure that be used in subsequent calls to
.BR procps_pids_get (3),
.BR procps_pids_reap (3),
.BR procps_pids_reset (3),
.BR procps_pids_select (3),
.BR procps_pids_sort (3).
functions. The pointer to \fIinfo\fR will have memory allocated and a structure
created.
\fIitems\fR is an array of enums up to \fInumitems\fR long that selects what
information about the processed will be stored. \fInumitems\fR is used to
allocate memory and must be at least the length of \fIitems\fR but can be more.
For information about what \fIitems\fR can contain, see the \fBPID ITEMS\fR
section in
.BR libproc (3).
Once the structure is no longer required,
.BR procps_pids_unref (3)
should be used to free it.
.SH RETURN VALUE
The function returns 0 on success and one of negative values below
on failure.
.TP
.B -EINVAL
One of the given parameters is incorrect.
.TP
.B -ENOMEM
Unable to allocate memory for the structure.
.SH VERSIONS
.B procps_pids_new()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_reap (3),
.BR procps_pids_reset (3),
.BR procps_pids_select (3),
.BR procps_pids_sort (3),
.BR procps_pids_unref (3),
.BR proc (5).
.\" (C) Copyright 2016-2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_REAP 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_reap \- Harvest all the PIDS information structure.
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "struct pids_fetch * procps_pids_reap(struct pids_info *" info ", enum pids_fetch_type " which ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
\fBprocps_pids_reap()\fR is the function that will load the various
files in the
.BR proc (5)
filesystem and fill the returned structure with the parsed values as
well as a summary of the information gathered.
The function is able to parse only processes or also include threads, the
option \fIwhich\fR can be set to \fBPIDS_FETCH_TASKS_ONLY\fR or
\fBPIDS_FETCH_THREADS_TOO\fR to determine what is collected.
The info structure first needs to be initialised by
.BR procps_pids_new (3).
if \fBprocps_pids_reap()\fR returns successfully, a program can
then iterate through a loop using the accessor methods described in
.BR libproc (3).
.SH RETURN VALUE
\fBprocps_pids_reap()\fR returns a pointer to struct pids_fetch
on success and NULL on failure.
.SH VERSIONS
\fBprocps_pids_reap()\fR first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_unref (3),
.BR proc (5).
.\" (C) Copyright 2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_REF 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_ref \-
Increment reference count for pids structure.
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "int procps_pids_ref(struct pids_info *" info ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
.BR procps_pids_ref ()
Will increment the reference count for the \fBpids_info\fR structure that was
created with
.BR procps_pids_new (3).
The reference count is used by
.BR procps_pids_unref (3)
to determine when to de-allocate memort used by this structure.
.SH RETURN VALUE
The function returns the updated reference count on success
and one of negative values below on failure.
.TP
.B -EINVAL
One of the given parameters is incorrect.
.SH VERSIONS
.B procps_pids_ref()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_unref (3),
.BR proc (5).
.\" (C) Copyright 2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_reset 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_reset \-
Change what information is collected for a process
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "int procps_pids_reset(struct pids_info **" info ", enum pids_item *" items ", int " numitems ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
During the initial call to \fBprocps_pids_new\fR(3), the information structure
is allocated and the information items are specified.
\fBprocps_pids_reset\fR allows you to change what items for a process are collected
without having to unreference and create a new \fIpids_info\fR structure.
The changed PID information structure can then be used in subsequent calls to
.BR procps_pids_get (3),
.BR procps_pids_reap (3),
.BR procps_pids_reset (3),
.BR procps_pids_select (3),
.BR procps_pids_sort (3)
or even to further calls to \fBprocps_pids_reset\fR itself.
The \fIitems\fR and \fInumitems\fR parameters are identical to the parameters
used in \fBprocps_pids_new\fR.
.SH RETURN VALUE
The function returns 0 on success and one of negative values below
on failure.
.TP
.B -EINVAL
One of the given parameters is incorrect.
.TP
.B -ENOMEM
Unable to allocate memory for the changed structure.
.SH VERSIONS
.B procps_pids_reset()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_reap (3),
.BR procps_pids_select (3),
.BR procps_pids_sort (3),
.BR procps_pids_unref (3),
.BR proc (5).
.\" (C) Copyright 2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_select 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_select \- Harvest process information that matches PID or UID
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "struct pids_fetch * procps_pids_select(struct pids_info *" info ", unsigned *" these ", int "numthese ", enum pids_select_type " which ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
\fBprocps_pids_select()\fR provides the same functionality as
\fBprocps_pids_reap()\fR except it will only fetch information for the
processes that have the process ID (PID) or User ID (UID) found in the
array \fIthese\fR.
\fIthese\fR is an array of process IDs (PIDs) or User IDs that the
function will use to match against.
\fInumthese\fR the length of the \fIthese\fR array.
The \fIwhich\fR parameter tells the funtion what type of information is
contained in \fIthese\fR and can be either \fBPIDS_SELECT_PID\fR if
\fIthese\fR is an array of PIDs or \fBPIDS_SELECT_UID\fR if \fIthese\fR
is an array of UIDs.
The info structure first needs to be initialised by
.BR procps_pids_new (3).
if \fBprocps_pids_select()\fR returns successfully, a program can
then iterate through a loop using the accessor methods described in
.BR libproc (3).
.SH RETURN VALUE
\fBprocps_pids_select()\fR returns a pointer to struct pids_fetch
on success and NULL on failure.
.SH VERSIONS
\fBprocps_pids_select()\fR first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_reap (3),
.BR procps_pids_unref (3),
.BR proc (5).
.\" (C) Copyright 2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_SORT 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_sort \-
Sort process information
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "pids_stack **procps_pids_sort(struct pids_info *" info ", struct pids_stack *" stacks "[], int " numstacked ", enum pids_item " sortitem ", enum pids_sort_order " order ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
\fBprocps_pids_sort\fR sorts the given \fIstacks\fR stack of process
information and sorts it by the given \fIsortitem\fR. \fInumstacked\fR
must be the length of the \fIstacks\fR array and all the stacks in the
list must be homogenous (of equal length and content).
The stacks value can be obtained by a previous call of
.BR procps_pids_reap (3)
or
.BR procps_pids_select (3)
and then accessing the \fIstacks\fR member from that structure.
\fIorder\fR can be either PIDS_SORT_ASCEND or PIDS_SORT_DESCEND.
.SH RETURN VALUE
The function returns the sorted stack on success or NULL on failure.
.SH VERSIONS
.B procps_pids_sort()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_reap (3),
.BR procps_pids_select (3),
.BR proc (5).
.\" (C) Copyright 2017 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_PIDS_UREF 3 2017-01-05 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_pids_refg \-
Clear memory of pids structure, if no longer used
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "int procps_pids_refg(struct pids_info **" info ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
.BR procps_pids_refg ()
will note that one less reference is used for the specified structure. If
this was the last reference, the function returns the memory for the
PID information structure that was created with
.BR procps_pids_new (3).
.SH RETURN VALUE
The function returns 0 if the structure was freed or a positive
integer of the current references if there were others. It will
return one of negative values below on failure.
.TP
.B -EINVAL
One of the given parameters is incorrect.
.SH VERSIONS
.B procps_pids_refg()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR libproc (3),
.BR procps_pids_new (3),
.BR procps_pids_reap (3),
.BR procps_pids_reset (3),
.BR procps_pids_select (3),
.BR procps_pids_sort (3),
.BR proc (5).
.\" (C) Copyright 2016 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_UPTIME 3 2016-05-01 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_uptime \-
provide the uptime and idle time in seconds
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");"
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
The function
.BR procps_uptime ()
fills the location of the two double points with the current sytem uptime
and idle time.
.SH RETURN VALUE
.BR procps_uptime ()
returns 0 on success. On failure, it
returns a negative integer to one of the values defined below.
.TP
.B -ERANGE
Unable to parse the uptime file.
.PP
.BR procps_uptime ()
may also return any (negated) value that \fBfopen\fR() may set errno to.
.SH FILES
.TP
.I /proc/uptime
The raw values for uptime and idle time.
.SH VERSIONS
.B procps_uptime()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR fopen (3),
.BR proc (5).
.\" (C) Copyright 2016 Craig Small <csmall@enc.com.au>
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual 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
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_uptime_sprint_SPRINT 3 2016-04-16 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_uptime_sprint \-
provide the uptime and idle time in seconds
.SH SYNOPSIS