* @brief Terminates the calling thread and exits the process. * * This system call ends the execution of the calling thread and the process * it belongs to. * * @param status The exit code to be returned to the parent process. * A value of 0 typically indicates successful execution, while * non-zero values indicate an error or specific exit condition. * @return
| 384 | * `sys_exit` only terminates the calling thread and the process. |
| 385 | */ |
| 386 | sysret_t sys_exit(int status) |
| 387 | { |
| 388 | sysret_t rc = 0; |
| 389 | rt_thread_t tid; |
| 390 | |
| 391 | tid = rt_thread_self(); |
| 392 | if (tid && tid->lwp) |
| 393 | { |
| 394 | lwp_thread_exit(tid, status); |
| 395 | } |
| 396 | else |
| 397 | { |
| 398 | LOG_E("Can't find matching process of current thread"); |
| 399 | rc = -EINVAL; |
| 400 | } |
| 401 | |
| 402 | return rc; |
| 403 | } |
| 404 | |
| 405 | /** |
| 406 | * @brief Reads data from a file descriptor into a buffer. |
nothing calls this directly
no test coverage detected