The Pedigree Project 0.1
wait-state.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef PEDIGREE_POSIX_WAIT_STATE_H
3#define PEDIGREE_POSIX_WAIT_STATE_H
4
5#include <stdint.h>
6
7namespace PosixWait {
8enum class Selector { All, Pid, Pgid };
9enum Event : unsigned { Exited = 1, Stopped = 2, Continued = 4 };
10enum Cause : int32_t { Exit = 1, Killed = 2, Dumped = 3, Trapped = 4, Stop = 5, Continue = 6 };
11
12struct Request {
13 Selector selector = Selector::All;
14 int32_t id = 0;
15 unsigned events = Exited;
16 bool noHang = false;
17 bool noWait = false;
18 bool traceStops = false;
19};
20
21struct Report {
22 int32_t pid = 0;
23 int32_t cause = 0;
24 int32_t status = 0;
25 uint32_t uid = 0;
26 uint64_t userNanoseconds = 0;
27 uint64_t kernelNanoseconds = 0;
28};
29
30// Returns one report, zero for WNOHANG, or -1 with errno. No lifetime claim
31// escapes: consuming calls publish the sole reaper before user copyout.
32int collect(const Request& request, Report& report);
33} // namespace PosixWait
34#endif
Definition Event.h:49