procps/proc/readproc.3

78 lines
2.0 KiB
Groff
Raw Normal View History

.\" This file describes the readproc interface to the /proc filesystem
.\"
.\" Copyright 1996 Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>
.\" Copyright 2014 Jaromir Capik <jcapik@redhat.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH READPROC 3 "14 July 2014" "Linux Manpage" "Linux Programmer's Manual"
.SH NAME
readproc, freeproc \- read information from next /proc/## entry
.SH SYNOPSIS
.B #include <proc/readproc.h>
.sp
.BI "proc_t* readproc(PROCTAB *" PT ", proc_t *" return_buf ");"
.br
.BI "void freeproc(proc_t *" p ");"
.SH DESCRIPTION
.B readproc
reads the information for the next process matching the criteria
specified in
.I PT
and fills them into a
.I proc_t
structure. If
.I return_buf
is not NULL, it will use the struct pointed at by
.IR return_buf .
Otherwise it will allocate a new
.I proc_t
stucture and return a pointer to it.
Note that (if so specified in
.IR PT )
readproc always allocates memory if it fills in the
.IR environ " or " cmdline
parts of
.IR proc_t .
.B freeproc
frees all memory allocated for the
.I proc_t
struct
.IR *p .
The
.I proc_t
structure is defined in
.IR <proc/readproc.h> ,
please look there for a definition of all fields.
.SH "RETURN VALUE"
.B readproc
returns a pointer to the next
.I proc_t
or NULL if there are no more processes left.
.SH "SEE ALSO"
.BR openproc (3),
.BR readproctab (3),
.BR /usr/include/proc/readproc.h ,
.BR /proc/#pid/ ,
.SH "REPORTING BUGS"
Please send bug reports to
.UR procps@freelists.org
.UE