The daemon forks one child per accepted connection, so per-module and per-source accounting must live in state shared across the children. Add a fixed-size registry carved from an anonymous shared mapping (mmap(MAP_SHARED|MAP_ANONYMOUS)) created before the accept loop: a slot lifecycle (FREE/CLAIMED/REGISTERED) with parent claim/reclaim and a lock-free, open-addressed per-source table for the per-host occupancy and the shared auth-failure counter. C11 atomics only; no pthread locks across fork. Unit tests cover slot exhaustion, the module/host caps, pid reclaim and fork-shared visibility.
7 lines
94 B
C
7 lines
94 B
C
#ifndef TEST_DAEMON_LIMITS_H
|
|
#define TEST_DAEMON_LIMITS_H
|
|
|
|
void test_daemon_limits();
|
|
|
|
#endif
|