RC_FIND_PIDS(3)
π RC_FIND_PIDS(3) π
okay bestie, so this is a page from the System Manager's Manual β yes we're in the big leagues now β and it's all about rc_find_pids, a lil function from the Run Command library (librc, link it with -lrc). she's giving process-hunting, she's giving detective energy, and honestly? obsessed. πβ¨
π NAME π
rc_find_pids β finds the pids of processes that match the given criteria
like. that's literally her whole job. finding pids. no notes. π
πΈ LIBRARY πΈ
Run Command library (librc, -lrc)
β¨ SYNOPSIS β¨
#include <rc.h>
RC_PIDLIST *
rc_find_pids(const char *const *argv, const char *cmd, uid_t uid,
pid_t pid);
π¦ DESCRIPTION π¦
So rc_find_pids() returns an RC_PIDLIST β which is a structure based on the LIST macro from queue(3) β and it contains all the pids that matched your criteria. slay.
Now here's the tea on how it picks:
- If you give it a
pid, then only that pid comes back, and only if it's actually running. like, if it's not running, bestie, there's nothing to return. π - Otherwise, it checks all instances of
argvwith a process name ofcmdowned byuidβ and all of those are optional, so mix and match however you like.
β οΈ the returned list should be freed when you're done with it!! do NOT just leave it lying around, that's not the vibe. π«Ά
π IMPLEMENTATION NOTES π
She's got range, okay? Different systems, different methods, same iconic results:
- On BSD systems we use the Kernel Data Access Library (
libkvm,-lkvm). - On Linux systems we use the
/procfilesystem to find our processes.
π¨ IMPORTANT, no cap: each RC_PID should be freed in the list as well as the list itself when you're done. that's both. the pid and the list. free them. all of them. π
π SEE ALSO π
π AUTHORS π
Roy Marples <roy@marples.name>
mwah π that's the whole page, bestie β go forth and find those pids. this was brought to you by OpenRC, dated Mar 17, 2008, and yes she's been serving since 2008 and she's still that girl. periodt. πβ¨π
π¦ where this page comes from
- alpine 3.22: openrc-doc 0.62.6-r0 Β· BSD-2-Clause
- alpine 3.23: openrc-doc 0.63-r1 Β· BSD-2-Clause
- alpine 3.24: openrc-doc 0.63.2-r0 Β· BSD-2-Clause
- debian bookworm: librc-dev 0.45.2-2+deb12u1 Β· BSD-2-clauses
- debian trixie: librc-dev 0.56-1 Β· BSD-2-clauses
- Copyright (c) 2007-2015 The OpenRC Authors
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms