* @brief Get filesystem statistics for a file descriptor. * * This function retrieves statistics about the filesystem containing the file referred to by the * file descriptor `fd`. The information is stored in the provided `statfs` structure, which includes * details such as total blocks, free blocks, available inodes, etc. * * @param[in] fd The file descriptor referring to an open file.
| 9673 | * @see sys_statfs |
| 9674 | */ |
| 9675 | sysret_t sys_fstatfs(int fd, struct statfs *buf) |
| 9676 | { |
| 9677 | int ret = 0; |
| 9678 | struct statfs statfsbuff = {0}; |
| 9679 | |
| 9680 | if (!lwp_user_accessable((void *)buf, sizeof(struct statfs))) |
| 9681 | { |
| 9682 | return -EFAULT; |
| 9683 | } |
| 9684 | |
| 9685 | ret = _SYS_WRAP(fstatfs(fd, &statfsbuff)); |
| 9686 | |
| 9687 | if (ret == 0) |
| 9688 | { |
| 9689 | lwp_put_to_user(buf, &statfsbuff, sizeof statfsbuff); |
| 9690 | } |
| 9691 | |
| 9692 | return ret; |
| 9693 | } |
| 9694 | |
| 9695 | /** |
| 9696 | * @brief Get 64-bit filesystem statistics for a file descriptor. |
nothing calls this directly
no test coverage detected