myxce/src/scheduler/include
Rongsong Shen ff8d4f416e
feat(scheduler-core): implement record start/stop lifecycle (task 9.2)
Adds recording-state fields directly to xce_scheduler_t (no new
xce_sched_driver_t type, per task 9.1's precedent). sched_record_start()/
sched_record_stop() implement AC 10: validate via task 9.1's path
validator, open with a TOCTOU-hardened sequence (O_NOFOLLOW, no O_TRUNC,
fstat()+st_nlink==1 check before ftruncate()), snapshot the core, write
ReplayHeader+SnapshotEntry on start, ReplayEvent{endSession} on stop.

driver.c gains boolean-gated recording hooks in
xce_sched_driver_translate_pending_events() (per-event-batch ReplayEvent
writes, new recording_events.c) and xce_sched_driver_run_normal_mode_round()
(per-session ReplaySession writes, new recording_session.c) -- zero I/O/
allocation when inactive.

Two real bugs found and fixed during implementation: bug-1498 (O_TRUNC
would have truncated a hard-linked victim file before the TOCTOU check
could reject it) and bug-1499 (a transient edit dropped
xce_core_signal_go(), causing a 3-way thread deadlock).

test_record_lifecycle.c decodes the full start->events->session->stop
cycle with the real capnp decoders and asserts the exact message
sequence; TOCTOU regression tests use real symlink(2)/link(2) syscalls.

25/25 scheduler suite, clang-format clean.
2026-08-05 09:07:51 +00:00
..
sched feat(scheduler-core): add picker configuration fields (task 1.3) 2026-08-03 05:45:53 +00:00
core.h feat(scheduler-core): implement snapshot save and load (task 8.1) 2026-08-05 03:57:10 +00:00
decision.h feat(scheduler-core): implement session-start signal + decision callback (task 4.4) 2026-08-04 03:08:18 +00:00
driver.h feat(scheduler-core): implement record start/stop lifecycle (task 9.2) 2026-08-05 09:07:51 +00:00
plugin.h feat(scheduler-core): wire builtin_fcfs as registered default picker (task 2.4) 2026-08-03 08:51:45 +00:00
recording.h feat(scheduler-core): implement record start/stop lifecycle (task 9.2) 2026-08-05 09:07:51 +00:00
scheduler.h feat(scheduler-core): implement record start/stop lifecycle (task 9.2) 2026-08-05 09:07:51 +00:00