rc_find_pids now returns RC_PIDLIST instead of a NULL terminated array.

This commit is contained in:
Roy Marples
2008-03-17 09:59:52 +00:00
parent 40930d7d0a
commit 50a7697bf2
5 changed files with 93 additions and 72 deletions

View File

@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd Feb 22, 2008
.Dd Mar 17, 2008
.Dt RC_FIND_PIDS 3 SMM
.Os OpenRC
.Sh NAME
@@ -32,20 +32,22 @@
Run Command library (librc, -lrc)
.Sh SYNOPSIS
.In rc.h
.Ft "pid_t *" Fo rc_find_pids
.Fa "const char *exec"
.Ft "RC_PIDLIST *" Fo rc_find_pids
.Fa "const char *const *argv"
.Fa "const char *cmd"
.Fa "uid_t uid"
.Fa "pid_t pid"
.Fc
.Sh DESCRIPTION
.Fn rc_find_pids
returns a NULL terminated list of pids for processes matching the given
criteria. If
returns RC_PIDLIST, a structure based on the LIST macro from
.Xr queue 3
which contains all the pids found matching the given criteria.
If
.Fa pid
is given then only that pid is returned if it is running. Otherise we check
all instances of
.Fa exec
.Fa argv
with a process name of
.Fa cmd
owned by
@@ -59,8 +61,10 @@ On BSD systems we use
and on Linux systems we use the
.Pa /proc
filesystem to find our processes.
.Pp
Each RC_PID should be freed in the list as well as the list itself when done.
.Sh SEE ALSO
.Xr free 3 ,
.Xr malloc 3
.Xr queue 3
.Sh AUTHORS
.An "Roy Marples" Aq roy@marples.name