Files
foxhunt/fix_unsafe_blocks.sh
jgrusewski 589bf7c081 🔧 Wave 112: Automated fix scripts and utilities
- fix_api_gateway_mfa.sh: MFA compilation fixes
- fix_audit_compliance_part2.sh: Audit compliance fixes
- fix_mfa_compilation.sh: MFA-specific compilation fixes
- fix_unsafe_blocks.sh: Unsafe code analysis
- fix_wave112_compilation.sh: Main compilation fix script
- Test management utilities (mark_tests_ignored.sh, stub_ignored_tests.sh)
2025-10-05 22:23:30 +02: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"