* this function is a POSIX compliant version, which shall request that all data * for the open file descriptor named by fildes is to be transferred to the storage * device associated with the file described by fildes. * * @param fildes the file description * * @return 0 on successful completion. Otherwise, -1 shall be returned and errno * set to indicate the error. */
| 447 | * set to indicate the error. |
| 448 | */ |
| 449 | int fsync(int fildes) |
| 450 | { |
| 451 | int ret; |
| 452 | struct dfs_file *d; |
| 453 | |
| 454 | /* get the fd */ |
| 455 | d = fd_get(fildes); |
| 456 | if (d == NULL) |
| 457 | { |
| 458 | rt_set_errno(-EBADF); |
| 459 | return -1; |
| 460 | } |
| 461 | |
| 462 | ret = dfs_file_flush(d); |
| 463 | |
| 464 | return ret; |
| 465 | } |
| 466 | RTM_EXPORT(fsync); |
| 467 | |
| 468 | /** |
no test coverage detected