| 5970 | } |
| 5971 | |
| 5972 | static __attribute__((__noreturn__)) void exit(int status) |
| 5973 | { |
| 5974 | if (mutex_lock(&stdio_mutex) < 0) |
| 5975 | panic("failed to lock stdio stream"); |
| 5976 | for (int i = 0; i < 3; i++) |
| 5977 | { |
| 5978 | FILE *stream = stdio_stream[i]; |
| 5979 | if (stream != NULL) |
| 5980 | fclose(stream); |
| 5981 | } |
| 5982 | (void)syscall(SYS_exit_group, status); |
| 5983 | while (true) |
| 5984 | asm volatile ("ud2"); |
| 5985 | } |
| 5986 | |
| 5987 | static __attribute__((__noreturn__)) void abort(void) |
| 5988 | { |