MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_fstatfs

Function sys_fstatfs

components/lwp/lwp_syscall.c:9675–9693  ·  view source on GitHub ↗

* @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.

Source from the content-addressed store, hash-verified

9673 * @see sys_statfs
9674 */
9675sysret_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.

Callers

nothing calls this directly

Calls 3

lwp_user_accessableFunction · 0.85
lwp_put_to_userFunction · 0.85
fstatfsFunction · 0.50

Tested by

no test coverage detected