Commit 8d8e6b3
committed
Fix async-signal-safety in MMU cache stat handler
The signal handler for SIGINT/SIGTERM was calling fprintf(), which
is not async-signal-safe and can lead to deadlocks or data corruption.
- Use volatile sig_atomic_t flag instead of calling fprintf directly
- Signal handler now only sets the flag (async-signal-safe)
- Main loops check the flag and print statistics when safe
- Applies to both SMP (coroutine) and single-hart execution paths1 parent e9fa09a commit 8d8e6b3
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| 914 | + | |
914 | 915 | | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
| 919 | + | |
918 | 920 | | |
919 | 921 | | |
920 | | - | |
921 | | - | |
922 | | - | |
| 922 | + | |
923 | 923 | | |
924 | 924 | | |
925 | 925 | | |
| |||
1029 | 1029 | | |
1030 | 1030 | | |
1031 | 1031 | | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1032 | 1039 | | |
1033 | 1040 | | |
1034 | 1041 | | |
| |||
1122 | 1129 | | |
1123 | 1130 | | |
1124 | 1131 | | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1125 | 1137 | | |
1126 | 1138 | | |
1127 | 1139 | | |
| |||
0 commit comments