* this function is a POSIX compliant version, which will get file status. * * @param fildes the file description * @param buf the data buffer to save stat description. * * @return 0 on successful, -1 on failed. */
| 552 | * @return 0 on successful, -1 on failed. |
| 553 | */ |
| 554 | int fstat(int fildes, struct stat *buf) |
| 555 | { |
| 556 | int ret = -1; |
| 557 | struct dfs_file *file; |
| 558 | |
| 559 | if (buf == NULL) |
| 560 | { |
| 561 | rt_set_errno(-EBADF); |
| 562 | return -1; |
| 563 | } |
| 564 | |
| 565 | /* get the fd */ |
| 566 | file = fd_get(fildes); |
| 567 | if (file == NULL) |
| 568 | { |
| 569 | rt_set_errno(-EBADF); |
| 570 | |
| 571 | return -1; |
| 572 | } |
| 573 | |
| 574 | if (dfs_is_mounted(file->dentry->mnt) == 0) |
| 575 | { |
| 576 | ret = file->dentry->mnt->fs_ops->stat(file->dentry, buf); |
| 577 | } |
| 578 | |
| 579 | return ret; |
| 580 | } |
| 581 | RTM_EXPORT(fstat); |
| 582 | #endif |
| 583 |
nothing calls this directly
no test coverage detected