RC\_FIND\_PIDS(3) Library Functions Manual (smm) RC\_FIND\_PIDS(3)

# [NAME](#NAME)

`rc_find_pids` — finds the pids of processes that match the given criteria

# [LIBRARY](#LIBRARY)

Run Command library (librc, -lrc)

# [SYNOPSIS](#SYNOPSIS)

`#include <rc.h>`

`RC_PIDLIST *`  
`rc_find_pids`(`const char *const *argv`, `const char *cmd`, `uid_t uid`, `pid_t pid`);

# [DESCRIPTION](#DESCRIPTION)

[`rc_find_pids`](#rc_find_pids)() returns RC\_PIDLIST, a structure based on the LIST macro from [queue(3)](/man/os/openrc/queue.3) which contains all the pids found matching the given criteria. If `pid` is given then only that pid is returned if it is running. Otherwise we check all instances of `argv` with a process name of `cmd` owned by `uid`, all of which are optional.

The returned list should be freed when done.

# [IMPLEMENTATION NOTES](#IMPLEMENTATION_NOTES)

On BSD systems we use Kernel Data Access Library (libkvm, -lkvm) and on Linux systems we use the /proc filesystem to find our processes.

Each RC\_PID should be freed in the list as well as the list itself when done.

# [SEE ALSO](#SEE_ALSO)

[free(3)](/man/os/openrc/free.3), [queue(3)](/man/os/openrc/queue.3)

# [AUTHORS](#AUTHORS)

Roy Marples &lt;roy@marples.name&gt;

March 17, 2008 OpenRC

---

Document: rc_find_pids(3) from openrc 0.64.1-r2 (Chainguard OS)
Source: https://github.com/OpenRC/openrc
