Files
foxhunt/scripts/fix_unsafe_blocks.sh
jgrusewski 8d89fe80ff chore: Second cleanup wave - organize root directory
- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/
- Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root)
- Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/
- Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts
- Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries)
- Tests: Move 14 .rs files → tests/standalone/
- SQL: Move 5 files → sql/ (keep init-db*.sql for Docker)
- Wave 153: Archive to docs/archive/historical/wave153/
- Docs: Archive 9 markdown files to wave_d/reports/ and historical/

Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files
Directory count reduced from 65 to 31 (52% reduction)
All historical data preserved in organized archive structure
2025-10-30 01:26:02 +01:00

17 lines
1.4 KiB
Bash

#!/bin/bash
# Script to add safety comments to unsafe blocks missing them
# File: trading_engine/src/affinity.rs - Line 386
sed -i '386i\ // SAFETY: We use libc CPU_SET macros with a properly initialized cpu_set_t.\n // cpu_set_t is zeroed before use, and CPU_SET/CPU_ZERO are standard POSIX operations.\n // sched_setaffinity is called with valid parameters for the current thread (pid=0).' trading_engine/src/affinity.rs
# File: trading_engine/src/affinity.rs - Line 467 (after previous additions, now ~470)
sed -i '470i\ // SAFETY: Standard libc sched_setscheduler call with properly initialized sched_param.\n // We pass valid SCHED_FIFO policy and priority within acceptable range (1-99).' trading_engine/src/affinity.rs
# File: trading_engine/src/affinity.rs - Line 492 (after previous additions, now ~498)
sed -i '498i\ // SAFETY: mlockall is a standard libc call to lock memory pages.\n // Flags MCL_CURRENT and MCL_FUTURE are valid POSIX constants.' trading_engine/src/affinity.rs
# File: trading_engine/src/affinity.rs - Line 519 (after previous additions, now ~528)
sed -i '528i\ // SAFETY: sched_getaffinity reads CPU affinity into a properly initialized cpu_set_t.\n // The cpu_set_t is zeroed before use, ensuring safe initialization for the libc call.' trading_engine/src/affinity.rs
echo "Added safety comments to trading_engine/src/affinity.rs"