* @brief Close all open files for the given LWP * * @param[in] lwp The LWP whose files should be closed * * @note This function iterates through all file descriptors in the LWP's file * descriptor table, closing each open file. It is typically called when * an LWP is being destroyed or when the LWP is switching to a new thread. */
| 374 | * an LWP is being destroyed or when the LWP is switching to a new thread. |
| 375 | */ |
| 376 | static void __exit_files(struct rt_lwp *lwp) |
| 377 | { |
| 378 | int fd = lwp->fdt.maxfd - 1; |
| 379 | |
| 380 | while (fd >= 0) |
| 381 | { |
| 382 | struct dfs_file *d; |
| 383 | |
| 384 | d = lwp->fdt.fds[fd]; |
| 385 | if (d) |
| 386 | { |
| 387 | dfs_file_close(d); |
| 388 | fdt_fd_release(&lwp->fdt, fd); |
| 389 | } |
| 390 | fd--; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * @brief Initialize the user object lock for a lightweight process |
no test coverage detected