Commit f3c608d
committed
Return -1 for syscall close on fd less than 3
Some user programs attempt to close stdout or stderr, but rv32emu
relies on these file descriptors for logging and debugging.
Allowing their closure could lead to unexpected behavior, making it
difficult to trace emulator activity.
This commit modifies the syscall close implementation to return -1
when attempting to close file descriptors less than 3. By ensuring
these essential output channels remain open, rv32emu retains its
ability to print logs and error messages. User programs receive a
clear failure signal instead of silently closing critical streams.
Close #4351 parent 4cd1526 commit f3c608d
4 files changed
+41
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1081 | 1087 | | |
1082 | 1088 | | |
1083 | 1089 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
| 409 | + | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
437 | 446 | | |
438 | 447 | | |
439 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
551 | 559 | | |
552 | 560 | | |
553 | 561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
233 | 249 | | |
234 | 250 | | |
235 | 251 | | |
| |||
245 | 261 | | |
246 | 262 | | |
247 | 263 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
0 commit comments