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

Function sys_dup

components/dfs/dfs_v2/src/dfs.c:818–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816sysret_t sys_dup(int oldfd)
817#else
818int sys_dup(int oldfd)
819#endif
820{
821 int err = 0;
822 int newfd = dfs_dup(oldfd, (dfs_fdtable_get() == &_fdtab) ? DFS_STDIO_OFFSET : 0);
823 if(newfd < 0)
824 {
825 err = rt_get_errno();
826 }
827
828#ifdef RT_USING_SMART
829 return err < 0 ? err : newfd;
830#else
831 return err < 0 ? err : newfd;
832#endif
833}
834
835/**
836 * @brief System call to duplicate a file descriptor to a specific descriptor number

Callers

nothing calls this directly

Calls 3

dfs_dupFunction · 0.85
rt_get_errnoFunction · 0.85
dfs_fdtable_getFunction · 0.70

Tested by

no test coverage detected