---
name: "rc_find_pids"
section: "3"
platform: "linux"
package: "librc-dev"
version: "0.56-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rc_find_pids"
---

# rc\_find\_pids(3)

finds the pids of processes that match the given criteria

## NAME

**rc\_find\_pids** – finds the pids of processes that match the given criteria

## LIBRARY

Run Command library (librc, -lrc)

## SYNOPSIS

**#include \<rc.h\>**

*RC\_PIDLIST \** *Fo* *rc\_find\_pids*\
 *const char \*const \*argv* *const char \*cmd* *uid\_t uid* *pid\_t pid*);

## DESCRIPTION

**rc\_find\_pids**() returns RC\_PIDLIST, a structure based on the LIST macro from [queue(3)](/queue/3.md) 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

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

[free(3)](/free/3.md), [queue(3)](/queue/3.md)

## AUTHORS

Roy Marples \<roy@marples.name\>
