Wait3(3pm)

πŸ’– NAME πŸ’–

Proc::Wait3 β€” bestie, it's a Perl extension for the wait3 system call. That's the whole vibe. πŸ¦‹


✨ SYNOPSIS ✨

okay so first you gotta pull it in:

use Proc::Wait3;

then you call wait3 and it hands you eighteen values back. Not a typo. Eighteen. Buckle up:

($pid, $status, $utime, $stime, $maxrss, $ixrss, $idrss, $isrss,
$minflt, $majflt, $nswap, $inblock, $oublock, $msgsnd, $msgrcv,
$nsignals, $nvcsw, $nivcsw) = wait3(0); # doesn't wait

($pid, $status, $utime, $stime, $maxrss, $ixrss, $idrss, $isrss,
$minflt, $majflt, $nswap, $inblock, $oublock, $msgsnd, $msgrcv,
$nsignals, $nvcsw, $nivcsw) = wait3(1); # waits for a child

see how the only thing that changed is the 0 vs the 1? that's the whole plot twist 😭


🌸 DESCRIPTION 🌸

so if any child processes have exited, this call will "reap" the zombies β€” same energy as the perl wait function, just with receipts attached. πŸ§ŸπŸ’€

By default? It returns immediately, and if there are no dead children, everything comes back undefined. Not empty, not zero β€” undefined. So don't be out here doing math on it without a vibe check first, fr fr.

But if you pass in a true argument, it will block until a child exits (or it gets a signal). So like. it's gonna sit there and wait for you. patiently. iconic behaviour honestly. πŸ’…

here's the full lineup of what you get back:

  • $pid β€” the PID of the exiting child πŸ‘‘
  • $status β€” the exit status of the child, just like $?
  • $utime β€” floating point user cpu seconds
  • $stime β€” floating point system cpu seconds
  • $maxrss β€” the maximum resident set size utilized (in kilobytes)
  • $minflt β€” the number of page faults serviced without any I/O activity; here the I/O activity is avoided by "reclaiming" a page frame from the list of pages awaiting reallocation
  • $majflt β€” the number of page faults serviced that required I/O activity
  • $nswap β€” the number of times a process was "swapped" out of main memory
  • $inblock β€” the number of times the file system had to perform input
  • $oublock β€” the number of times the file system had to perform output
  • $msgsnd β€” the number of messages sent over sockets
  • $msgrcv β€” the number of messages received from sockets
  • $nsignals β€” the number of signals delivered
  • $nvcsw β€” the number of times a context switch resulted due to a process voluntarily giving up the processor before its time slice was completed (usually to await availability of a resource)
  • $nivcsw β€” the number of times a context switch resulted due to a higher priority process becoming runnable, or because the current process exceeded its time slice
also bestie, notice the synopsis is out here claiming $ixrss, $idrss and $isrss too β€” the page just never breaks those three down for us. so we're not gonna make anything up about them. no cap. πŸ™ˆ

πŸŽ€ AUTHOR πŸŽ€

C. Tilmes <curt@tilmes.org> β€” thank you for your service, king 🫢


⭐ LICENSE ⭐

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source behaviour, we love to see it πŸ’–


🌈 SEE ALSO 🌈

  • perl
  • wait3
  • getrusage

okay that's the whole page!! go forth and reap your zombies responsibly, mwah πŸ’œ

this one's from perl v5.42.3, dated 2026-08-19 β€” so yeah, go read the Wait3(3pm) page, it ate and left no crumbs ✨

πŸ“¦ where this page comes from