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

Function dfs_fdtable_drop_fd

components/dfs/dfs_v2/src/dfs.c:634–657  ·  view source on GitHub ↗

* @brief drop fd from the fd table. * * @param fdt is the fd table, if empty, use global (_fdtab). * * @param fd is the fd in the designate fd table. * * @return -1 on failed the drop file descriptor. */

Source from the content-addressed store, hash-verified

632 * @return -1 on failed the drop file descriptor.
633 */
634int dfs_fdtable_drop_fd(struct dfs_fdtable *fdt, int fd)
635{
636 int err = 0;
637
638 if (fdt == NULL)
639 {
640 fdt = &_fdtab;
641 }
642
643 if (dfs_file_lock() != RT_EOK)
644 {
645 return -RT_ENOSYS;
646 }
647
648 err = dfs_file_close(fdt->fds[fd]);
649 if (!err)
650 {
651 fdt_fd_release(fdt, fd);
652 }
653
654 dfs_file_unlock();
655
656 return err;
657}
658
659/**
660 * @brief Duplicate a file descriptor in the current process's file descriptor table

Callers

nothing calls this directly

Calls 4

dfs_file_lockFunction · 0.70
dfs_file_closeFunction · 0.70
fdt_fd_releaseFunction · 0.70
dfs_file_unlockFunction · 0.70

Tested by

no test coverage detected